Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / xsl / resources / xhtml-template.xsl
blob3460a443c3f78ad98feea5c1433c0bd5983fcdfd
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">
8 <html>
9 <body>
10 <template>
11 <xsl:apply-templates select="//xhtml:body/xhtml:span" />
12 </template>
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>
17 <script>
18 if (window.testRunner)
19 testRunner.dumpAsText();
21 function divChildTextNodes(parent) {
22 var output = '';
24 for (var child = parent.firstChild; child; child = child.nextSibling) {
25 if (child.tagName == 'div') {
26 output += child.textContent;
30 return output;
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);
39 </script>
40 </body>
41 </html>
42 </xsl:template>
43 <xsl:template match="xhtml:span">
44 <div><xsl:value-of select="text()" /></div>
45 </xsl:template>
46 </xsl:stylesheet>