41 lines
1.1 KiB
HTML
41 lines
1.1 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
<head>
|
|
<title/>
|
|
</head>
|
|
<body>
|
|
<p>Test importing an xsl:stylesheet node as stylesheet for XSLTProcessor.</p>
|
|
<xsl:stylesheet version="1.0">
|
|
|
|
<xsl:template match="/">
|
|
<html>
|
|
<p><xsl:apply-templates/></p>
|
|
</html>
|
|
</xsl:template>
|
|
|
|
<xsl:template match="para">
|
|
<xsl:value-of select="."/>
|
|
</xsl:template>
|
|
</xsl:stylesheet>
|
|
|
|
<para>SUCCESS</para>
|
|
<script>
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
|
|
try {
|
|
var stylesheetElement = document.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "stylesheet")[0];
|
|
var paraElement = document.getElementsByTagName("para")[0];
|
|
var proc = new XSLTProcessor;
|
|
proc.importStylesheet(stylesheetElement);
|
|
var transformationResult = proc.transformToDocument(paraElement);
|
|
document.body.removeChild(stylesheetElement);
|
|
document.body.removeChild(paraElement);
|
|
|
|
document.body.appendChild(document.adoptNode(transformationResult.firstChild));
|
|
} catch (ex) {
|
|
document.body.appendChild(document.createTextNode(ex));
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|