Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / xsl / xslt-string-parameters.html
blob13582c3b9e93013fa0be3df0b1fc05d78e1ba189
1 <html>
2 <head>
3 <script>
4 function runTest() {
5 if (window.testRunner)
6 testRunner.dumpAsText();
8 var sourceDoc = (new DOMParser).parseFromString('<test/>', 'text/xml');
9 var sheetDoc = (new DOMParser).parseFromString('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' +
10 '<xsl:output method="text"/><xsl:param name="testParam"/>' +
11 '<xsl:template match="/test"><xsl:value-of select="$testParam"/></xsl:template></xsl:stylesheet>', 'text/xml');
13 var processor = new XSLTProcessor();
14 processor.importStylesheet(sheetDoc);
16 processor.setParameter(null, 'testParam', 'text')
17 var result = processor.transformToFragment(sourceDoc, document);
18 if (result.textContent != 'text')
19 return;
21 processor.setParameter(null, 'testParam', 'text with spaces')
22 var result = processor.transformToFragment(sourceDoc, document);
23 if (result.textContent != 'text with spaces')
24 return;
26 processor.setParameter(null, 'testParam', 'Shakespeare\'s "Twelfth Night"')
27 var result = processor.transformToFragment(sourceDoc, document);
28 if (result.textContent != 'Shakespeare\'s "Twelfth Night"')
29 return;
31 document.getElementById('result').innerHTML = 'SUCCESS';
33 </script>
34 </head>
35 <body onload="runTest()">
36 <p>This tests that passing string parameters to the XSLTProcessor works as expected. If this test is successful, the text "SUCCESS" will be shown below.</p>
37 <div id="result">FAILURE</div>
38 </body>
39 </html>