1 <xsl:stylesheet version=
"1.0" xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
2 xmlns:
xhtml=
"http://www.w3.org/1999/xhtml"
3 xmlns=
"http://www.w3.org/1999/xhtml"
4 xmlns:
xs=
"http://www.w3.org/2001/XMLSchema"
5 exclude-result-prefixes=
"xhtml xsl xs">
6 <xsl:output method=
"xml" omit-xml-declaration=
"yes"/>
7 <xsl:template match=
"xhtml:html">
11 <xsl:apply-templates select=
"//xhtml:body/xhtml:span" />
13 <xsl:apply-templates select=
"//xhtml:template//xhtml:span" />
14 <p>This tests that XSLT transforms can traverse into XHTML template element content when applying XSL template.
15 If the test succeeds, the transform will have swapped the position of the body spans (A and B) with the template content spans (C and D)
16 and replaced the spans with divs.
</p>
18 if (window.testRunner)
19 testRunner.dumpAsText();
21 function divChildTextNodes(parent) {
24 for (var child = parent.firstChild; child; child = child.nextSibling) {
25 if (child.tagName == 'div') {
26 output += child.textContent;
33 var span = document.body.appendChild(document.createElement('span'));
34 span.textContent = 'Body divs: ' + divChildTextNodes(document.body);
36 span = document.body.appendChild(document.createElement('span'));
37 var template = document.querySelector('template');
38 span.textContent = ', Template content divs: ' + divChildTextNodes(template.content);
43 <xsl:template match=
"xhtml:span">
44 <div><xsl:value-of select=
"text()" /></div>