Compare commits
18 Commits
62a174521d
...
Add_xslt_p
| Author | SHA1 | Date | |
|---|---|---|---|
| 75db025d80 | |||
| d33ac7e9f8 | |||
| bbae61da42 | |||
| 1d5038ca51 | |||
| bdb807d3e0 | |||
| 16b5522ff5 | |||
| 04e37258bf | |||
| b7af1eb33a | |||
| ec49f496da | |||
| 9cb949b485 | |||
| 097af3ed3a | |||
| b9f26f07a8 | |||
| 6a70c3c9c9 | |||
| a0d759f58b | |||
| 9f64b83844 | |||
| 0d469db020 | |||
| 38b3942bde | |||
| e834229cae |
@@ -79,13 +79,11 @@ def xpath(source: str, xpath: str) -> str:
|
||||
else:
|
||||
result_string = ""
|
||||
for e in result:
|
||||
if isinstance(e, etree._Element):
|
||||
result_string += etree.tostring(e, pretty_print=True).decode() + "\n"
|
||||
else:
|
||||
result_string += str(e) + "\n"
|
||||
return result_string, "node"
|
||||
|
||||
|
||||
|
||||
def xsd(source: str, xsd: str) -> bool:
|
||||
"""
|
||||
Method used to validate XML string against XSD schema
|
||||
|
||||
@@ -84,8 +84,14 @@
|
||||
<dependency>
|
||||
<groupId>xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<version>2.7.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Logging -->
|
||||
<dependency>
|
||||
|
||||
@@ -68,7 +68,7 @@ public class MultipleXMLController implements RestController {
|
||||
private XMLResponseBody processData(MultipleXmlJob xmlJob) throws Exception {
|
||||
XmlEngine engine = xmlJob.getEngine();
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
package com.r11.tools.controller;
|
||||
|
||||
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.XMLResponseBody;
|
||||
import com.r11.tools.model.XPathQueryResult;
|
||||
import com.r11.tools.model.XmlTools;
|
||||
import com.r11.tools.xml.XmlEngine;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import spark.Request;
|
||||
import spark.Response;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Controller used to handle XML tools: XPath, XSD validation, XQuery and XSLT
|
||||
*
|
||||
* @author Adam Bem
|
||||
*/
|
||||
@GlobalControllerManifest
|
||||
@@ -22,12 +31,15 @@ public class XmlController implements RestController {
|
||||
|
||||
private final XmlEngine saxon;
|
||||
private final XmlEngine xalan;
|
||||
private final XmlTools tools;
|
||||
|
||||
public XmlController(Gson gson, Logger logger, XmlEngine saxon, XmlEngine xalan) {
|
||||
this.gson = gson;
|
||||
this.logger = logger;
|
||||
this.saxon = saxon;
|
||||
this.xalan = xalan;
|
||||
this.tools = new XmlTools();
|
||||
|
||||
}
|
||||
|
||||
@ScopedControllerManifest(method = HandlerType.POST, path = "/xpath")
|
||||
@@ -48,6 +60,7 @@ public class XmlController implements RestController {
|
||||
|
||||
@ScopedControllerManifest(method = HandlerType.POST, path = "/xslt")
|
||||
public void acceptRequestXslt(Request request, Response response) {
|
||||
System.out.println("received xslt");
|
||||
acceptRequest(request, response, XmlJobType.XSLT);
|
||||
}
|
||||
|
||||
@@ -91,7 +104,6 @@ public class XmlController implements RestController {
|
||||
responseBody.setDuration(duration);
|
||||
|
||||
xmlJob.getResponse().status(200);
|
||||
|
||||
this.logger.info("Request (" + xmlJob.getXmlJobType() + ", " +
|
||||
xmlJob.getEngine().getVersion() +
|
||||
") processed in " + duration + " ms.");
|
||||
@@ -130,7 +142,7 @@ public class XmlController implements RestController {
|
||||
String result = null;
|
||||
switch (xmlJob.getXmlJobType()) {
|
||||
case XSLT:
|
||||
result = engine.processXSLT(requestBody.getData(), requestBody.getProcessorData());
|
||||
result = engine.processXSLT(requestBody.getParams(),requestBody.getData(), requestBody.getProcessorData());
|
||||
break;
|
||||
case XSD:
|
||||
result = engine.validate(requestBody.getData(), requestBody.getProcessorData()).trim();
|
||||
@@ -141,9 +153,10 @@ public class XmlController implements RestController {
|
||||
requestBody.getVersion());
|
||||
break;
|
||||
}
|
||||
return new XMLResponseBody(result, "OK", requestBody.getVersion());
|
||||
return new XMLResponseBody(result, "OK", requestBody.getProcessorData());
|
||||
}
|
||||
|
||||
|
||||
private XMLResponseBody processingErrorResponse(Exception ex, XmlJob xmlJob) {
|
||||
XmlEngine engine = xmlJob.getEngine();
|
||||
XmlJobType xmlJobType = xmlJob.getXmlJobType();
|
||||
|
||||
@@ -7,7 +7,7 @@ import spark.Response;
|
||||
public class XmlJob {
|
||||
private final Response response;
|
||||
private final XMLRequestBody requestBody;
|
||||
private final XmlEngine engine;
|
||||
private XmlEngine engine;
|
||||
private final XmlJobType xmlJobType;
|
||||
|
||||
public XmlJob(Response response, XMLRequestBody requestBody, XmlEngine engine, XmlJobType xmlJobType) {
|
||||
@@ -16,7 +16,11 @@ public class XmlJob {
|
||||
this.engine = engine;
|
||||
this.xmlJobType = xmlJobType;
|
||||
}
|
||||
|
||||
public XmlJob(Response response, XMLRequestBody requestBody, XmlJobType xmlJobType) {
|
||||
this.response = response;
|
||||
this.requestBody = requestBody;
|
||||
this.xmlJobType = xmlJobType;
|
||||
}
|
||||
public Response getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.r11.tools.controller.internal;
|
||||
|
||||
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) {
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.r11.tools.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class XMLMultipleFilesBody {
|
||||
|
||||
@SerializedName("data")
|
||||
@@ -12,6 +14,8 @@ public class XMLMultipleFilesBody {
|
||||
private String processor;
|
||||
@SerializedName("version")
|
||||
private String version;
|
||||
@SerializedName("params")
|
||||
private List<Param> params;
|
||||
|
||||
|
||||
public String getProcessorData() {
|
||||
@@ -29,4 +33,9 @@ public class XMLMultipleFilesBody {
|
||||
public XMLMultipleFilesData[] getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public List<Param> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.r11.tools.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* POJO class used to contain body of XML related requests
|
||||
* @author Adam Bem
|
||||
@@ -15,20 +17,22 @@ public class XMLRequestBody {
|
||||
private String processor;
|
||||
@SerializedName("version")
|
||||
private String version;
|
||||
@SerializedName("params")
|
||||
private List<Param> params;
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getProcessorData() {
|
||||
return processorData;
|
||||
}
|
||||
|
||||
public String getProcessorData() {return processorData;}
|
||||
public String getProcessor() {
|
||||
return processor;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
public List<Param> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ public class XMLResponseBody {
|
||||
// Optional
|
||||
private String type;
|
||||
|
||||
public XMLResponseBody(String status){
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public XMLResponseBody(String result, String status, String processor) {
|
||||
this.result = result;
|
||||
this.status = status;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.r11.tools.xml;
|
||||
|
||||
import com.r11.tools.model.Param;
|
||||
import com.r11.tools.model.XMLMultipleFilesData;
|
||||
import com.r11.tools.model.XMLRequestBody;
|
||||
import com.r11.tools.model.XPathQueryResult;
|
||||
import com.r11.tools.model.XmlTools;
|
||||
import net.sf.saxon.s9api.*;
|
||||
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
@@ -10,6 +13,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -26,10 +30,13 @@ public class Saxon implements XmlEngine{
|
||||
* @throws SaxonApiException thrown on stylesheet or transformation error
|
||||
* @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);
|
||||
XsltCompiler compiler = processor.newXsltCompiler();
|
||||
|
||||
transform = tools.addParams(params,transform);
|
||||
|
||||
String filesPath = "/tmp/"+UUID.randomUUID()+"/";
|
||||
try{
|
||||
createXMLFilesFromData(data, filesPath);
|
||||
@@ -78,14 +85,18 @@ public class Saxon implements XmlEngine{
|
||||
|
||||
/**
|
||||
* Transforms string containing xml document via xslt
|
||||
*
|
||||
* @param params
|
||||
* @param data xml to be transformed
|
||||
* @param transform xslt
|
||||
* @return transformed xml
|
||||
* @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);
|
||||
XsltCompiler compiler = processor.newXsltCompiler();
|
||||
transform = tools.addParams(params,transform);
|
||||
System.out.println(transform);
|
||||
XsltExecutable stylesheet = compiler.compile(new StreamSource(new StringReader(transform)));
|
||||
StringWriter sw = new StringWriter();
|
||||
Serializer out = processor.newSerializer(sw);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.r11.tools.xml;
|
||||
|
||||
import com.r11.tools.model.Param;
|
||||
import com.r11.tools.model.XMLMultipleFilesData;
|
||||
import com.r11.tools.model.XMLRequestBody;
|
||||
import com.r11.tools.model.XPathQueryResult;
|
||||
import com.r11.tools.model.XmlTools;
|
||||
import org.apache.xpath.XPathAPI;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
@@ -22,6 +25,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handler for Xalan engine
|
||||
@@ -31,16 +35,20 @@ public class Xalan implements XmlEngine{
|
||||
|
||||
/**
|
||||
* Transforms string containing xml document via xslt
|
||||
*
|
||||
* @param params
|
||||
* @param data xml to be transformed
|
||||
* @param transform xslt
|
||||
* @return transformed xml
|
||||
* @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();
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
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));
|
||||
Transformer transformer = TransformerFactory.newInstance().newTransformer(stylesource);
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -108,10 +109,7 @@ public class Xalan implements XmlEngine{
|
||||
for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) {
|
||||
resultString.append(nn.getNodeValue());
|
||||
}
|
||||
} else if (isAttributeNode(n)) {
|
||||
resultString.append(n.getNodeValue());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream)));
|
||||
resultString.append(outputStream);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.r11.tools.xml;
|
||||
|
||||
import com.r11.tools.model.Param;
|
||||
import com.r11.tools.model.XMLMultipleFilesData;
|
||||
import com.r11.tools.model.XPathQueryResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
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 executeXQuery(String data, String xquery, String version) throws Exception;
|
||||
|
||||
public String getVersion();
|
||||
|
||||
}
|
||||
|
||||
@@ -28,12 +28,8 @@
|
||||
"description":"Specifies a numeric priority for this template."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/template",
|
||||
"output": "XML Tree"
|
||||
},{
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/apply-templates",
|
||||
"output": "XML Nodes"
|
||||
},{
|
||||
"name": "<xsl:apply-imports/>",
|
||||
@@ -64,12 +56,8 @@
|
||||
"attributes":
|
||||
[
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/apply-imports",
|
||||
"output": "Imported output from another XSLT"
|
||||
},{
|
||||
"name": "<xsl:call-template>",
|
||||
@@ -82,12 +70,8 @@
|
||||
"description":"Specifies the name of the template you wish to invoke."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/call-template",
|
||||
"output": "Called template XML"
|
||||
},{
|
||||
"name": "<xsl:next-match>",
|
||||
@@ -96,12 +80,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/next-match.html",
|
||||
"output": "Choosed XML template"
|
||||
},{
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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=\"' '\"/>\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=\"' '\"/>\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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/mode.html",
|
||||
"output": "Choosed XML template"
|
||||
},{
|
||||
"name": "<xsl:override>",
|
||||
@@ -178,12 +154,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/override.html",
|
||||
"output": "Appears as a child of xsl:use-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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/package.html",
|
||||
"output": "Appears as a child of xsl:use-package."
|
||||
},{
|
||||
"name": "<xsl:accept>",
|
||||
@@ -289,12 +257,8 @@
|
||||
"description":"Determines the potential visibility of the selected components."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accept.html",
|
||||
"output": "Appears as a child of xsl:use-package."
|
||||
},{
|
||||
"name": "<xsl:global-context-item>",
|
||||
@@ -312,12 +276,8 @@
|
||||
"description":"Specifies whether a stylesheet module requires a global context item; the default is optional."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [
|
||||
{
|
||||
"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",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/global-context-item.html",
|
||||
"output": "Global context item"
|
||||
}
|
||||
]
|
||||
@@ -337,8 +297,8 @@
|
||||
"description":"XPath expression that specifies the nodes to be processed."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-for-each",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/for-each",
|
||||
"output": "Processed set of nodes"
|
||||
},
|
||||
{
|
||||
@@ -352,8 +312,8 @@
|
||||
"description":"Contains an XPath expression that can be evaluated to a Boolean value."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-if",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/if",
|
||||
"output": "Depending on test processed template or not."
|
||||
},
|
||||
{
|
||||
@@ -363,8 +323,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-choose",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/choose",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-when",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/when",
|
||||
"output": "Processed or not XML Template"
|
||||
},
|
||||
{
|
||||
@@ -389,8 +349,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-otherwise",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/otherwise",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-for-each-group",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/for-each-group.html",
|
||||
"output": "processed XML Template"
|
||||
},
|
||||
{
|
||||
@@ -454,8 +414,8 @@
|
||||
"description":"Expression to select nodes/values."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-iterate",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/iterate.html",
|
||||
"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. "
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-break",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/break.html",
|
||||
"output": "processed XML Template"
|
||||
},
|
||||
{
|
||||
@@ -480,8 +440,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-next-iteration",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/next-iteration.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-completion",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-completion.html",
|
||||
"output": "processed XML Template"
|
||||
},
|
||||
{
|
||||
@@ -506,8 +466,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-fork",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/fork.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-empty",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-empty.html",
|
||||
"output": "processed XML Template"
|
||||
},
|
||||
{
|
||||
@@ -536,8 +496,8 @@
|
||||
"description":"The value to be output when the containing sequence constructor delivers a non-empty result."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-non-empty",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-non-empty.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-try",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/try.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-try",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/try.html",
|
||||
"output": "processed XML Template"
|
||||
},
|
||||
{
|
||||
@@ -596,8 +556,8 @@
|
||||
"description":"Specifies whether a template requires a context item; the default is optional."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-context-item",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/context-item.html",
|
||||
"output": "processed XML Template"
|
||||
}
|
||||
]
|
||||
@@ -622,8 +582,8 @@
|
||||
"description":"Defines the namespace URI for this attribute in the output document."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-attribute",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/attribute",
|
||||
"output": "XML Element with provided attribute"
|
||||
},{
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-attribute-set",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/attribute-set",
|
||||
"output": "Named set of attributes"
|
||||
},{
|
||||
"name": "<xsl:copy>",
|
||||
@@ -655,8 +615,8 @@
|
||||
"description":"Lists attribute sets that should be applied to the output node, if it is an element"
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-copy",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/copy",
|
||||
"output": "Copy of XML node"
|
||||
},{
|
||||
"name": "<xsl:number>",
|
||||
@@ -709,8 +669,8 @@
|
||||
"description":"Indicates the number of digits that make up a numeric group."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-number",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/number",
|
||||
"output": "Formatted number"
|
||||
},{
|
||||
"name": "<xsl:value-of>",
|
||||
@@ -728,8 +688,8 @@
|
||||
"description":"Specifies whether special characters are escaped when written to the output."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-value-of",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/value-of",
|
||||
"output": "Value from XML nodes"
|
||||
},{
|
||||
"name": "<xsl:text>",
|
||||
@@ -742,8 +702,8 @@
|
||||
"description":"Specifies whether special characters are escaped when written to the output."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-text",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/text",
|
||||
"output": "XML Node with writed text"
|
||||
},{
|
||||
"name": "<xsl:comment>",
|
||||
@@ -751,8 +711,8 @@
|
||||
"attributes":
|
||||
[
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-comment",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/comment",
|
||||
"output": "XML Node with writed comment"
|
||||
},
|
||||
{
|
||||
@@ -766,8 +726,8 @@
|
||||
"description":"Specifies the name of this processing instruction."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-processing-instruction",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/processing-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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-key",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/key",
|
||||
"output": "key to use in stylesheet"
|
||||
},
|
||||
{
|
||||
@@ -856,8 +816,8 @@
|
||||
"description":"Specifies the character separating positive and negative subpatterns in a format pattern."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-decimal-format",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/decimal-format",
|
||||
"output": "decimal format"
|
||||
},
|
||||
{
|
||||
@@ -871,8 +831,8 @@
|
||||
"description":"Specifies the elements for which whitespace should be preserved."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-preserve-space",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/preserve-space",
|
||||
"output": "preserved space"
|
||||
},
|
||||
{
|
||||
@@ -886,8 +846,8 @@
|
||||
"description":"Specifies the elements for which whitespace should be preserved."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-strip-space",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/strip-space",
|
||||
"output": "elements with removed whitespace"
|
||||
},
|
||||
{
|
||||
@@ -921,8 +881,8 @@
|
||||
"description":"Defines whether items are to be ordered alphabetically or numerically."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-sort",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/sort",
|
||||
"output": "sorted elements"
|
||||
},
|
||||
{
|
||||
@@ -966,8 +926,8 @@
|
||||
"description":"Lists elements whose text contents should be written as CDATA sections."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-output",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/output",
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-result-document",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/result-document.html",
|
||||
"output": "XML Document"
|
||||
},{
|
||||
"name": "<xsl:character-map>",
|
||||
@@ -1145,8 +1105,8 @@
|
||||
"description":"Character maps may be assembled from other character maps using the use-character-maps attribute."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-character-map",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/character-map.html",
|
||||
"output": "named character map"
|
||||
},{
|
||||
"name": "<xsl:output-character>",
|
||||
@@ -1164,8 +1124,8 @@
|
||||
"description":"Any string, that replaces the specified character during serialization."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-output-character",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/output-character.html",
|
||||
"output": "defined character"
|
||||
},{
|
||||
"name": "<xsl:merge>",
|
||||
@@ -1174,8 +1134,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge.html",
|
||||
"output": "merged files"
|
||||
},{
|
||||
"name": "<xsl:merge-action>",
|
||||
@@ -1184,8 +1144,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-action",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-action.html",
|
||||
"output": "merged files"
|
||||
},{
|
||||
"name": "<xsl:merge-key>",
|
||||
@@ -1218,8 +1178,8 @@
|
||||
"description":"It declares whether uppercase letters are sorted before their lowercase equivalents, or vice-versa"
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-key",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-key.html",
|
||||
"output": "merged files"
|
||||
},{
|
||||
"name": "<xsl:merge-source>",
|
||||
@@ -1272,8 +1232,8 @@
|
||||
"description":"If specified, data read from this merge source is validated against the named schema type."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-source",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-source.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-stylesheet",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-transform",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/transform",
|
||||
"output": "XSLT Stylesheet"
|
||||
},
|
||||
{
|
||||
@@ -1423,8 +1383,8 @@
|
||||
"description":"Specifies the URI of the stylesheet to import."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-import",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/import",
|
||||
"output": "XSLT Stylesheet from another file"
|
||||
},
|
||||
{
|
||||
@@ -1438,8 +1398,8 @@
|
||||
"description":"Specifies the URI of the stylesheet to import."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-include",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/include",
|
||||
"output": "XSLT Stylesheet with XSLT from another file."
|
||||
},
|
||||
{
|
||||
@@ -1458,8 +1418,8 @@
|
||||
"description":"Specifies the desired namespace for the output tree."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/namespace-alias",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/namespace-alias",
|
||||
"output": "XML with provided element"
|
||||
}
|
||||
]
|
||||
@@ -1509,8 +1469,8 @@
|
||||
"description":"Uses an XPath expression to provide a default value if none is specified."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-param",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/param",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-variable",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-with-param",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/with-param",
|
||||
"output": "XML Parameter"
|
||||
},
|
||||
{
|
||||
@@ -1564,8 +1524,8 @@
|
||||
"description":"Uses an XPath expression that specifies what is to be copied."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-copy-of",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/copy-of",
|
||||
"output": "Copy of Selected node"
|
||||
},
|
||||
{
|
||||
@@ -1584,8 +1544,8 @@
|
||||
"description":"Determines what happens to any type annotations on element or attribute nodes"
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-document",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/document.html",
|
||||
"output": "Document Node"
|
||||
},
|
||||
{
|
||||
@@ -1604,8 +1564,8 @@
|
||||
"description":"The string value of the namespace node"
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/namespace.html",
|
||||
"output": "Namespace Node"
|
||||
},
|
||||
{
|
||||
@@ -1624,8 +1584,8 @@
|
||||
"description":"The namespace prefix used in the result document."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/namespace-alias.html",
|
||||
"output": "Document with changed namespaces"
|
||||
},
|
||||
{
|
||||
@@ -1639,8 +1599,8 @@
|
||||
"description":"Specifies the input."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-sequence",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/sequence.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-analyze-string",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/analyze-string.html",
|
||||
"output": "XML Node"
|
||||
},
|
||||
{
|
||||
@@ -1681,8 +1641,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-matching-substring",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/matching-substring.html",
|
||||
"output": "XML Node"
|
||||
},
|
||||
{
|
||||
@@ -1692,8 +1652,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-non-matching-substring",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/non-matching-substring.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-function",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/function.html",
|
||||
"output": "Function"
|
||||
},
|
||||
{
|
||||
@@ -1803,8 +1763,8 @@
|
||||
"description":"The value of the attribute is an expression that evaluates to a map."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-evaluate",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/evaluate.html",
|
||||
"output": "String"
|
||||
},
|
||||
{
|
||||
@@ -1828,8 +1788,8 @@
|
||||
"description":"Specifies the error code associated with the error message produced when the assertion is false."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-assert",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/assert.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-message",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/message",
|
||||
"output": "Message in console"
|
||||
},
|
||||
{
|
||||
@@ -1859,8 +1819,8 @@
|
||||
"attributes":
|
||||
[
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-fallback",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/fallback",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-map",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/map.html",
|
||||
"output": "Map"
|
||||
},
|
||||
{
|
||||
@@ -1894,8 +1854,8 @@
|
||||
"description":"The associated value can be defined either by a select attribute or by an enclosed sequence constructor."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-map-entry",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/map-entry.html",
|
||||
"output": "Singleton Map"
|
||||
},
|
||||
{
|
||||
@@ -1919,8 +1879,8 @@
|
||||
"description":"Determines the external visibility of the selected components."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-expose",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/expose.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accumulator",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accumulator.html",
|
||||
"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."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accumulator-rule",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accumulator-rule.html",
|
||||
"output": "Accumulator"
|
||||
},
|
||||
{
|
||||
@@ -2039,8 +1999,8 @@
|
||||
"description":"Controls whether XInclude processing takes place."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-source-document",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/source-document.html",
|
||||
"output": "Processed Document"
|
||||
},
|
||||
{
|
||||
@@ -2059,8 +2019,8 @@
|
||||
"description":"The version of the named package to be used. The default is *, which matches any version. "
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-use-package",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/use-package.html",
|
||||
"output": "Package"
|
||||
},
|
||||
{
|
||||
@@ -2070,8 +2030,8 @@
|
||||
[
|
||||
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-where-populated",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/where-populated.html",
|
||||
"output": "checks for children"
|
||||
},
|
||||
{
|
||||
@@ -2095,8 +2055,8 @@
|
||||
"description":"Determines the potential visibility of the selected components."
|
||||
}
|
||||
],
|
||||
"xsltExamples": [],
|
||||
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accept",
|
||||
"examples": [],
|
||||
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accept.html",
|
||||
"output": "restricts visibility"
|
||||
}
|
||||
]
|
||||
|
||||
72
Frontend/src/components/XsltParamComponent.vue
Normal file
72
Frontend/src/components/XsltParamComponent.vue
Normal 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>
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
import { onBeforeUpdate, inject } from 'vue'
|
||||
import { Codemirror } from 'vue-codemirror'
|
||||
import { oneDark } from '@codemirror/theme-one-dark'
|
||||
import { createTheme} from 'thememirror';
|
||||
import {tags as t} from '@lezer/highlight';
|
||||
import { espresso } from 'thememirror';
|
||||
import {xml} from '@codemirror/lang-xml'
|
||||
import {json} from '@codemirror/lang-json'
|
||||
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(
|
||||
[
|
||||
'update:updatedCode'
|
||||
@@ -79,7 +37,7 @@ function selectTheme() {
|
||||
if (isDarkModeSet())
|
||||
return oneDark;
|
||||
else
|
||||
return lightTheme;
|
||||
return espresso;
|
||||
}
|
||||
|
||||
function isDarkModeSet(){
|
||||
|
||||
@@ -2,24 +2,31 @@
|
||||
import InsertTemplateComponent from '@components/common/InsertTemplateComponent.vue'
|
||||
import XMLButtonFormatterComponent from '@components/formatter/XMLButtonFormatterComponent.vue'
|
||||
import CodeEditor from '@/components/common/CodeEditorComponent.vue'
|
||||
import XsltParamComponent from '@/components/XsltParamComponent.vue'
|
||||
|
||||
import {ref} from 'vue'
|
||||
|
||||
const props = defineProps(
|
||||
{
|
||||
stylizedName: {type: String, required: true},
|
||||
data: {type: String},
|
||||
}
|
||||
)
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const props = defineProps<{
|
||||
stylizedName: string;
|
||||
data?: string;
|
||||
params?: { name: string }[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits(['update:modelValue','update:params'])
|
||||
|
||||
const data = ref('')
|
||||
const inputFile = ref()
|
||||
const params = ref<{ name: string }[]>([]);
|
||||
|
||||
function sendValue() {
|
||||
emit('update:modelValue', data.value)
|
||||
}
|
||||
|
||||
function updateParams(newParams: { name: string }[]) {
|
||||
emit('update:params', newParams);
|
||||
}
|
||||
|
||||
|
||||
function updateData(newData: string, clearFileSelector: boolean = true) {
|
||||
data.value = newData
|
||||
if (clearFileSelector)
|
||||
@@ -37,34 +44,53 @@ function canBeFormatted() {
|
||||
props.stylizedName.toLowerCase() == 'xslt'
|
||||
}
|
||||
|
||||
function addParameters() {
|
||||
return props.stylizedName?.toLowerCase() == "xslt"
|
||||
}
|
||||
|
||||
function readFile(file: any) {
|
||||
|
||||
const reader = new FileReader()
|
||||
reader.onloadend = () => {
|
||||
let result = reader.result?.toString()
|
||||
if (typeof result == "string")
|
||||
updateData(result, false);
|
||||
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>
|
||||
|
||||
<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 justify-between mb-2"></div>
|
||||
|
||||
<div class="flex place-content-between w-full items-center">
|
||||
|
||||
<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>
|
||||
|
||||
<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 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>
|
||||
@@ -3,22 +3,21 @@ import { onMounted, ref } from 'vue';
|
||||
import {type TabData} from '../common/TabData'
|
||||
import CodeEditor from '@/components/common/CodeEditorComponent.vue';
|
||||
|
||||
const props = defineProps(
|
||||
{
|
||||
tool: {type: String, required: true},
|
||||
xml: {type: [String, Array<TabData>], required: true},
|
||||
query: {type: String, required: true},
|
||||
activeTabId: {type: Number, required: false}
|
||||
}
|
||||
)
|
||||
const props = defineProps<{
|
||||
tool: string;
|
||||
xml: string | TabData[];
|
||||
query: string;
|
||||
params?: { name: string }[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits(["update", "update:engine"]);
|
||||
const emit = defineEmits(["update"]);
|
||||
|
||||
const result = ref('');
|
||||
|
||||
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"];
|
||||
let versionsForCurrentEngine = ref([""]);
|
||||
|
||||
@@ -74,7 +73,7 @@ function changeAvailableVersionsOfXPath() {
|
||||
if(engine.value == "xalan" || engine.value == "libxml")
|
||||
versionsForCurrentEngine.value = ["1.0"];
|
||||
else if (engine.value == "saxon")
|
||||
versionsForCurrentEngine.value = allVersionsOfXpath;
|
||||
versionsForCurrentEngine.value = allVersions;
|
||||
}
|
||||
|
||||
function selectDefaultEngine() {
|
||||
@@ -88,6 +87,8 @@ function selectDefaultVersion() {
|
||||
}
|
||||
|
||||
function process() {
|
||||
props.params?.forEach((param) => {console.log(param.name)})
|
||||
|
||||
let request:Request = prepareRequest();
|
||||
fetchRequest(request).then((data) => {
|
||||
updateOutputField(data);
|
||||
@@ -101,6 +102,7 @@ function updateOutputField(data: any) {
|
||||
}
|
||||
|
||||
function prepareRequest():Request {
|
||||
formattedParams.value = formatParams()
|
||||
let request = new Request(prepareURL(), {
|
||||
body: selectRequestBodyType(),
|
||||
method: "POST"
|
||||
@@ -113,40 +115,49 @@ function prepareURL(): string {
|
||||
const engineEndpoint = engine.value == "libxml" ? "libxml" : "java";
|
||||
|
||||
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";
|
||||
|
||||
return document.location.protocol + "//" + document.location.hostname + "/" + engineEndpoint + "/" + tool;
|
||||
}
|
||||
|
||||
function selectRequestBodyType() : string {
|
||||
if (Array.isArray(props.xml) && (engine.value == "xalan" || engine.value == "libxml"))
|
||||
return prepareRequestBodySingleXml(props.xml.at(props.activeTabId!)!.data)
|
||||
else if (Array.isArray(props.xml) && props.xml.length > 1)
|
||||
if (Array.isArray(props.xml) && props.xml.length > 1)
|
||||
return prepareRequestBodyMultiXml();
|
||||
else if (Array.isArray(props.xml))
|
||||
return prepareRequestBodySingleXml(props.xml.at(0)!.data);
|
||||
else
|
||||
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 {
|
||||
|
||||
let requestBody = JSON.stringify({
|
||||
"params": formattedParams.value,
|
||||
"data": data,
|
||||
"processorData": props.query,
|
||||
"processor": engine.value,
|
||||
"version": version.value
|
||||
});
|
||||
console.log(requestBody);
|
||||
return requestBody;
|
||||
}
|
||||
|
||||
function prepareRequestBodyMultiXml():string {
|
||||
|
||||
if (!Array.isArray(props.xml))
|
||||
return "";
|
||||
|
||||
let xmlFilesArray = convertDataArray(props.xml);
|
||||
|
||||
let requestBody = JSON.stringify({
|
||||
"params": formattedParams.value,
|
||||
"data": xmlFilesArray,
|
||||
"processorData": props.query,
|
||||
"processor": engine.value,
|
||||
@@ -192,10 +203,6 @@ function emitVersionChange() {
|
||||
emit("update", version.value);
|
||||
}
|
||||
|
||||
function emitEngineChange() {
|
||||
emit("update:engine", engine.value);
|
||||
}
|
||||
|
||||
function isVersionSelectionAvailable() {
|
||||
return !(versionsForCurrentEngine.value.length == 1 && versionsForCurrentEngine.value.at(0) == "N/A");
|
||||
}
|
||||
@@ -210,11 +217,6 @@ function highlightField() {
|
||||
return "";
|
||||
}
|
||||
|
||||
function handleChange() {
|
||||
changeAvailableVersions();
|
||||
emitEngineChange();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -222,7 +224,7 @@ function handleChange() {
|
||||
<div class="flex place-content-between w-full items-center pb-2">
|
||||
<span class="dark:text-white">Result:</span>
|
||||
<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>
|
||||
</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">
|
||||
|
||||
@@ -10,11 +10,11 @@ const props = defineProps(
|
||||
{
|
||||
stylizedName: {type: String, required: true},
|
||||
data: {type: Array<TabData>},
|
||||
tabCountLimit: {type: Number, required: false, validator: (value) => typeof value == "number" && value > 0},
|
||||
engine: {type: String, required: true}
|
||||
tabCountLimit: {type: Number, required: false, validator: (value) => typeof value == "number" && value > 0}
|
||||
}
|
||||
)
|
||||
const emit = defineEmits(['update:modelValue', 'update:activeTabId'])
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const newTabId = ref(0);
|
||||
const activeTabId = ref(0);
|
||||
const data = ref('')
|
||||
@@ -30,9 +30,6 @@ tabs.value.push({
|
||||
function sendValue() {
|
||||
emit('update:modelValue', tabs.value);
|
||||
}
|
||||
function emitActiveTab() {
|
||||
emit('update:activeTabId', activeTabId.value);
|
||||
}
|
||||
|
||||
function updateData(newData: string) {
|
||||
data.value = newData;
|
||||
@@ -76,7 +73,6 @@ function changeActiveTab(id : number) {
|
||||
|
||||
tabs.value.at(index)!.data = data.value;
|
||||
activeTabId.value = id;
|
||||
emitActiveTab();
|
||||
data.value = tabs.value.at(newIndex)!.data;
|
||||
|
||||
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 justify-between mb-2">
|
||||
<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 class="flex gap-2">
|
||||
<div class="flex items-stretch w-64">
|
||||
|
||||
@@ -7,8 +7,6 @@ const props = defineProps({
|
||||
tool:{type: String, required:true}
|
||||
})
|
||||
|
||||
const activeIndex = ref<number | null>(null)
|
||||
|
||||
function toggleTooltips() {
|
||||
isEntryHidden.value = !isEntryHidden.value;
|
||||
}
|
||||
@@ -22,16 +20,8 @@ function entryHasArguments() {
|
||||
}
|
||||
|
||||
function entryHasExamples() {
|
||||
if("examples" in props.entryData){
|
||||
return props.entryData.examples.length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
function entryHasXsltExamples() {
|
||||
if("xsltExamples" in props.entryData){
|
||||
return props.entryData.xsltExamples.length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
function interpretXPathIndicators( elementType:string ):string {
|
||||
const lastChar = elementType.charAt(elementType.length - 1);
|
||||
@@ -57,7 +47,7 @@ function interpretXPathIndicators( elementType:string ):string {
|
||||
|
||||
<template>
|
||||
<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" >
|
||||
<h4 class="text-xl mb-2 font-bold text-justify">Description</h4>
|
||||
<span class="text-justify">
|
||||
@@ -65,29 +55,6 @@ function interpretXPathIndicators( elementType:string ):string {
|
||||
{{ props.entryData.description }}
|
||||
</p>
|
||||
</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'">
|
||||
<h4 class="text-xl mt-4 mb-2 font-bold">Args and Output</h4>
|
||||
<table v-if="entryHasArguments()" class="w-full">
|
||||
|
||||
@@ -43,36 +43,3 @@
|
||||
.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
|
||||
}
|
||||
|
||||
.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; }
|
||||
}
|
||||
@@ -11,8 +11,7 @@ import { ref } from 'vue';
|
||||
const xml = ref(new Array<TabData>);
|
||||
const query = ref('');
|
||||
const version = ref('');
|
||||
const engine = ref('')
|
||||
const activeTabId = ref(0)
|
||||
const params = ref<{ name: string }[]>([]);
|
||||
|
||||
function updateVersion(newVersion: string) {
|
||||
version.value = newVersion;
|
||||
@@ -24,10 +23,10 @@ function updateVersion(newVersion: string) {
|
||||
<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 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>
|
||||
<xmlInputFieldComponent stylized-name="XSLT" :data="query" v-model="query"></xmlInputFieldComponent>
|
||||
<xmlTabbedInputComponent stylized-name="XML" :tab-count-limit="3" v-model="xml"></xmlTabbedInputComponent>
|
||||
<xmlInputFieldComponent stylized-name="XSLT" :data="query" v-model:params="params" v-model="query"></xmlInputFieldComponent>
|
||||
</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>
|
||||
<TooltipComponent tool-type="xslt" :version="version"></TooltipComponent>
|
||||
</div>
|
||||
|
||||
@@ -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.*
|
||||
@@ -1,10 +0,0 @@
|
||||
---
|
||||
|
||||
name: "Feature request template"
|
||||
about: "This template is for requesting features"
|
||||
title: "Feature request"
|
||||
|
||||
---
|
||||
|
||||
## Feature Request
|
||||
*Describe the feature you’d like to see and why it’s useful.*
|
||||
Reference in New Issue
Block a user