summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/xslt/sort.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/dom/xslt/sort.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/dom/xslt/sort.html')
-rw-r--r--testing/web-platform/tests/dom/xslt/sort.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/xslt/sort.html b/testing/web-platform/tests/dom/xslt/sort.html
new file mode 100644
index 0000000000..631c3edd6a
--- /dev/null
+++ b/testing/web-platform/tests/dom/xslt/sort.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<link rel=match href="sort-ref.html">
+
+<body>
+ <div id="container"></div>
+</body>
+
+<script type="text/xml" id="sampleXml">
+ <root>
+ <node id="1" />
+ <node id="7" />
+ <node id="3" />
+ <node id="2" />
+ </root>
+</script>
+
+<script type="text/xml" id="sampleXsl">
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
+
+ <xsl:template match="/">
+ <xsl:apply-templates select="//node">
+ <xsl:sort select="@id" data-type="number" />
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="node">
+ <div>
+ <xsl:value-of select="@id"/>
+ </div>
+ </xsl:template>
+
+ </xsl:stylesheet>
+</script>
+
+<script>
+ let parser = new DOMParser();
+ const xslStyleSheet = parser.parseFromString(document.getElementById('sampleXsl').textContent, 'text/xml');
+
+ const xsltProcessor = new XSLTProcessor();
+ xsltProcessor.importStylesheet(xslStyleSheet);
+
+ parser = new DOMParser();
+ const xmlDoc = parser.parseFromString(document.getElementById('sampleXml').textContent, 'text/xml');
+
+ const fragment = xsltProcessor.transformToFragment(xmlDoc, document);
+
+ document.getElementById('container').appendChild(fragment);
+</script>