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')
21 processor
.setParameter(null, 'testParam', 'text with spaces')
22 var result
= processor
.transformToFragment(sourceDoc
, document
);
23 if (result
.textContent
!= 'text with spaces')
26 processor
.setParameter(null, 'testParam', 'Shakespeare\'s "Twelfth Night"')
27 var result
= processor
.transformToFragment(sourceDoc
, document
);
28 if (result
.textContent
!= 'Shakespeare\'s "Twelfth Night"')
31 document
.getElementById('result').innerHTML
= 'SUCCESS';
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>