18 Commits

Author SHA1 Message Date
75db025d80 Added type 2025-02-05 15:00:45 +01:00
d33ac7e9f8 cleared code 2025-02-04 18:28:40 +01:00
bbae61da42 Moved param class outside XMLRequestBody 2025-02-04 17:42:32 +01:00
1d5038ca51 Added params functionalities to multipleXml, bugfix 2025-02-04 17:41:22 +01:00
bdb807d3e0 bugfix 2025-01-24 11:57:44 +01:00
16b5522ff5 Removed redundant endpoint improved logic 2025-01-24 11:57:05 +01:00
04e37258bf Fixed sending parameters 2025-01-23 18:59:41 +01:00
b7af1eb33a Merge remote-tracking branch 'origin/Add_xslt_parameters' into Add_xslt_parameters 2025-01-17 15:12:30 +01:00
ec49f496da Removed function declaration from interface 2025-01-17 15:11:48 +01:00
9cb949b485 revert 097af3ed3a
revert Commmented redundat endpoints
2025-01-17 10:45:10 +01:00
097af3ed3a Commmented redundat endpoints 2025-01-17 10:25:26 +01:00
b9f26f07a8 Added new component for params 2025-01-16 11:30:56 +01:00
6a70c3c9c9 Merge remote-tracking branch 'origin/Add_xslt_parameters' into Add_xslt_parameters
# Conflicts:
#	Backend/tools-services/src/main/java/com/r11/tools/controller/XmlController.java
#	Backend/tools-services/src/main/java/com/r11/tools/controller/internal/XmlJobType.java
#	Backend/tools-services/src/main/java/com/r11/tools/xml/XmlEngine.java
2025-01-16 11:07:39 +01:00
a0d759f58b Added basic adding param functionality 2025-01-16 10:59:59 +01:00
9f64b83844 Added template for new operation 2025-01-09 18:21:49 +01:00
0d469db020 finished UI for adding parameters 2025-01-09 13:33:04 +01:00
38b3942bde added parameters component 2025-01-08 16:54:52 +01:00
e834229cae created UI for adding parameters 2025-01-07 13:20:45 +01:00
25 changed files with 620 additions and 573 deletions

View File

@@ -79,11 +79,9 @@ def xpath(source: str, xpath: str) -> str:
else: else:
result_string = "" result_string = ""
for e in result: for e in result:
if isinstance(e, etree._Element): result_string += etree.tostring(e, pretty_print=True).decode() + "\n"
result_string += etree.tostring(e, pretty_print=True).decode() + "\n" return result_string, "node"
else:
result_string += str(e) + "\n"
return result_string, "node"
def xsd(source: str, xsd: str) -> bool: def xsd(source: str, xsd: str) -> bool:

View File

@@ -84,8 +84,14 @@
<dependency> <dependency>
<groupId>xalan</groupId> <groupId>xalan</groupId>
<artifactId>xalan</artifactId> <artifactId>xalan</artifactId>
<version>2.7.2</version> <version>2.7.3</version>
</dependency> </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.12.2</version>
</dependency>
<!-- Logging --> <!-- Logging -->
<dependency> <dependency>

View File

@@ -68,7 +68,7 @@ public class MultipleXMLController implements RestController {
private XMLResponseBody processData(MultipleXmlJob xmlJob) throws Exception { private XMLResponseBody processData(MultipleXmlJob xmlJob) throws Exception {
XmlEngine engine = xmlJob.getEngine(); XmlEngine engine = xmlJob.getEngine();
XMLMultipleFilesBody requestBody = xmlJob.getRequestBody(); XMLMultipleFilesBody requestBody = xmlJob.getRequestBody();
String result = engine.processXSLT(requestBody.getData(), requestBody.getProcessorData()); String result = engine.processXSLT(requestBody.getParams(), requestBody.getData(), requestBody.getProcessorData());
return new XMLResponseBody(result, "OK", requestBody.getVersion()); return new XMLResponseBody(result, "OK", requestBody.getVersion());
} }

View File

@@ -1,17 +1,26 @@
package com.r11.tools.controller; package com.r11.tools.controller;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.r11.tools.controller.internal.*; import com.r11.tools.controller.internal.GlobalControllerManifest;
import com.r11.tools.controller.internal.HandlerType;
import com.r11.tools.controller.internal.RestController;
import com.r11.tools.controller.internal.ScopedControllerManifest;
import com.r11.tools.controller.internal.XmlJob;
import com.r11.tools.controller.internal.XmlJobType;
import com.r11.tools.model.XMLRequestBody; import com.r11.tools.model.XMLRequestBody;
import com.r11.tools.model.XMLResponseBody; import com.r11.tools.model.XMLResponseBody;
import com.r11.tools.model.XPathQueryResult; import com.r11.tools.model.XPathQueryResult;
import com.r11.tools.model.XmlTools;
import com.r11.tools.xml.XmlEngine; import com.r11.tools.xml.XmlEngine;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import spark.Request; import spark.Request;
import spark.Response; import spark.Response;
import java.util.Objects;
/** /**
* Controller used to handle XML tools: XPath, XSD validation, XQuery and XSLT * Controller used to handle XML tools: XPath, XSD validation, XQuery and XSLT
*
* @author Adam Bem * @author Adam Bem
*/ */
@GlobalControllerManifest @GlobalControllerManifest
@@ -22,12 +31,15 @@ public class XmlController implements RestController {
private final XmlEngine saxon; private final XmlEngine saxon;
private final XmlEngine xalan; private final XmlEngine xalan;
private final XmlTools tools;
public XmlController(Gson gson, Logger logger, XmlEngine saxon, XmlEngine xalan) { public XmlController(Gson gson, Logger logger, XmlEngine saxon, XmlEngine xalan) {
this.gson = gson; this.gson = gson;
this.logger = logger; this.logger = logger;
this.saxon = saxon; this.saxon = saxon;
this.xalan = xalan; this.xalan = xalan;
this.tools = new XmlTools();
} }
@ScopedControllerManifest(method = HandlerType.POST, path = "/xpath") @ScopedControllerManifest(method = HandlerType.POST, path = "/xpath")
@@ -48,6 +60,7 @@ public class XmlController implements RestController {
@ScopedControllerManifest(method = HandlerType.POST, path = "/xslt") @ScopedControllerManifest(method = HandlerType.POST, path = "/xslt")
public void acceptRequestXslt(Request request, Response response) { public void acceptRequestXslt(Request request, Response response) {
System.out.println("received xslt");
acceptRequest(request, response, XmlJobType.XSLT); acceptRequest(request, response, XmlJobType.XSLT);
} }
@@ -91,7 +104,6 @@ public class XmlController implements RestController {
responseBody.setDuration(duration); responseBody.setDuration(duration);
xmlJob.getResponse().status(200); xmlJob.getResponse().status(200);
this.logger.info("Request (" + xmlJob.getXmlJobType() + ", " + this.logger.info("Request (" + xmlJob.getXmlJobType() + ", " +
xmlJob.getEngine().getVersion() + xmlJob.getEngine().getVersion() +
") processed in " + duration + " ms."); ") processed in " + duration + " ms.");
@@ -130,7 +142,7 @@ public class XmlController implements RestController {
String result = null; String result = null;
switch (xmlJob.getXmlJobType()) { switch (xmlJob.getXmlJobType()) {
case XSLT: case XSLT:
result = engine.processXSLT(requestBody.getData(), requestBody.getProcessorData()); result = engine.processXSLT(requestBody.getParams(),requestBody.getData(), requestBody.getProcessorData());
break; break;
case XSD: case XSD:
result = engine.validate(requestBody.getData(), requestBody.getProcessorData()).trim(); result = engine.validate(requestBody.getData(), requestBody.getProcessorData()).trim();
@@ -141,9 +153,10 @@ public class XmlController implements RestController {
requestBody.getVersion()); requestBody.getVersion());
break; break;
} }
return new XMLResponseBody(result, "OK", requestBody.getVersion()); return new XMLResponseBody(result, "OK", requestBody.getProcessorData());
} }
private XMLResponseBody processingErrorResponse(Exception ex, XmlJob xmlJob) { private XMLResponseBody processingErrorResponse(Exception ex, XmlJob xmlJob) {
XmlEngine engine = xmlJob.getEngine(); XmlEngine engine = xmlJob.getEngine();
XmlJobType xmlJobType = xmlJob.getXmlJobType(); XmlJobType xmlJobType = xmlJob.getXmlJobType();

View File

@@ -7,7 +7,7 @@ import spark.Response;
public class XmlJob { public class XmlJob {
private final Response response; private final Response response;
private final XMLRequestBody requestBody; private final XMLRequestBody requestBody;
private final XmlEngine engine; private XmlEngine engine;
private final XmlJobType xmlJobType; private final XmlJobType xmlJobType;
public XmlJob(Response response, XMLRequestBody requestBody, XmlEngine engine, XmlJobType xmlJobType) { public XmlJob(Response response, XMLRequestBody requestBody, XmlEngine engine, XmlJobType xmlJobType) {
@@ -16,7 +16,11 @@ public class XmlJob {
this.engine = engine; this.engine = engine;
this.xmlJobType = xmlJobType; this.xmlJobType = xmlJobType;
} }
public XmlJob(Response response, XMLRequestBody requestBody, XmlJobType xmlJobType) {
this.response = response;
this.requestBody = requestBody;
this.xmlJobType = xmlJobType;
}
public Response getResponse() { public Response getResponse() {
return response; return response;
} }

View File

@@ -1,7 +1,7 @@
package com.r11.tools.controller.internal; package com.r11.tools.controller.internal;
public enum XmlJobType { public enum XmlJobType {
XPath("XPath"), XSD("XSD"), XQuery("XQuery"), XSLT("XSLT"); XPath("XPath"), XSD("XSD"), XQuery("XQuery"), XSLT("XSLT"), XSLT_PARAM("XSLT_PARAM");
XmlJobType(String type) { XmlJobType(String type) {
} }

View File

@@ -0,0 +1,20 @@
package com.r11.tools.model;
import com.google.gson.annotations.SerializedName;
public class Param {
@SerializedName("key")
private String key;
@SerializedName("value")
private String value;
public String getKey() {
return key;
}
public String getValue() {
return value;
}
}

View File

@@ -2,6 +2,8 @@ package com.r11.tools.model;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.util.List;
public class XMLMultipleFilesBody { public class XMLMultipleFilesBody {
@SerializedName("data") @SerializedName("data")
@@ -12,6 +14,8 @@ public class XMLMultipleFilesBody {
private String processor; private String processor;
@SerializedName("version") @SerializedName("version")
private String version; private String version;
@SerializedName("params")
private List<Param> params;
public String getProcessorData() { public String getProcessorData() {
@@ -29,4 +33,9 @@ public class XMLMultipleFilesBody {
public XMLMultipleFilesData[] getData() { public XMLMultipleFilesData[] getData() {
return data; return data;
} }
public List<Param> getParams() {
return params;
}
} }

View File

@@ -2,6 +2,8 @@ package com.r11.tools.model;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.util.List;
/** /**
* POJO class used to contain body of XML related requests * POJO class used to contain body of XML related requests
* @author Adam Bem * @author Adam Bem
@@ -15,20 +17,22 @@ public class XMLRequestBody {
private String processor; private String processor;
@SerializedName("version") @SerializedName("version")
private String version; private String version;
@SerializedName("params")
private List<Param> params;
public String getData() { public String getData() {
return data; return data;
} }
public String getProcessorData() {return processorData;}
public String getProcessorData() {
return processorData;
}
public String getProcessor() { public String getProcessor() {
return processor; return processor;
} }
public String getVersion() { public String getVersion() {
return version; return version;
} }
public List<Param> getParams() {
return params;
}
} }

View File

@@ -10,6 +10,10 @@ public class XMLResponseBody {
// Optional // Optional
private String type; private String type;
public XMLResponseBody(String status){
this.status = status;
}
public XMLResponseBody(String result, String status, String processor) { public XMLResponseBody(String result, String status, String processor) {
this.result = result; this.result = result;
this.status = status; this.status = status;

View File

@@ -0,0 +1,64 @@
package com.r11.tools.model;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class XmlTools {
private final Map<String, String> createdParameters = new HashMap<>();
private void createNewNode(String paramName, String paramValue, Document doc) {
String parameter = "xsl:param";
Element param = doc.createElement(parameter);
String nameAttribute = "name";
param.setAttribute(nameAttribute, paramName);
String valueAttribute = "select";
param.setAttribute(valueAttribute, "'" + paramValue + "'");
doc.getDocumentElement().appendChild(param);
}
public String addParams(List<Param> params,String processorData) {
params.forEach(param ->
createdParameters.put(param.getKey(), param.getValue())
);
try {
return docToString(addNode(processorData));
} catch (ParserConfigurationException | SAXException | IOException | TransformerException e) {
throw new RuntimeException(e);
}finally {
createdParameters.clear();
}
}
private Document addNode(String processorData) throws ParserConfigurationException, SAXException, IOException {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
InputStream stream = new ByteArrayInputStream(processorData.getBytes(StandardCharsets.UTF_8));
Document doc = builder.parse(stream);
createdParameters.forEach((paramName, paramValue) -> createNewNode(paramName, paramValue, doc));
return doc;
}
private String docToString(Document doc) throws TransformerException {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(doc);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
StreamResult result = new StreamResult(outputStream);
transformer.transform(source, result);
return outputStream.toString();
}
}

View File

@@ -1,7 +1,10 @@
package com.r11.tools.xml; package com.r11.tools.xml;
import com.r11.tools.model.Param;
import com.r11.tools.model.XMLMultipleFilesData; import com.r11.tools.model.XMLMultipleFilesData;
import com.r11.tools.model.XMLRequestBody;
import com.r11.tools.model.XPathQueryResult; import com.r11.tools.model.XPathQueryResult;
import com.r11.tools.model.XmlTools;
import net.sf.saxon.s9api.*; import net.sf.saxon.s9api.*;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
@@ -10,6 +13,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Comparator; import java.util.Comparator;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@@ -26,10 +30,13 @@ public class Saxon implements XmlEngine{
* @throws SaxonApiException thrown on stylesheet or transformation error * @throws SaxonApiException thrown on stylesheet or transformation error
* @throws IOException thrown when file does not exist, or cannot be read. * @throws IOException thrown when file does not exist, or cannot be read.
*/ */
public String processXSLT(XMLMultipleFilesData[] data, String transform) throws SaxonApiException, IOException{ XmlTools tools = new XmlTools();
public String processXSLT(List<Param> params, XMLMultipleFilesData[] data, String transform) throws SaxonApiException, IOException{
Processor processor = new Processor(false); Processor processor = new Processor(false);
XsltCompiler compiler = processor.newXsltCompiler(); XsltCompiler compiler = processor.newXsltCompiler();
transform = tools.addParams(params,transform);
String filesPath = "/tmp/"+UUID.randomUUID()+"/"; String filesPath = "/tmp/"+UUID.randomUUID()+"/";
try{ try{
createXMLFilesFromData(data, filesPath); createXMLFilesFromData(data, filesPath);
@@ -78,14 +85,18 @@ public class Saxon implements XmlEngine{
/** /**
* Transforms string containing xml document via xslt * Transforms string containing xml document via xslt
* @param data xml to be transformed *
* @param params
* @param data xml to be transformed
* @param transform xslt * @param transform xslt
* @return transformed xml * @return transformed xml
* @throws SaxonApiException thrown on stylesheet or transformation errors * @throws SaxonApiException thrown on stylesheet or transformation errors
*/ */
public String processXSLT(String data, String transform) throws SaxonApiException { public String processXSLT(List<Param> params, String data, String transform) throws SaxonApiException {
Processor processor = new Processor(false); Processor processor = new Processor(false);
XsltCompiler compiler = processor.newXsltCompiler(); XsltCompiler compiler = processor.newXsltCompiler();
transform = tools.addParams(params,transform);
System.out.println(transform);
XsltExecutable stylesheet = compiler.compile(new StreamSource(new StringReader(transform))); XsltExecutable stylesheet = compiler.compile(new StreamSource(new StringReader(transform)));
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
Serializer out = processor.newSerializer(sw); Serializer out = processor.newSerializer(sw);

View File

@@ -1,7 +1,10 @@
package com.r11.tools.xml; package com.r11.tools.xml;
import com.r11.tools.model.Param;
import com.r11.tools.model.XMLMultipleFilesData; import com.r11.tools.model.XMLMultipleFilesData;
import com.r11.tools.model.XMLRequestBody;
import com.r11.tools.model.XPathQueryResult; import com.r11.tools.model.XPathQueryResult;
import com.r11.tools.model.XmlTools;
import org.apache.xpath.XPathAPI; import org.apache.xpath.XPathAPI;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@@ -22,6 +25,7 @@ import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.List;
/** /**
* Handler for Xalan engine * Handler for Xalan engine
@@ -31,16 +35,20 @@ public class Xalan implements XmlEngine{
/** /**
* Transforms string containing xml document via xslt * Transforms string containing xml document via xslt
* @param data xml to be transformed *
* @param params
* @param data xml to be transformed
* @param transform xslt * @param transform xslt
* @return transformed xml * @return transformed xml
* @throws Exception thrown on stylesheet or transformation errors * @throws Exception thrown on stylesheet or transformation errors
*/ */
public String processXSLT(String data, String transform) throws Exception { public String processXSLT(List<Param> params, String data, String transform) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder(); DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(data))); Document document = builder.parse(new InputSource(new StringReader(data)));
XmlTools tools = new XmlTools();
transform = tools.addParams(params,transform);
StreamSource stylesource = new StreamSource(new StringReader(transform)); StreamSource stylesource = new StreamSource(new StringReader(transform));
Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesource); Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesource);
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
@@ -61,15 +69,8 @@ public class Xalan implements XmlEngine{
return nodeType == Node.CDATA_SECTION_NODE || nodeType == Node.TEXT_NODE; return nodeType == Node.CDATA_SECTION_NODE || nodeType == Node.TEXT_NODE;
} }
private boolean isAttributeNode(Node n) {
if (n == null)
return false;
short nodeType = n.getNodeType();
return nodeType == Node.CDATA_SECTION_NODE || nodeType == Node.ATTRIBUTE_NODE;
}
@Override @Override
public String processXSLT(XMLMultipleFilesData[] data, String transform) throws Exception { public String processXSLT(List<Param> params, XMLMultipleFilesData[] data, String transform) throws Exception {
throw new UnsupportedOperationException("Xalan does not support multiple files XSLT processing"); throw new UnsupportedOperationException("Xalan does not support multiple files XSLT processing");
} }
@@ -108,10 +109,7 @@ public class Xalan implements XmlEngine{
for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) { for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) {
resultString.append(nn.getNodeValue()); resultString.append(nn.getNodeValue());
} }
} else if (isAttributeNode(n)) { } else {
resultString.append(n.getNodeValue());
}
else {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream))); serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream)));
resultString.append(outputStream); resultString.append(outputStream);

View File

@@ -1,17 +1,17 @@
package com.r11.tools.xml; package com.r11.tools.xml;
import com.r11.tools.model.Param;
import com.r11.tools.model.XMLMultipleFilesData; import com.r11.tools.model.XMLMultipleFilesData;
import com.r11.tools.model.XPathQueryResult; import com.r11.tools.model.XPathQueryResult;
import java.util.List;
public interface XmlEngine { public interface XmlEngine {
String processXSLT(XMLMultipleFilesData[] data, String transform) throws Exception; String processXSLT(List<Param> params, XMLMultipleFilesData[] data, String transform) throws Exception;
XPathQueryResult processXPath(String data, String query, String version) throws Exception; XPathQueryResult processXPath(String data, String query, String version) throws Exception;
String processXSLT(String data, String transform) throws Exception; String processXSLT(List<Param> params, String data, String transform) throws Exception;
String validate(String data, String xsd) throws Exception; String validate(String data, String xsd) throws Exception;
String executeXQuery(String data, String xquery, String version) throws Exception; String executeXQuery(String data, String xquery, String version) throws Exception;
public String getVersion(); public String getVersion();
} }

View File

@@ -28,12 +28,8 @@
"description":"Specifies a numeric priority for this template." "description":"Specifies a numeric priority for this template."
} }
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/template",
"xslt": " <xsl:template match=\"/u:root\">\n <html>\n <body>\n <h1>User Greetings</h1>\n <xsl:for-each select=\"u:UserList/u:User\">\n <p>Hello, <xsl:value-of select=\"u:Name\"/>!</p>\n </xsl:for-each>\n </body>\n </html>\n </xsl:template>"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-template",
"output": "XML Tree" "output": "XML Tree"
},{ },{
"name": "<xsl:apply-templates>", "name": "<xsl:apply-templates>",
@@ -51,12 +47,8 @@
"description":"XPath expression that specifies the nodes to be processed. If this attribute is not set, all child nodes of the current node are selected." "description":"XPath expression that specifies the nodes to be processed. If this attribute is not set, all child nodes of the current node are selected."
} }
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/apply-templates",
"xslt": " <xsl:template match=\"/u:root\">\n <html>\n <body>\n <h1>User List</h1>\n <xsl:apply-templates select=\"u:UserList\"/>\n </body>\n </html>\n </xsl:template>"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-apply-templates",
"output": "XML Nodes" "output": "XML Nodes"
},{ },{
"name": "<xsl:apply-imports/>", "name": "<xsl:apply-imports/>",
@@ -64,12 +56,8 @@
"attributes": "attributes":
[ [
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/apply-imports",
"xslt": "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:u=\"http://www.release11.com/schemas/Sample.xsd\">\n <xsl:import href=\"imported.xsl\"/>\n\n <xsl:template match=\"/u:root\">\n <html>\n <body>\n <h1>User Greetings</h1>\n <xsl:apply-imports/>\n </body>\n </html>\n </xsl:template>"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-apply-imports",
"output": "Imported output from another XSLT" "output": "Imported output from another XSLT"
},{ },{
"name": "<xsl:call-template>", "name": "<xsl:call-template>",
@@ -82,12 +70,8 @@
"description":"Specifies the name of the template you wish to invoke." "description":"Specifies the name of the template you wish to invoke."
} }
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/call-template",
"xslt": " <xsl:template name=\"bookDetails\">\n <xsl:param name=\"title\"/>\n <xsl:param name=\"author\"/>\n <p><strong><xsl:value-of select=\"$title\"/> by <xsl:value-of select=\"$author\"/></strong></p>\n </xsl:template>\n\n <xsl:template match=\"/bookstore\">\n <html>\n <body>\n <h2>Bookstore</h2>\n <xsl:for-each select=\"book\">\n <xsl:call-template name=\"bookDetails\">\n <xsl:with-param name=\"title\" select=\"title\"/>\n <xsl:with-param name=\"author\" select=\"author\"/>\n </xsl:call-template>\n </xsl:for-each>\n </body>\n </html>\n </xsl:template> "
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-call-template",
"output": "Called template XML" "output": "Called template XML"
},{ },{
"name": "<xsl:next-match>", "name": "<xsl:next-match>",
@@ -96,12 +80,8 @@
[ [
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/next-match.html",
"xslt": " <xsl:template match=\"book\">\n <p>\n <strong>\n <xsl:value-of select=\"title\"/>\n <xsl:text> by </xsl:text>\n <xsl:value-of select=\"author\"/>\n </strong>\n </p>\n <xsl:next-match />\n </xsl:template>"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-next-match",
"output": "Choosed XML template" "output": "Choosed XML template"
},{ },{
"name": "<xsl:mode>", "name": "<xsl:mode>",
@@ -164,12 +144,8 @@
"description":"Causes tracing of all template rules executed in the mode, showing the nodes selected by xsl:apply-templates and the rules used to process them." "description":"Causes tracing of all template rules executed in the mode, showing the nodes selected by xsl:apply-templates and the rules used to process them."
} }
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/mode.html",
"xslt": " <xsl:template match=\"/root/item\" mode=\"default\">\n <xsl:value-of select=\"name\"/> - <xsl:value-of select=\"description\"/>\n <xsl:value-of select=\"concat(' (ID: ', @id, ')')\"/>\n <xsl:value-of select=\"' (default mode)'\"/>\n <xsl:value-of select=\"'&#10;'\"/>\n </xsl:template>\n\n <xsl:template match=\"/root/item\" mode=\"custom\">\n <xsl:value-of select=\"name\"/> - <xsl:value-of select=\"description\"/>\n <xsl:value-of select=\"concat(' (ID: ', @id, ')')\"/>\n <xsl:value-of select=\"' (custom mode)'\"/>\n <xsl:value-of select=\"'&#10;'\"/>\n </xsl:template>\n\n <xsl:template match=\"/\">\n <xsl:apply-templates select=\"/root/item\" mode=\"default\"/>\n <xsl:apply-templates select=\"/root/item\" mode=\"custom\"/>\n </xsl:template>"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-mode",
"output": "Choosed XML template" "output": "Choosed XML template"
},{ },{
"name": "<xsl:override>", "name": "<xsl:override>",
@@ -178,12 +154,8 @@
[ [
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/override.html",
"xslt": "<xsl:stylesheet version=\"3.0\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n xmlns:u=\"http://www.release11.com/schemas/Sample.xsd\"\n xmlns:my=\"http://example.com/functions\">\n\n <xsl:output method=\"xml\" indent=\"yes\"/>\n <xsl:import href=\"base.xsl\"/>\n\n <xsl:override>\n <xsl:function name=\"my:format-date\">\n <xsl:param name=\"date\"/>\n <xsl:value-of select=\"concat('Passed away on ', $date)\"/>\n </xsl:function>\n\n <xsl:template match=\"u:User\">\n <Person>\n <Name><xsl:value-of select=\"u:Name\"/></Name>\n <Surname><xsl:value-of select=\"u:Surname\"/></Surname>\n <DeathInfo><xsl:value-of select=\"my:format-date(u:DateOfDeath)\"/></DeathInfo>\n </Person>\n </xsl:template>\n </xsl:override>\n\n</xsl:stylesheet>\n"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-override",
"output": "Appears as a child of xsl:use-package." "output": "Appears as a child of xsl:use-package."
},{ },{
"name": "<xsl:package>", "name": "<xsl:package>",
@@ -261,12 +233,8 @@
"description":"Determines the namespace used for any unprefixed element name or type name within an XPath expression." "description":"Determines the namespace used for any unprefixed element name or type name within an XPath expression."
} }
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/package.html",
"xslt": "<xsl:package name=\"user.processing\"\n version=\"3.0\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n xmlns:u=\"http://www.release11.com/schemas/Sample.xsd\"\n xmlns:my=\"http://example.com/functions\"\n package-version=\"1.0\">\n\n <xsl:output method=\"xml\" indent=\"yes\"/>\n\n <xsl:function name=\"my:format-date\" visibility=\"public\">\n <xsl:param name=\"date\"/>\n <xsl:value-of select=\"concat('Died on ', $date)\"/>\n </xsl:function>\n\n <xsl:template match=\"u:User\" visibility=\"public\">\n <Person>\n <Name><xsl:value-of select=\"u:Name\"/></Name>\n <Surname><xsl:value-of select=\"u:Surname\"/></Surname>\n <DeathInfo><xsl:value-of select=\"my:format-date(u:DateOfDeath)\"/></DeathInfo>\n </Person>\n </xsl:template>\n\n</xsl:package>"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-package",
"output": "Appears as a child of xsl:use-package." "output": "Appears as a child of xsl:use-package."
},{ },{
"name": "<xsl:accept>", "name": "<xsl:accept>",
@@ -289,12 +257,8 @@
"description":"Determines the potential visibility of the selected components." "description":"Determines the potential visibility of the selected components."
} }
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accept.html",
"xslt": "<xsl:package name=\"user.extension\"\n version=\"3.0\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n package-version=\"1.0\">\n \n <!-- This accepts only the function, but not the template from user-package.xsl -->\n <xsl:use-package name=\"user.processing\">\n <xsl:accept component=\"function\" names=\"my:format-date\"/>\n </xsl:use-package>\n\n \n <xsl:template match=\"u:User\">\n <Person>\n <Name><xsl:value-of select=\"u:Name\"/></Name>\n <Surname><xsl:value-of select=\"u:Surname\"/></Surname>\n <DeathInfo><xsl:value-of select=\"my:format-date(u:DateOfDeath)\"/></DeathInfo>\n </Person>\n </xsl:template>\n\n</xsl:package>"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accept",
"output": "Appears as a child of xsl:use-package." "output": "Appears as a child of xsl:use-package."
},{ },{
"name": "<xsl:global-context-item>", "name": "<xsl:global-context-item>",
@@ -312,12 +276,8 @@
"description":"Specifies whether a stylesheet module requires a global context item; the default is optional." "description":"Specifies whether a stylesheet module requires a global context item; the default is optional."
} }
], ],
"xsltExamples": [ "examples": [],
{ "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/global-context-item.html",
"xslt": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet version=\"3.0\"\n xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n\n <xsl:global-context-item as=\"document-node()?\" use=\"optional\"/>\n\n <xsl:template match=\"/\">\n <html>\n <body>\n <h2>User List</h2>\n <ul>\n <xsl:apply-templates select=\"users/user\"/>\n </ul>\n </body>\n </html>\n </xsl:template>\n\n <xsl:template match=\"user\">\n <li>\n <xsl:value-of select=\"name\"/>\n </li>\n </xsl:template>\n</xsl:stylesheet>"
}
],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-global-context-item",
"output": "Global context item" "output": "Global context item"
} }
] ]
@@ -337,8 +297,8 @@
"description":"XPath expression that specifies the nodes to be processed." "description":"XPath expression that specifies the nodes to be processed."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-for-each", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/for-each",
"output": "Processed set of nodes" "output": "Processed set of nodes"
}, },
{ {
@@ -352,8 +312,8 @@
"description":"Contains an XPath expression that can be evaluated to a Boolean value." "description":"Contains an XPath expression that can be evaluated to a Boolean value."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-if", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/if",
"output": "Depending on test processed template or not." "output": "Depending on test processed template or not."
}, },
{ {
@@ -363,8 +323,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-choose", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/choose",
"output": "Choosed XML template" "output": "Choosed XML template"
}, },
{ {
@@ -378,8 +338,8 @@
"description":"Boolean expression to be evaluated. If true, the contents of the element are processed; if false, they are ignored." "description":"Boolean expression to be evaluated. If true, the contents of the element are processed; if false, they are ignored."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-when", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/when",
"output": "Processed or not XML Template" "output": "Processed or not XML Template"
}, },
{ {
@@ -389,8 +349,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-otherwise", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/otherwise",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -439,8 +399,8 @@
"description":"The name of a collating sequence, used when comparing grouping keys. Can be used when grouping using either group-by or group-adjacent." "description":"The name of a collating sequence, used when comparing grouping keys. Can be used when grouping using either group-by or group-adjacent."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-for-each-group", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/for-each-group.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -454,8 +414,8 @@
"description":"Expression to select nodes/values." "description":"Expression to select nodes/values."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-iterate", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/iterate.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -469,8 +429,8 @@
"description":"The effect of the instruction may be defined either by a select attribute, or by an enclosed sequence constructor. " "description":"The effect of the instruction may be defined either by a select attribute, or by an enclosed sequence constructor. "
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-break", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/break.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -480,8 +440,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-next-iteration", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/next-iteration.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -495,8 +455,8 @@
"description":"The effect of the instruction may be defined either by an expression within the optional select attribute, or by the enclosed sequence constructor." "description":"The effect of the instruction may be defined either by an expression within the optional select attribute, or by the enclosed sequence constructor."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-completion", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-completion.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -506,8 +466,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-fork", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/fork.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -521,8 +481,8 @@
"description":"The value to be output when the containing sequence constructor would otherwise deliver an empty result." "description":"The value to be output when the containing sequence constructor would otherwise deliver an empty result."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-empty", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-empty.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -536,8 +496,8 @@
"description":"The value to be output when the containing sequence constructor delivers a non-empty result." "description":"The value to be output when the containing sequence constructor delivers a non-empty result."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-non-empty", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-non-empty.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -556,8 +516,8 @@
"description":"The value no is used to relax the requirement to recover result trees when failures occur in the course of evaluating the xsl:try instruction." "description":"The value no is used to relax the requirement to recover result trees when failures occur in the course of evaluating the xsl:try instruction."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-try", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/try.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -576,8 +536,8 @@
"description":"The value no is used to relax the requirement to recover result trees when failures occur in the course of evaluating the xsl:try instruction." "description":"The value no is used to relax the requirement to recover result trees when failures occur in the course of evaluating the xsl:try instruction."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-try", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/try.html",
"output": "processed XML Template" "output": "processed XML Template"
}, },
{ {
@@ -596,8 +556,8 @@
"description":"Specifies whether a template requires a context item; the default is optional." "description":"Specifies whether a template requires a context item; the default is optional."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-context-item", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/context-item.html",
"output": "processed XML Template" "output": "processed XML Template"
} }
] ]
@@ -622,8 +582,8 @@
"description":"Defines the namespace URI for this attribute in the output document." "description":"Defines the namespace URI for this attribute in the output document."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-attribute", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/attribute",
"output": "XML Element with provided attribute" "output": "XML Element with provided attribute"
},{ },{
"name": "<xsl:attribute-set>", "name": "<xsl:attribute-set>",
@@ -641,8 +601,8 @@
"description":"Builds an attribute set from other attribute sets. The names of the contributing sets must be separated with whitespace characters" "description":"Builds an attribute set from other attribute sets. The names of the contributing sets must be separated with whitespace characters"
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-attribute-set", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/attribute-set",
"output": "Named set of attributes" "output": "Named set of attributes"
},{ },{
"name": "<xsl:copy>", "name": "<xsl:copy>",
@@ -655,8 +615,8 @@
"description":"Lists attribute sets that should be applied to the output node, if it is an element" "description":"Lists attribute sets that should be applied to the output node, if it is an element"
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-copy", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/copy",
"output": "Copy of XML node" "output": "Copy of XML node"
},{ },{
"name": "<xsl:number>", "name": "<xsl:number>",
@@ -709,8 +669,8 @@
"description":"Indicates the number of digits that make up a numeric group." "description":"Indicates the number of digits that make up a numeric group."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-number", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/number",
"output": "Formatted number" "output": "Formatted number"
},{ },{
"name": "<xsl:value-of>", "name": "<xsl:value-of>",
@@ -728,8 +688,8 @@
"description":"Specifies whether special characters are escaped when written to the output." "description":"Specifies whether special characters are escaped when written to the output."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-value-of", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/value-of",
"output": "Value from XML nodes" "output": "Value from XML nodes"
},{ },{
"name": "<xsl:text>", "name": "<xsl:text>",
@@ -742,8 +702,8 @@
"description":"Specifies whether special characters are escaped when written to the output." "description":"Specifies whether special characters are escaped when written to the output."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-text", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/text",
"output": "XML Node with writed text" "output": "XML Node with writed text"
},{ },{
"name": "<xsl:comment>", "name": "<xsl:comment>",
@@ -751,8 +711,8 @@
"attributes": "attributes":
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-comment", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/comment",
"output": "XML Node with writed comment" "output": "XML Node with writed comment"
}, },
{ {
@@ -766,8 +726,8 @@
"description":"Specifies the name of this processing instruction." "description":"Specifies the name of this processing instruction."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-processing-instruction", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/processing-instruction",
"output": "XML Node with output of processed instruction" "output": "XML Node with output of processed instruction"
}, },
{ {
@@ -791,8 +751,8 @@
"description":"Specifies an XPath expression that will be used to determine the value of the key for each of the applicable nodes." "description":"Specifies an XPath expression that will be used to determine the value of the key for each of the applicable nodes."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-key", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/key",
"output": "key to use in stylesheet" "output": "key to use in stylesheet"
}, },
{ {
@@ -856,8 +816,8 @@
"description":"Specifies the character separating positive and negative subpatterns in a format pattern." "description":"Specifies the character separating positive and negative subpatterns in a format pattern."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-decimal-format", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/decimal-format",
"output": "decimal format" "output": "decimal format"
}, },
{ {
@@ -871,8 +831,8 @@
"description":"Specifies the elements for which whitespace should be preserved." "description":"Specifies the elements for which whitespace should be preserved."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-preserve-space", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/preserve-space",
"output": "preserved space" "output": "preserved space"
}, },
{ {
@@ -886,8 +846,8 @@
"description":"Specifies the elements for which whitespace should be preserved." "description":"Specifies the elements for which whitespace should be preserved."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-strip-space", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/strip-space",
"output": "elements with removed whitespace" "output": "elements with removed whitespace"
}, },
{ {
@@ -921,8 +881,8 @@
"description":"Defines whether items are to be ordered alphabetically or numerically." "description":"Defines whether items are to be ordered alphabetically or numerically."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-sort", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/sort",
"output": "sorted elements" "output": "sorted elements"
}, },
{ {
@@ -966,8 +926,8 @@
"description":"Lists elements whose text contents should be written as CDATA sections." "description":"Lists elements whose text contents should be written as CDATA sections."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-output", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/output",
"output": "changed document prefix" "output": "changed document prefix"
}, },
{ {
@@ -1126,8 +1086,8 @@
"description":"The default for Saxon-EE is yes, which causes the instruction to be evaluated in a separate thread" "description":"The default for Saxon-EE is yes, which causes the instruction to be evaluated in a separate thread"
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-result-document", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/result-document.html",
"output": "XML Document" "output": "XML Document"
},{ },{
"name": "<xsl:character-map>", "name": "<xsl:character-map>",
@@ -1145,8 +1105,8 @@
"description":"Character maps may be assembled from other character maps using the use-character-maps attribute." "description":"Character maps may be assembled from other character maps using the use-character-maps attribute."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-character-map", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/character-map.html",
"output": "named character map" "output": "named character map"
},{ },{
"name": "<xsl:output-character>", "name": "<xsl:output-character>",
@@ -1164,8 +1124,8 @@
"description":"Any string, that replaces the specified character during serialization." "description":"Any string, that replaces the specified character during serialization."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-output-character", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/output-character.html",
"output": "defined character" "output": "defined character"
},{ },{
"name": "<xsl:merge>", "name": "<xsl:merge>",
@@ -1174,8 +1134,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge.html",
"output": "merged files" "output": "merged files"
},{ },{
"name": "<xsl:merge-action>", "name": "<xsl:merge-action>",
@@ -1184,8 +1144,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-action", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-action.html",
"output": "merged files" "output": "merged files"
},{ },{
"name": "<xsl:merge-key>", "name": "<xsl:merge-key>",
@@ -1218,8 +1178,8 @@
"description":"It declares whether uppercase letters are sorted before their lowercase equivalents, or vice-versa" "description":"It declares whether uppercase letters are sorted before their lowercase equivalents, or vice-versa"
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-key", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-key.html",
"output": "merged files" "output": "merged files"
},{ },{
"name": "<xsl:merge-source>", "name": "<xsl:merge-source>",
@@ -1272,8 +1232,8 @@
"description":"If specified, data read from this merge source is validated against the named schema type." "description":"If specified, data read from this merge source is validated against the named schema type."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-source", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-source.html",
"output": "merged files" "output": "merged files"
} }
] ]
@@ -1343,8 +1303,8 @@
"description":"Specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an XPath expression." "description":"Specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an XPath expression."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-stylesheet", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/stylesheet",
"output": "XSLT Stylesheet" "output": "XSLT Stylesheet"
}, },
{ {
@@ -1408,8 +1368,8 @@
"description":"Specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an XPath expression." "description":"Specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an XPath expression."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-transform", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/transform",
"output": "XSLT Stylesheet" "output": "XSLT Stylesheet"
}, },
{ {
@@ -1423,8 +1383,8 @@
"description":"Specifies the URI of the stylesheet to import." "description":"Specifies the URI of the stylesheet to import."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-import", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/import",
"output": "XSLT Stylesheet from another file" "output": "XSLT Stylesheet from another file"
}, },
{ {
@@ -1438,8 +1398,8 @@
"description":"Specifies the URI of the stylesheet to import." "description":"Specifies the URI of the stylesheet to import."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-include", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/include",
"output": "XSLT Stylesheet with XSLT from another file." "output": "XSLT Stylesheet with XSLT from another file."
}, },
{ {
@@ -1458,8 +1418,8 @@
"description":"Specifies the desired namespace for the output tree." "description":"Specifies the desired namespace for the output tree."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/namespace-alias",
"output": "XML Tree with changed namespaces" "output": "XML Tree with changed namespaces"
}, },
{ {
@@ -1483,8 +1443,8 @@
"description":"A whitespace-separated list of attribute-set element names to be applied to the element element's output element." "description":"A whitespace-separated list of attribute-set element names to be applied to the element element's output element."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/namespace-alias",
"output": "XML with provided element" "output": "XML with provided element"
} }
] ]
@@ -1509,8 +1469,8 @@
"description":"Uses an XPath expression to provide a default value if none is specified." "description":"Uses an XPath expression to provide a default value if none is specified."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-param", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/param",
"output": "XML parameter" "output": "XML parameter"
}, },
{ {
@@ -1529,8 +1489,8 @@
"description":"Defines the value of the variable through an XPath expression. If the element contains a template, this attribute is ignored." "description":"Defines the value of the variable through an XPath expression. If the element contains a template, this attribute is ignored."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-variable", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/variable",
"output": "XML Variable" "output": "XML Variable"
}, },
{ {
@@ -1549,8 +1509,8 @@
"description":"Defines the value of the parameter through an XPath expression. If the element contains a template, this attribute is ignored." "description":"Defines the value of the parameter through an XPath expression. If the element contains a template, this attribute is ignored."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-with-param", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/with-param",
"output": "XML Parameter" "output": "XML Parameter"
}, },
{ {
@@ -1564,8 +1524,8 @@
"description":"Uses an XPath expression that specifies what is to be copied." "description":"Uses an XPath expression that specifies what is to be copied."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-copy-of", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/copy-of",
"output": "Copy of Selected node" "output": "Copy of Selected node"
}, },
{ {
@@ -1584,8 +1544,8 @@
"description":"Determines what happens to any type annotations on element or attribute nodes" "description":"Determines what happens to any type annotations on element or attribute nodes"
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-document", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/document.html",
"output": "Document Node" "output": "Document Node"
}, },
{ {
@@ -1604,8 +1564,8 @@
"description":"The string value of the namespace node" "description":"The string value of the namespace node"
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/namespace.html",
"output": "Namespace Node" "output": "Namespace Node"
}, },
{ {
@@ -1624,8 +1584,8 @@
"description":"The namespace prefix used in the result document." "description":"The namespace prefix used in the result document."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/namespace-alias.html",
"output": "Document with changed namespaces" "output": "Document with changed namespaces"
}, },
{ {
@@ -1639,8 +1599,8 @@
"description":"Specifies the input." "description":"Specifies the input."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-sequence", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/sequence.html",
"output": "Sequence" "output": "Sequence"
} }
] ]
@@ -1670,8 +1630,8 @@
"description":"One or more Perl-like flags to control the way in which regular expression matching is performed, for example the value m indicates multi-line mode." "description":"One or more Perl-like flags to control the way in which regular expression matching is performed, for example the value m indicates multi-line mode."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-analyze-string", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/analyze-string.html",
"output": "XML Node" "output": "XML Node"
}, },
{ {
@@ -1681,8 +1641,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-matching-substring", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/matching-substring.html",
"output": "XML Node" "output": "XML Node"
}, },
{ {
@@ -1692,8 +1652,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-non-matching-substring", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/non-matching-substring.html",
"output": "XML Node" "output": "XML Node"
} }
] ]
@@ -1753,8 +1713,8 @@
"description":"Specifying yes indicates that Saxon should remember the results of calling the function in a cache, and if the function is called again with the same arguments, the result is retrieved from the cache rather than being recalculated." "description":"Specifying yes indicates that Saxon should remember the results of calling the function in a cache, and if the function is called again with the same arguments, the result is retrieved from the cache rather than being recalculated."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-function", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/function.html",
"output": "Function" "output": "Function"
}, },
{ {
@@ -1803,8 +1763,8 @@
"description":"The value of the attribute is an expression that evaluates to a map." "description":"The value of the attribute is an expression that evaluates to a map."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-evaluate", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/evaluate.html",
"output": "String" "output": "String"
}, },
{ {
@@ -1828,8 +1788,8 @@
"description":"Specifies the error code associated with the error message produced when the assertion is false." "description":"Specifies the error code associated with the error message produced when the assertion is false."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-assert", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/assert.html",
"output": "Error or nothing" "output": "Error or nothing"
} }
] ]
@@ -1849,8 +1809,8 @@
"description":"Set to \"yes\", indicates that execution should be terminated. The default value is \"no\", in which case the message is output and execution continues." "description":"Set to \"yes\", indicates that execution should be terminated. The default value is \"no\", in which case the message is output and execution continues."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-message", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/message",
"output": "Message in console" "output": "Message in console"
}, },
{ {
@@ -1859,8 +1819,8 @@
"attributes": "attributes":
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-fallback", "documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/fallback",
"output": "Fallbacks" "output": "Fallbacks"
}, },
{ {
@@ -1874,8 +1834,8 @@
"description":" If the attribute is present, then when a duplicate key value is encountered, the function is called supplying the old and new values for the key, and the old value for the key is replaced with the result of the function call." "description":" If the attribute is present, then when a duplicate key value is encountered, the function is called supplying the old and new values for the key, and the old value for the key is replaced with the result of the function call."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-map", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/map.html",
"output": "Map" "output": "Map"
}, },
{ {
@@ -1894,8 +1854,8 @@
"description":"The associated value can be defined either by a select attribute or by an enclosed sequence constructor." "description":"The associated value can be defined either by a select attribute or by an enclosed sequence constructor."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-map-entry", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/map-entry.html",
"output": "Singleton Map" "output": "Singleton Map"
}, },
{ {
@@ -1919,8 +1879,8 @@
"description":"Determines the external visibility of the selected components." "description":"Determines the external visibility of the selected components."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-expose", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/expose.html",
"output": "Element with changed visibility" "output": "Element with changed visibility"
}, },
{ {
@@ -1954,8 +1914,8 @@
"description":"Causes a trace message to be output (to the Configuration's Logger) whenever the value of the accumulator changes." "description":"Causes a trace message to be output (to the Configuration's Logger) whenever the value of the accumulator changes."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accumulator", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accumulator.html",
"output": "Accumulator" "output": "Accumulator"
}, },
{ {
@@ -1984,8 +1944,8 @@
"description":"The value \"yes|true|1\" on a phase=\"end\" rule for a streaming accumulator removes the requirement for the select attribute (or sequence constructor) to be motionless." "description":"The value \"yes|true|1\" on a phase=\"end\" rule for a streaming accumulator removes the requirement for the select attribute (or sequence constructor) to be motionless."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accumulator-rule", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accumulator-rule.html",
"output": "Accumulator" "output": "Accumulator"
}, },
{ {
@@ -2039,8 +1999,8 @@
"description":"Controls whether XInclude processing takes place." "description":"Controls whether XInclude processing takes place."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-source-document", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/source-document.html",
"output": "Processed Document" "output": "Processed Document"
}, },
{ {
@@ -2059,8 +2019,8 @@
"description":"The version of the named package to be used. The default is *, which matches any version. " "description":"The version of the named package to be used. The default is *, which matches any version. "
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-use-package", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/use-package.html",
"output": "Package" "output": "Package"
}, },
{ {
@@ -2070,8 +2030,8 @@
[ [
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-where-populated", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/where-populated.html",
"output": "checks for children" "output": "checks for children"
}, },
{ {
@@ -2095,8 +2055,8 @@
"description":"Determines the potential visibility of the selected components." "description":"Determines the potential visibility of the selected components."
} }
], ],
"xsltExamples": [], "examples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accept", "documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accept.html",
"output": "restricts visibility" "output": "restricts visibility"
} }
] ]

View File

@@ -0,0 +1,72 @@
<script setup lang="ts">
import {ref} from 'vue'
const emit = defineEmits<{
(event: 'update-value', options: { name: string }[]): void;
}>();
const options = ref<{ name: string }[]>([
{ name: "Add Param" }
]);
const sendToParent = () => {
options.value.forEach((value) => {console.log("KID" + value + options.value.indexOf(value))})
emit('update-value', options.value);
};
const nameInput = ref('')
const valueInput = ref('')
const selectedOption = ref(options.value[0].name)
const isNumeric = (string : string) => /^[+-]?\d+(\.\d+)?$/.test(string)
const selectedFunction = () => {
const action = selectOption(selectedOption.value);
const name = nameInput.value.trim();
const value = valueInput.value.trim();
if (action === "Add Param" && name && value && !isNumeric(name)) {
options.value.push({ name: `${name} = ${value}` });
nameInput.value = valueInput.value = "";
}
if (action === "Remove Param") {
options.value = options.value.filter(option => option.name !== selectedOption.value);
selectedOption.value = options.value.length ? options.value[0].name : "";
nameInput.value = valueInput.value = "";
}
sendToParent();
};
function selectOption(option: string): string {
return option == "Add Param" ? "Add Param" : "Remove Param"
}
</script>
<template>
<input
v-if="selectedOption==='Add Param'"
id="NameTextInput"
v-model="nameInput"
class="text-input h-full px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600 w-48"
type="text"
placeholder="Name"
/>
<input
v-if="selectedOption==='Add Param'"
id="ValueTextInput"
v-model="valueInput"
class="text-input h-full px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600 w-48"
type="text"
placeholder="Value"
/>
<select
v-model="selectedOption"
class="flex h-full px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600 w-48"
>
<option v-for="option in options" :value="option.name" :key="option.name">
{{ option.name }}
</option>
</select>
<button class="tool-button w-24" @click="selectedFunction">{{ selectOption(selectedOption) }}</button>
</template>

View File

@@ -2,8 +2,7 @@
import { onBeforeUpdate, inject } from 'vue' import { onBeforeUpdate, inject } from 'vue'
import { Codemirror } from 'vue-codemirror' import { Codemirror } from 'vue-codemirror'
import { oneDark } from '@codemirror/theme-one-dark' import { oneDark } from '@codemirror/theme-one-dark'
import { createTheme} from 'thememirror'; import { espresso } from 'thememirror';
import {tags as t} from '@lezer/highlight';
import {xml} from '@codemirror/lang-xml' import {xml} from '@codemirror/lang-xml'
import {json} from '@codemirror/lang-json' import {json} from '@codemirror/lang-json'
import {html} from '@codemirror/lang-html' import {html} from '@codemirror/lang-html'
@@ -19,47 +18,6 @@ const props= defineProps({
}, },
}) })
const lightTheme = createTheme({
variant: 'light',
settings: {
background: '#FFFFFF',
foreground: '#000000',
caret: '#000000',
selection: '#80C7FF',
gutterBackground: '#FFFFFF',
gutterForeground: '#00000070',
lineHighlight: '#C1E2F840',
},
styles: [
{
tag: t.comment,
color: '#AAAAAA',
},
{
tag: [t.keyword, t.operator, t.typeName, t.tagName, t.propertyName],
color: '#2F6F9F',
fontWeight: 'bold',
},
{
tag: [t.attributeName, t.definition(t.propertyName)],
color: '#4F9FD0',
},
{
tag: [t.className, t.string, t.special(t.brace)],
color: '#CF4F5F',
},
{
tag: t.number,
color: '#CF4F5F',
fontWeight: 'bold',
},
{
tag: t.variableName,
fontWeight: 'bold',
},
],
});
const emit = defineEmits( const emit = defineEmits(
[ [
'update:updatedCode' 'update:updatedCode'
@@ -79,7 +37,7 @@ function selectTheme() {
if (isDarkModeSet()) if (isDarkModeSet())
return oneDark; return oneDark;
else else
return lightTheme; return espresso;
} }
function isDarkModeSet(){ function isDarkModeSet(){

View File

@@ -2,69 +2,95 @@
import InsertTemplateComponent from '@components/common/InsertTemplateComponent.vue' import InsertTemplateComponent from '@components/common/InsertTemplateComponent.vue'
import XMLButtonFormatterComponent from '@components/formatter/XMLButtonFormatterComponent.vue' import XMLButtonFormatterComponent from '@components/formatter/XMLButtonFormatterComponent.vue'
import CodeEditor from '@/components/common/CodeEditorComponent.vue' import CodeEditor from '@/components/common/CodeEditorComponent.vue'
import XsltParamComponent from '@/components/XsltParamComponent.vue'
import { ref } from 'vue' import {ref} from 'vue'
const props = defineProps( const props = defineProps<{
{ stylizedName: string;
stylizedName: {type: String, required: true}, data?: string;
data: {type: String}, params?: { name: string }[];
} }>();
)
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue','update:params'])
const data = ref('') const data = ref('')
const inputFile = ref() const inputFile = ref()
const params = ref<{ name: string }[]>([]);
function sendValue() { function sendValue() {
emit('update:modelValue', data.value) emit('update:modelValue', data.value)
} }
function updateParams(newParams: { name: string }[]) {
emit('update:params', newParams);
}
function updateData(newData: string, clearFileSelector: boolean = true) { function updateData(newData: string, clearFileSelector: boolean = true) {
data.value = newData data.value = newData
if (clearFileSelector) if (clearFileSelector)
inputFile.value.value = ''; inputFile.value.value = '';
sendValue() sendValue()
} }
function clear() { function clear() {
updateData('') updateData('')
} }
function canBeFormatted() { function canBeFormatted() {
return props.stylizedName.toLowerCase() == 'xml' || return props.stylizedName.toLowerCase() == 'xml' ||
props.stylizedName.toLowerCase() == 'xsd' || props.stylizedName.toLowerCase() == 'xsd' ||
props.stylizedName.toLowerCase() == 'xslt' props.stylizedName.toLowerCase() == 'xslt'
} }
function readFile(file : any) { function addParameters() {
return props.stylizedName?.toLowerCase() == "xslt"
const reader = new FileReader()
reader.onloadend = () => {
let result = reader.result?.toString()
if (typeof result == "string")
updateData(result, false);
}
reader.readAsText(file.target.files[0])
} }
function readFile(file: any) {
const reader = new FileReader()
reader.onloadend = () => {
let result = reader.result?.toString()
if (typeof result == "string")
updateData(result, false)
}
reader.readAsText(file.target.files[0])
}
const handleUpdateValue = (options: { name: string }[]) => {
console.log("from parent" +options.length)
params.value = options
updateParams(params.value)
};
</script> </script>
<template> <template>
<div class="flex flex-col w-full h-1/2 lg:h-1/2 flex-none xl:pr-2 2xl:pr-4 pb-2"> <div class="flex flex-col w-full h-1/2 lg:h-1/2 flex-none xl:pr-2 2xl:pr-4 pb-2">
<div class="flex place-content-between w-full items-center"> <div class="flex justify-between mb-2"></div>
<span class="dark:text-white mr-2">{{ stylizedName }}</span>
<div class="flex space-x-2 pb-2 overflow-x-auto">
<div class="flex items-stretch w-64">
<input id="fileLoader" ref="inputFile" class="file-selector" type="file" accept=".xml,.xql,.xquery,.xslt,text/xml,text/plain" @change="readFile" />
</div>
<InsertTemplateComponent :stylized-name="props.stylizedName" @update:default-data="updateData"></InsertTemplateComponent> <div class="flex place-content-between w-full items-center">
<XMLButtonFormatterComponent v-if="canBeFormatted()" :xml="data" @update:result="(data:any) => updateData(data.result)"></XMLButtonFormatterComponent>
<button class="tool-button" @click="clear">Clear</button> <span class="dark:text-white mr-2">{{ stylizedName }}</span>
</div>
</div> <div class="flex items-stretch w-64">
<CodeEditor @update:updated-code="updateData" v-model="data" :code="data" :config="{disabled:false, language:stylizedName}"></CodeEditor> <input id="fileLoader" ref="inputFile" class="file-selector" type="file" accept=".xml,.xql,.xquery,.xslt,text/xml,text/plain" @change="readFile"/>
</div>
<div class="flex space-x-2 pb-2 overflow-x-auto">
<InsertTemplateComponent :stylized-name="props.stylizedName" @update:default-data="updateData"></InsertTemplateComponent>
<XMLButtonFormatterComponent v-if="canBeFormatted()" :xml="data" @update:result="(data:any) => updateData(data.result)"></XMLButtonFormatterComponent>
<button class="tool-button" @click="clear">Clear</button>
</div>
</div> </div>
<div class="flex justify-end gap-2 place-content-between w-full items-center">
<XsltParamComponent v-if="addParameters()" @update-value="handleUpdateValue" :xslt="data"/>
</div>
<CodeEditor @update:updated-code="updateData" v-model="data" :code="data" :config="{disabled:false, language:stylizedName}"></CodeEditor>
</div>
</template> </template>

View File

@@ -1,24 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue'; import {onMounted, ref} from 'vue';
import { type TabData } from '../common/TabData' import {type TabData} from '../common/TabData'
import CodeEditor from '@/components/common/CodeEditorComponent.vue'; import CodeEditor from '@/components/common/CodeEditorComponent.vue';
const props = defineProps( const props = defineProps<{
{ tool: string;
tool: {type: String, required: true}, xml: string | TabData[];
xml: {type: [String, Array<TabData>], required: true}, query: string;
query: {type: String, required: true}, params?: { name: string }[];
activeTabId: {type: Number, required: false} }>();
}
)
const emit = defineEmits(["update", "update:engine"]); const emit = defineEmits(["update"]);
const result = ref(''); const result = ref('');
let enginesForCurrentTool = ref(["saxon", "xalan", "libxml"]); let enginesForCurrentTool = ref(["saxon", "xalan", "libxml"]);
const formattedParams = ref();
const allVersionsOfXpath = ["2.0", "3.0", "3.1"];
const allVersions = ["1.0", "2.0", "3.0", "3.1"]; const allVersions = ["1.0", "2.0", "3.0", "3.1"];
let versionsForCurrentEngine = ref([""]); let versionsForCurrentEngine = ref([""]);
@@ -74,7 +73,7 @@ function changeAvailableVersionsOfXPath() {
if(engine.value == "xalan" || engine.value == "libxml") if(engine.value == "xalan" || engine.value == "libxml")
versionsForCurrentEngine.value = ["1.0"]; versionsForCurrentEngine.value = ["1.0"];
else if (engine.value == "saxon") else if (engine.value == "saxon")
versionsForCurrentEngine.value = allVersionsOfXpath; versionsForCurrentEngine.value = allVersions;
} }
function selectDefaultEngine() { function selectDefaultEngine() {
@@ -88,7 +87,9 @@ function selectDefaultVersion() {
} }
function process() { function process() {
let request:Request = prepareRequest(); props.params?.forEach((param) => {console.log(param.name)})
let request:Request = prepareRequest();
fetchRequest(request).then((data) => { fetchRequest(request).then((data) => {
updateOutputField(data); updateOutputField(data);
}) })
@@ -101,6 +102,7 @@ function updateOutputField(data: any) {
} }
function prepareRequest():Request { function prepareRequest():Request {
formattedParams.value = formatParams()
let request = new Request(prepareURL(), { let request = new Request(prepareURL(), {
body: selectRequestBodyType(), body: selectRequestBodyType(),
method: "POST" method: "POST"
@@ -113,40 +115,49 @@ function prepareURL(): string {
const engineEndpoint = engine.value == "libxml" ? "libxml" : "java"; const engineEndpoint = engine.value == "libxml" ? "libxml" : "java";
let tool = props.tool; let tool = props.tool;
if (Array.isArray(props.xml) && props.xml.length > 1 && engine.value == "saxon") if (Array.isArray(props.xml) && props.xml.length > 1)
tool = "multiple/xslt"; tool = "multiple/xslt";
return document.location.protocol + "//" + document.location.hostname + "/" + engineEndpoint + "/" + tool; return document.location.protocol + "//" + document.location.hostname + "/" + engineEndpoint + "/" + tool;
} }
function selectRequestBodyType() : string { function selectRequestBodyType() : string {
if (Array.isArray(props.xml) && (engine.value == "xalan" || engine.value == "libxml")) if (Array.isArray(props.xml) && props.xml.length > 1)
return prepareRequestBodySingleXml(props.xml.at(props.activeTabId!)!.data) return prepareRequestBodyMultiXml();
else if (Array.isArray(props.xml) && props.xml.length > 1)
return prepareRequestBodyMultiXml();
else if (Array.isArray(props.xml)) else if (Array.isArray(props.xml))
return prepareRequestBodySingleXml(props.xml.at(0)!.data); return prepareRequestBodySingleXml(props.xml.at(0)!.data);
else else
return prepareRequestBodySingleXml(props.xml!); return prepareRequestBodySingleXml(props.xml!);
}
function formatParams() {
return props.params?.slice(1).map(param => {
const [key, value] = param.name.split(" = ");
return { key, value };
}) ?? [];
} }
function prepareRequestBodySingleXml(data: string):string { function prepareRequestBodySingleXml(data: string):string {
let requestBody = JSON.stringify({
let requestBody = JSON.stringify({
"params": formattedParams.value,
"data": data, "data": data,
"processorData": props.query, "processorData": props.query,
"processor": engine.value, "processor": engine.value,
"version": version.value "version": version.value
}); });
console.log(requestBody);
return requestBody; return requestBody;
} }
function prepareRequestBodyMultiXml():string { function prepareRequestBodyMultiXml():string {
if (!Array.isArray(props.xml))
if (!Array.isArray(props.xml))
return ""; return "";
let xmlFilesArray = convertDataArray(props.xml); let xmlFilesArray = convertDataArray(props.xml);
let requestBody = JSON.stringify({ let requestBody = JSON.stringify({
"params": formattedParams.value,
"data": xmlFilesArray, "data": xmlFilesArray,
"processorData": props.query, "processorData": props.query,
"processor": engine.value, "processor": engine.value,
@@ -192,10 +203,6 @@ function emitVersionChange() {
emit("update", version.value); emit("update", version.value);
} }
function emitEngineChange() {
emit("update:engine", engine.value);
}
function isVersionSelectionAvailable() { function isVersionSelectionAvailable() {
return !(versionsForCurrentEngine.value.length == 1 && versionsForCurrentEngine.value.at(0) == "N/A"); return !(versionsForCurrentEngine.value.length == 1 && versionsForCurrentEngine.value.at(0) == "N/A");
} }
@@ -210,11 +217,6 @@ function highlightField() {
return ""; return "";
} }
function handleChange() {
changeAvailableVersions();
emitEngineChange();
}
</script> </script>
<template> <template>
@@ -222,7 +224,7 @@ function handleChange() {
<div class="flex place-content-between w-full items-center pb-2"> <div class="flex place-content-between w-full items-center pb-2">
<span class="dark:text-white">Result:</span> <span class="dark:text-white">Result:</span>
<div class="flex space-x-2 overflow-x-auto"> <div class="flex space-x-2 overflow-x-auto">
<select v-model="engine" name="engine" @change="handleChange()" class="px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600"> <select v-model="engine" name="engine" @change="changeAvailableVersions()" class="px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600">
<option v-for="engine in enginesForCurrentTool" :value="engine">{{ engine }}</option> <option v-for="engine in enginesForCurrentTool" :value="engine">{{ engine }}</option>
</select> </select>
<select v-model="version" v-if="isVersionSelectionAvailable()" name="version" @change="emitVersionChange()" class="px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600"> <select v-model="version" v-if="isVersionSelectionAvailable()" name="version" @change="emitVersionChange()" class="px-3 rounded-full border border-slate-400 bg-white dark:text-slate-100 dark:bg-gray-600">

View File

@@ -10,11 +10,11 @@ const props = defineProps(
{ {
stylizedName: {type: String, required: true}, stylizedName: {type: String, required: true},
data: {type: Array<TabData>}, data: {type: Array<TabData>},
tabCountLimit: {type: Number, required: false, validator: (value) => typeof value == "number" && value > 0}, tabCountLimit: {type: Number, required: false, validator: (value) => typeof value == "number" && value > 0}
engine: {type: String, required: true}
} }
) )
const emit = defineEmits(['update:modelValue', 'update:activeTabId']) const emit = defineEmits(['update:modelValue'])
const newTabId = ref(0); const newTabId = ref(0);
const activeTabId = ref(0); const activeTabId = ref(0);
const data = ref('') const data = ref('')
@@ -30,9 +30,6 @@ tabs.value.push({
function sendValue() { function sendValue() {
emit('update:modelValue', tabs.value); emit('update:modelValue', tabs.value);
} }
function emitActiveTab() {
emit('update:activeTabId', activeTabId.value);
}
function updateData(newData: string) { function updateData(newData: string) {
data.value = newData; data.value = newData;
@@ -76,7 +73,6 @@ function changeActiveTab(id : number) {
tabs.value.at(index)!.data = data.value; tabs.value.at(index)!.data = data.value;
activeTabId.value = id; activeTabId.value = id;
emitActiveTab();
data.value = tabs.value.at(newIndex)!.data; data.value = tabs.value.at(newIndex)!.data;
sendValue(); sendValue();
@@ -132,7 +128,7 @@ function findIndexWithID(id : number) : number {
<div class="flex flex-col w-full h-1/2 lg:h-1/2 flex-none xl:pr-2 2xl:pr-4 pb-2"> <div class="flex flex-col w-full h-1/2 lg:h-1/2 flex-none xl:pr-2 2xl:pr-4 pb-2">
<div class="flex justify-between mb-2"> <div class="flex justify-between mb-2">
<div class="flex gap-2 overflow-x-auto"> <div class="flex gap-2 overflow-x-auto">
<TabComponent @click:activate="changeActiveTab" @click:remove="removeTab" v-for="tab in tabs" :id="tab.id" :isActive="tab.id == activeTabId" :class="[tab.id !== activeTabId && (props.engine === 'xalan' ? 'disabled-tab' : '' || props.engine === 'libxml' ? 'disabled-tab' : '')]">{{ tab.name }}</TabComponent> <TabComponent @click:activate="changeActiveTab" @click:remove="removeTab" v-for="tab in tabs" :id="tab.id" :isActive="tab.id == activeTabId">{{ tab.name }}</TabComponent>
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
<div class="flex items-stretch w-64"> <div class="flex items-stretch w-64">

View File

@@ -7,8 +7,6 @@ const props = defineProps({
tool:{type: String, required:true} tool:{type: String, required:true}
}) })
const activeIndex = ref<number | null>(null)
function toggleTooltips() { function toggleTooltips() {
isEntryHidden.value = !isEntryHidden.value; isEntryHidden.value = !isEntryHidden.value;
} }
@@ -22,15 +20,7 @@ function entryHasArguments() {
} }
function entryHasExamples() { function entryHasExamples() {
if("examples" in props.entryData){ return props.entryData.examples.length > 0;
return props.entryData.examples.length > 0;
}
}
function entryHasXsltExamples() {
if("xsltExamples" in props.entryData){
return props.entryData.xsltExamples.length > 0;
}
} }
function interpretXPathIndicators( elementType:string ):string { function interpretXPathIndicators( elementType:string ):string {
@@ -57,7 +47,7 @@ function interpretXPathIndicators( elementType:string ):string {
<template> <template>
<div class="flex p-1 flex-col rounded-xl border border-slate-400 dark:border-slate-400"> <div class="flex p-1 flex-col rounded-xl border border-slate-400 dark:border-slate-400">
<button :class="{ 'mb-2' : !isEntryHidden }" class="dark:text-slate-100 hover:font-bold overflow-auto" @click="toggleTooltips()">{{ props.entryData.name }}</button> <button :class="{ 'mb-2' : !isEntryHidden }" class="dark:text-slate-100 hover:font-bold" @click="toggleTooltips()">{{ props.entryData.name }}</button>
<div id="content" :class="{'hidden' : isEntryHidden}" class="w-full p-2 rounded-xl dark:text-white bg-indigo-50 dark:bg-slate-800" > <div id="content" :class="{'hidden' : isEntryHidden}" class="w-full p-2 rounded-xl dark:text-white bg-indigo-50 dark:bg-slate-800" >
<h4 class="text-xl mb-2 font-bold text-justify">Description</h4> <h4 class="text-xl mb-2 font-bold text-justify">Description</h4>
<span class="text-justify"> <span class="text-justify">
@@ -65,29 +55,6 @@ function interpretXPathIndicators( elementType:string ):string {
{{ props.entryData.description }} {{ props.entryData.description }}
</p> </p>
</span> </span>
<br/><h4 class="text-xl mb-2 font-bold text-justify">Examples:</h4>
<table v-if="entryHasXsltExamples()" class="w-full border">
<tr>
<th class="font-normal">Use of {{ props.entryData.name }} example:</th>
</tr>
<tr v-for="(ex, index) in props.entryData.xsltExamples" :key="index">
<td
class="relative font-bold cursor-pointer bg-white p-4 border hover-effect"
@mouseenter="activeIndex = index"
@mouseleave="activeIndex = null"
>
<code>{{ ex.xslt }}</code>
<transition name="fade">
<div v-if="activeIndex === index" class="popup">
<code>{{ ex.xslt }}</code>
</div>
</transition>
</td>
</tr>
</table>
<br><span class="font-bold flex justify-center items-center w-full h-full">Hover over the text to enlarge!</span>
<div id="xpathArgTooltip" v-if="tool == 'xpath'"> <div id="xpathArgTooltip" v-if="tool == 'xpath'">
<h4 class="text-xl mt-4 mb-2 font-bold">Args and Output</h4> <h4 class="text-xl mt-4 mb-2 font-bold">Args and Output</h4>
<table v-if="entryHasArguments()" class="w-full"> <table v-if="entryHasArguments()" class="w-full">

View File

@@ -43,36 +43,3 @@
.tab-active { .tab-active {
@apply py-2 px-3 h-fit text-slate-700 border-t border-l border-r border-slate-400 rounded-t-2xl bg-gradient-to-r from-blue-400 to-sky-300 dark:text-white dark:from-sky-600 dark:to-sky-800 hover:bg-blue-400 @apply py-2 px-3 h-fit text-slate-700 border-t border-l border-r border-slate-400 rounded-t-2xl bg-gradient-to-r from-blue-400 to-sky-300 dark:text-white dark:from-sky-600 dark:to-sky-800 hover:bg-blue-400
} }
.disabled-tab {
@apply py-2 px-3 h-fit text-slate-400 border-t border-l border-r border-slate-300 rounded-t-2xl bg-gradient-to-r from-gray-200 to-gray-300 dark:from-gray-700 dark:to-gray-800 pointer-events-none opacity-50;
}
.hover-effect {
@apply border-black bg-blue-50;
font-size: 10px;
}
.hover-effect:hover {
@apply bg-blue-200;
}
.popup {
@apply fixed top-1/2 left-1/2 bg-blue-400 text-white p-5 rounded-lg shadow-lg text-sm;
transform: translate(-30%, -35%) scale(1.3) translate3d(-30%, 0px, 0px);
z-index: 1000;
white-space: pre-wrap;
}
.fade-enter-active {
@apply duration-500 opacity-100;
}
.fade-leave-active {
animation: fadeOut 0.5s ease-in-out 800ms forwards;
}
@keyframes fadeOut {
0% { opacity: 1; }
100% { opacity: 0; }
}

View File

@@ -11,8 +11,7 @@ import { ref } from 'vue';
const xml = ref(new Array<TabData>); const xml = ref(new Array<TabData>);
const query = ref(''); const query = ref('');
const version = ref(''); const version = ref('');
const engine = ref('') const params = ref<{ name: string }[]>([]);
const activeTabId = ref(0)
function updateVersion(newVersion: string) { function updateVersion(newVersion: string) {
version.value = newVersion; version.value = newVersion;
@@ -24,10 +23,10 @@ function updateVersion(newVersion: string) {
<div id="layout" class="flex flex-row w-full h-full"> <div id="layout" class="flex flex-row w-full h-full">
<div class="flex flex-col 2xl:flex-row w-full xl:w-7/12 grow overflow-hide pr-2"> <div class="flex flex-col 2xl:flex-row w-full xl:w-7/12 grow overflow-hide pr-2">
<div class="flex flex-col w-full 2xl:w-1/2 h-2/3 2xl:h-full flex-none items-center"> <div class="flex flex-col w-full 2xl:w-1/2 h-2/3 2xl:h-full flex-none items-center">
<xmlTabbedInputComponent stylized-name="XML" v-model:activeTabId="activeTabId" :engine="engine" :tab-count-limit="3" v-model="xml"></xmlTabbedInputComponent> <xmlTabbedInputComponent stylized-name="XML" :tab-count-limit="3" v-model="xml"></xmlTabbedInputComponent>
<xmlInputFieldComponent stylized-name="XSLT" :data="query" v-model="query"></xmlInputFieldComponent> <xmlInputFieldComponent stylized-name="XSLT" :data="query" v-model:params="params" v-model="query"></xmlInputFieldComponent>
</div> </div>
<xmlOutputFieldComponent tool="xslt" :xml="xml" :active-tab-id="activeTabId" v-model:engine="engine" :query="query" @update="updateVersion"></xmlOutputFieldComponent> <xmlOutputFieldComponent tool="xslt" :xml="xml" :query="query" :params="params" @update="updateVersion"></xmlOutputFieldComponent>
</div> </div>
<TooltipComponent tool-type="xslt" :version="version"></TooltipComponent> <TooltipComponent tool-type="xslt" :version="version"></TooltipComponent>
</div> </div>

View File

@@ -1,21 +0,0 @@
---
name: "Bug template"
about: "This template is for reporting bugs"
title: "Bug"
---
## Description
*A clear and concise description of the issue.*
### Selected Fields
- **Engine:** [Specify the engine used]
- **Version:** [Specify the version]
- **Tool:** [Specify the currently used tool]
### Data:
*Paste used xml/xslt/json etc...*
## Additional Context
*Any other information that might help with this issue.*

View File

@@ -1,10 +0,0 @@
---
name: "Feature request template"
about: "This template is for requesting features"
title: "Feature request"
---
## Feature Request
*Describe the feature youd like to see and why its useful.*