net_lover [Original]
The following is a simple example. Here are 2 methods:
test.htm
<SCRIPT>
//Load data
x = "<r><a name='net_lover'>aaaaaaaaaaa</a> <b>bbbbbbb</b><a>aaaaaaaaaaa</a><b>bbbbbbb</b></r>"
var source = new ActiveXObject("Msxml2.DOMDocument");
source.async = false;
source.loadXML(x)
alert(source.xml)
//Load style sheet
var stylesheet = new ActiveXObject("Msxml2.DOMDocument");
stylesheet.async = false;
stylesheet.resolveExternals = false;
stylesheet.load("style.xsl");
alert(stylesheet.xml)
//Create result object
var result = new ActiveXObject("Msxml2.DOMDocument");
result.async = false;
// Put the parsing results into the result object Method 1
source.transformNodeToObject(stylesheet, result);
alert(result.xml)
// Put the parsing results into the result object Method 2
result2 = ""
result2 = source.transformNode(stylesheet);
source.loadXML(result2)
alert(source.xml)
</SCRIPT>
style.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform ">
<xsl:output method = "xml" omit-xml-declaration = "yes" indent = "yes"/>
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>