M
Martin Collins
Hi,
I am trying to develop a stand alone application to run under IE6.
I have the following xml file sample.xml:
<?xml version="1.0" encoding="UTF-8"?>
<cardset>
<card>
<name>Arrest</name>
<cost>2W</cost>
</card>
</cardset>
I have the following xsl file sample.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet>
<xsl:template match="/">
<xsl:for-each select="cardset/card">
<div>
<span><xsl:value-of select="name"/></span>
<span><xsl:value-of select="cost"/></span>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I have the following html file sample.htm
<html>
<head>
<script type="text/javascript">
function doit() {
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("sample.xml")
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("sample.xsl")
// Transform
var e = document.getElementById("thebox")
e.innerHTML = xml.transformNode(xsl)
//alert(xml.transformNode(xsl))
}
</script>
</head>
<body>
<form><input type="button" value="Do it" onClick="doit()"></form>
<p id="thebox"></p>
</body>
</html>
What I am trying to do is open the html file click the button then have the
output of the transformed xml file sent to the innerHTML of the paragragh.
I can't seem to get it to work. Any thoughts or comments on how to get this
working would be greatly appreciated.
I am trying to develop a stand alone application to run under IE6.
I have the following xml file sample.xml:
<?xml version="1.0" encoding="UTF-8"?>
<cardset>
<card>
<name>Arrest</name>
<cost>2W</cost>
</card>
</cardset>
I have the following xsl file sample.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet>
<xsl:template match="/">
<xsl:for-each select="cardset/card">
<div>
<span><xsl:value-of select="name"/></span>
<span><xsl:value-of select="cost"/></span>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I have the following html file sample.htm
<html>
<head>
<script type="text/javascript">
function doit() {
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("sample.xml")
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("sample.xsl")
// Transform
var e = document.getElementById("thebox")
e.innerHTML = xml.transformNode(xsl)
//alert(xml.transformNode(xsl))
}
</script>
</head>
<body>
<form><input type="button" value="Do it" onClick="doit()"></form>
<p id="thebox"></p>
</body>
</html>
What I am trying to do is open the html file click the button then have the
output of the transformed xml file sent to the innerHTML of the paragragh.
I can't seem to get it to work. Any thoughts or comments on how to get this
working would be greatly appreciated.