chandima
10-09-2003, 06:16 PM
Hi there,
I want to display some address data in HTML page using XSL. I can use xml file to display in the HTML page. But, I want to do the same thing using XML Island embedded in to HTML ("XMLID" xml portion in the below HTML code)
I want to use loadXML() (as in the below ProcessXML1()), how ca I convert this "XMLID" xml island to a string?
function ProcessXML1() {
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmlDoc.async = false;
xmlDoc.resolveExternals = false;
xmlDoc.loadXML("<customer><first_name>Joe</first_name><last_name>Smith</last_name></customer>");
if (xmlDoc.parseError.errorCode <> 0) {
var myErr = xmlDoc.parseError
alert("You have error " + myErr.reason);
}
}
Thanks in advance,
Chandima
<html>
<head>
<body>
<xml id="XMLID">
<?xml version="1.0" ?>
<Address>
<name> ABC
<phone>1234</phone>
<cell>111111</cell>
</name>
<name>EFG
<phone>77777777</phone>
<cell>99999999 </cell>
</name>
</Address>
</xml>
<script language="JavaScript">
function ProcessXML() {
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
//xml.load("addresses.xml") -- This works fine, but I want to use above XML Island instead of this addresses.xml file
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("addresses.xsl")
// Transform
document.write(xml.transformNode(xsl))
}
</script>
<input type="button" onClick=ProcessXML()>
</body>
</html>
I want to display some address data in HTML page using XSL. I can use xml file to display in the HTML page. But, I want to do the same thing using XML Island embedded in to HTML ("XMLID" xml portion in the below HTML code)
I want to use loadXML() (as in the below ProcessXML1()), how ca I convert this "XMLID" xml island to a string?
function ProcessXML1() {
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmlDoc.async = false;
xmlDoc.resolveExternals = false;
xmlDoc.loadXML("<customer><first_name>Joe</first_name><last_name>Smith</last_name></customer>");
if (xmlDoc.parseError.errorCode <> 0) {
var myErr = xmlDoc.parseError
alert("You have error " + myErr.reason);
}
}
Thanks in advance,
Chandima
<html>
<head>
<body>
<xml id="XMLID">
<?xml version="1.0" ?>
<Address>
<name> ABC
<phone>1234</phone>
<cell>111111</cell>
</name>
<name>EFG
<phone>77777777</phone>
<cell>99999999 </cell>
</name>
</Address>
</xml>
<script language="JavaScript">
function ProcessXML() {
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
//xml.load("addresses.xml") -- This works fine, but I want to use above XML Island instead of this addresses.xml file
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("addresses.xsl")
// Transform
document.write(xml.transformNode(xsl))
}
</script>
<input type="button" onClick=ProcessXML()>
</body>
</html>