4 Commits

Author SHA1 Message Date
62a174521d templates section done 2025-03-25 12:44:27 +01:00
4311f56712 wip: working examples, need to fill more data 2025-03-06 16:08:23 +01:00
8ebfa77424 change links to w3c 2025-03-04 17:22:41 +01:00
5bc89fc514 xalan_libxml_issue#283 (#299)
Reviewed-on: #299
Reviewed-by: Wojciech Szewczyk <szewczyw@noreply.example.com>
2025-02-11 17:48:46 +01:00
5 changed files with 379 additions and 265 deletions

View File

@@ -79,11 +79,13 @@ 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

View File

@@ -61,6 +61,13 @@ 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 {
throw new UnsupportedOperationException("Xalan does not support multiple files XSLT processing");
@@ -101,7 +108,10 @@ public class Xalan implements XmlEngine{
for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) {
resultString.append(nn.getNodeValue());
}
} else {
} else if (isAttributeNode(n)) {
resultString.append(n.getNodeValue());
}
else {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream)));
resultString.append(outputStream);

View File

@@ -28,8 +28,12 @@
"description":"Specifies a numeric priority for this template."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/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",
"output": "XML Tree"
},{
"name": "<xsl:apply-templates>",
@@ -47,8 +51,12 @@
"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."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/apply-templates",
"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",
"output": "XML Nodes"
},{
"name": "<xsl:apply-imports/>",
@@ -56,8 +64,12 @@
"attributes":
[
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/apply-imports",
"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",
"output": "Imported output from another XSLT"
},{
"name": "<xsl:call-template>",
@@ -70,8 +82,12 @@
"description":"Specifies the name of the template you wish to invoke."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/call-template",
"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",
"output": "Called template XML"
},{
"name": "<xsl:next-match>",
@@ -80,8 +96,12 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/next-match.html",
"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",
"output": "Choosed XML template"
},{
"name": "<xsl:mode>",
@@ -144,8 +164,12 @@
"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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/mode.html",
"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=\"'&#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"
},{
"name": "<xsl:override>",
@@ -154,8 +178,12 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/override.html",
"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",
"output": "Appears as a child of xsl:use-package."
},{
"name": "<xsl:package>",
@@ -233,8 +261,12 @@
"description":"Determines the namespace used for any unprefixed element name or type name within an XPath expression."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/package.html",
"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",
"output": "Appears as a child of xsl:use-package."
},{
"name": "<xsl:accept>",
@@ -257,8 +289,12 @@
"description":"Determines the potential visibility of the selected components."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accept.html",
"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",
"output": "Appears as a child of xsl:use-package."
},{
"name": "<xsl:global-context-item>",
@@ -276,8 +312,12 @@
"description":"Specifies whether a stylesheet module requires a global context item; the default is optional."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/global-context-item.html",
"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",
"output": "Global context item"
}
]
@@ -297,8 +337,8 @@
"description":"XPath expression that specifies the nodes to be processed."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/for-each",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-for-each",
"output": "Processed set of nodes"
},
{
@@ -312,8 +352,8 @@
"description":"Contains an XPath expression that can be evaluated to a Boolean value."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/if",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-if",
"output": "Depending on test processed template or not."
},
{
@@ -323,8 +363,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/choose",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-choose",
"output": "Choosed XML template"
},
{
@@ -338,8 +378,8 @@
"description":"Boolean expression to be evaluated. If true, the contents of the element are processed; if false, they are ignored."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/when",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-when",
"output": "Processed or not XML Template"
},
{
@@ -349,8 +389,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/otherwise",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-otherwise",
"output": "processed XML Template"
},
{
@@ -399,8 +439,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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/for-each-group.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-for-each-group",
"output": "processed XML Template"
},
{
@@ -414,8 +454,8 @@
"description":"Expression to select nodes/values."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/iterate.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-iterate",
"output": "processed XML Template"
},
{
@@ -429,8 +469,8 @@
"description":"The effect of the instruction may be defined either by a select attribute, or by an enclosed sequence constructor. "
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/break.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-break",
"output": "processed XML Template"
},
{
@@ -440,8 +480,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/next-iteration.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-next-iteration",
"output": "processed XML Template"
},
{
@@ -455,8 +495,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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-completion.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-completion",
"output": "processed XML Template"
},
{
@@ -466,8 +506,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/fork.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-fork",
"output": "processed XML Template"
},
{
@@ -481,8 +521,8 @@
"description":"The value to be output when the containing sequence constructor would otherwise deliver an empty result."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-empty.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-empty",
"output": "processed XML Template"
},
{
@@ -496,8 +536,8 @@
"description":"The value to be output when the containing sequence constructor delivers a non-empty result."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/on-non-empty.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-on-non-empty",
"output": "processed XML Template"
},
{
@@ -516,8 +556,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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/try.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-try",
"output": "processed XML Template"
},
{
@@ -536,8 +576,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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/try.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-try",
"output": "processed XML Template"
},
{
@@ -556,8 +596,8 @@
"description":"Specifies whether a template requires a context item; the default is optional."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/context-item.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-context-item",
"output": "processed XML Template"
}
]
@@ -582,8 +622,8 @@
"description":"Defines the namespace URI for this attribute in the output document."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/attribute",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-attribute",
"output": "XML Element with provided attribute"
},{
"name": "<xsl:attribute-set>",
@@ -601,8 +641,8 @@
"description":"Builds an attribute set from other attribute sets. The names of the contributing sets must be separated with whitespace characters"
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/attribute-set",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-attribute-set",
"output": "Named set of attributes"
},{
"name": "<xsl:copy>",
@@ -615,8 +655,8 @@
"description":"Lists attribute sets that should be applied to the output node, if it is an element"
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/copy",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-copy",
"output": "Copy of XML node"
},{
"name": "<xsl:number>",
@@ -669,8 +709,8 @@
"description":"Indicates the number of digits that make up a numeric group."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/number",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-number",
"output": "Formatted number"
},{
"name": "<xsl:value-of>",
@@ -688,8 +728,8 @@
"description":"Specifies whether special characters are escaped when written to the output."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/value-of",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-value-of",
"output": "Value from XML nodes"
},{
"name": "<xsl:text>",
@@ -702,8 +742,8 @@
"description":"Specifies whether special characters are escaped when written to the output."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/text",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-text",
"output": "XML Node with writed text"
},{
"name": "<xsl:comment>",
@@ -711,8 +751,8 @@
"attributes":
[
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/comment",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-comment",
"output": "XML Node with writed comment"
},
{
@@ -726,8 +766,8 @@
"description":"Specifies the name of this processing instruction."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/processing-instruction",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-processing-instruction",
"output": "XML Node with output of processed instruction"
},
{
@@ -751,8 +791,8 @@
"description":"Specifies an XPath expression that will be used to determine the value of the key for each of the applicable nodes."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/key",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-key",
"output": "key to use in stylesheet"
},
{
@@ -816,8 +856,8 @@
"description":"Specifies the character separating positive and negative subpatterns in a format pattern."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/decimal-format",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-decimal-format",
"output": "decimal format"
},
{
@@ -831,8 +871,8 @@
"description":"Specifies the elements for which whitespace should be preserved."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/preserve-space",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-preserve-space",
"output": "preserved space"
},
{
@@ -846,8 +886,8 @@
"description":"Specifies the elements for which whitespace should be preserved."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/strip-space",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-strip-space",
"output": "elements with removed whitespace"
},
{
@@ -881,8 +921,8 @@
"description":"Defines whether items are to be ordered alphabetically or numerically."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/sort",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-sort",
"output": "sorted elements"
},
{
@@ -926,8 +966,8 @@
"description":"Lists elements whose text contents should be written as CDATA sections."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/output",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-output",
"output": "changed document prefix"
},
{
@@ -1086,8 +1126,8 @@
"description":"The default for Saxon-EE is yes, which causes the instruction to be evaluated in a separate thread"
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/result-document.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-result-document",
"output": "XML Document"
},{
"name": "<xsl:character-map>",
@@ -1105,8 +1145,8 @@
"description":"Character maps may be assembled from other character maps using the use-character-maps attribute."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/character-map.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-character-map",
"output": "named character map"
},{
"name": "<xsl:output-character>",
@@ -1124,8 +1164,8 @@
"description":"Any string, that replaces the specified character during serialization."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/output-character.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-output-character",
"output": "defined character"
},{
"name": "<xsl:merge>",
@@ -1134,8 +1174,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge",
"output": "merged files"
},{
"name": "<xsl:merge-action>",
@@ -1144,8 +1184,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-action.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-action",
"output": "merged files"
},{
"name": "<xsl:merge-key>",
@@ -1178,8 +1218,8 @@
"description":"It declares whether uppercase letters are sorted before their lowercase equivalents, or vice-versa"
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-key.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-key",
"output": "merged files"
},{
"name": "<xsl:merge-source>",
@@ -1232,8 +1272,8 @@
"description":"If specified, data read from this merge source is validated against the named schema type."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/merge-source.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-merge-source",
"output": "merged files"
}
]
@@ -1303,8 +1343,8 @@
"description":"Specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an XPath expression."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/stylesheet",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-stylesheet",
"output": "XSLT Stylesheet"
},
{
@@ -1368,8 +1408,8 @@
"description":"Specifies the namespace that will be used if the element name is unprefixed or an unprefixed type name within an XPath expression."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/transform",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-transform",
"output": "XSLT Stylesheet"
},
{
@@ -1383,8 +1423,8 @@
"description":"Specifies the URI of the stylesheet to import."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/import",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-import",
"output": "XSLT Stylesheet from another file"
},
{
@@ -1398,8 +1438,8 @@
"description":"Specifies the URI of the stylesheet to import."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/include",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-include",
"output": "XSLT Stylesheet with XSLT from another file."
},
{
@@ -1418,8 +1458,8 @@
"description":"Specifies the desired namespace for the output tree."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/namespace-alias",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias",
"output": "XML Tree with changed namespaces"
},
{
@@ -1443,8 +1483,8 @@
"description":"A whitespace-separated list of attribute-set element names to be applied to the element element's output element."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/namespace-alias",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias",
"output": "XML with provided element"
}
]
@@ -1469,8 +1509,8 @@
"description":"Uses an XPath expression to provide a default value if none is specified."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/param",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-param",
"output": "XML parameter"
},
{
@@ -1489,8 +1529,8 @@
"description":"Defines the value of the variable through an XPath expression. If the element contains a template, this attribute is ignored."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/variable",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-variable",
"output": "XML Variable"
},
{
@@ -1509,8 +1549,8 @@
"description":"Defines the value of the parameter through an XPath expression. If the element contains a template, this attribute is ignored."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/with-param",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-with-param",
"output": "XML Parameter"
},
{
@@ -1524,8 +1564,8 @@
"description":"Uses an XPath expression that specifies what is to be copied."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/copy-of",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-copy-of",
"output": "Copy of Selected node"
},
{
@@ -1544,8 +1584,8 @@
"description":"Determines what happens to any type annotations on element or attribute nodes"
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/document.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-document",
"output": "Document Node"
},
{
@@ -1564,8 +1604,8 @@
"description":"The string value of the namespace node"
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/namespace.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace",
"output": "Namespace Node"
},
{
@@ -1584,8 +1624,8 @@
"description":"The namespace prefix used in the result document."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/namespace-alias.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-namespace-alias",
"output": "Document with changed namespaces"
},
{
@@ -1599,8 +1639,8 @@
"description":"Specifies the input."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/sequence.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-sequence",
"output": "Sequence"
}
]
@@ -1630,8 +1670,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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/analyze-string.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-analyze-string",
"output": "XML Node"
},
{
@@ -1641,8 +1681,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/matching-substring.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-matching-substring",
"output": "XML Node"
},
{
@@ -1652,8 +1692,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/non-matching-substring.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-non-matching-substring",
"output": "XML Node"
}
]
@@ -1713,8 +1753,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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/function.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-function",
"output": "Function"
},
{
@@ -1763,8 +1803,8 @@
"description":"The value of the attribute is an expression that evaluates to a map."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/evaluate.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-evaluate",
"output": "String"
},
{
@@ -1788,8 +1828,8 @@
"description":"Specifies the error code associated with the error message produced when the assertion is false."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/assert.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-assert",
"output": "Error or nothing"
}
]
@@ -1809,8 +1849,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."
}
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/message",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-message",
"output": "Message in console"
},
{
@@ -1819,8 +1859,8 @@
"attributes":
[
],
"examples": [],
"documentationReferenceURL": "https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/fallback",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-fallback",
"output": "Fallbacks"
},
{
@@ -1834,8 +1874,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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/map.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-map",
"output": "Map"
},
{
@@ -1854,8 +1894,8 @@
"description":"The associated value can be defined either by a select attribute or by an enclosed sequence constructor."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/map-entry.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-map-entry",
"output": "Singleton Map"
},
{
@@ -1879,8 +1919,8 @@
"description":"Determines the external visibility of the selected components."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/expose.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-expose",
"output": "Element with changed visibility"
},
{
@@ -1914,8 +1954,8 @@
"description":"Causes a trace message to be output (to the Configuration's Logger) whenever the value of the accumulator changes."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accumulator.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accumulator",
"output": "Accumulator"
},
{
@@ -1944,8 +1984,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."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accumulator-rule.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accumulator-rule",
"output": "Accumulator"
},
{
@@ -1999,8 +2039,8 @@
"description":"Controls whether XInclude processing takes place."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/source-document.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-source-document",
"output": "Processed Document"
},
{
@@ -2019,8 +2059,8 @@
"description":"The version of the named package to be used. The default is *, which matches any version. "
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/use-package.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-use-package",
"output": "Package"
},
{
@@ -2030,8 +2070,8 @@
[
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/where-populated.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-where-populated",
"output": "checks for children"
},
{
@@ -2055,8 +2095,8 @@
"description":"Determines the potential visibility of the selected components."
}
],
"examples": [],
"documentationReferenceURL": "https://www.saxonica.com/html/documentation12/xsl-elements/accept.html",
"xsltExamples": [],
"documentationReferenceURL": "https://www.w3.org/TR/xslt-30/#element-accept",
"output": "restricts visibility"
}
]

View File

@@ -7,6 +7,8 @@ const props = defineProps({
tool:{type: String, required:true}
})
const activeIndex = ref<number | null>(null)
function toggleTooltips() {
isEntryHidden.value = !isEntryHidden.value;
}
@@ -20,8 +22,16 @@ 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);
@@ -47,7 +57,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" @click="toggleTooltips()">{{ props.entryData.name }}</button>
<button :class="{ 'mb-2' : !isEntryHidden }" class="dark:text-slate-100 hover:font-bold overflow-auto" @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">
@@ -55,6 +65,29 @@ 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">

View File

@@ -47,3 +47,32 @@
.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; }
}