Click to See Complete Forum and Search --> : help with simple ISLAND example


boim
02-12-2003, 12:43 PM
Hi
i have this simple XML file.

i cant manage to show its data on a simple HTML file with the data island way.

can someone please please show me an example with this XML file???

khalidali63
02-12-2003, 12:47 PM
what are you trying to do in this file?
I do not see any code but a plain xml file????


Khalid

boim
02-12-2003, 02:05 PM
you are right
this is a plain xml file.

i want to make an HTML file that reads THAT XML FILE.

please write me how i can do that (or even better post an example..)

khalidali63
02-12-2003, 10:31 PM
var xmlDoc = document.all("writersXML").XMLDocument;
var xmlStr = "";
function displayTree(){
var parentNode = xmlDoc.documentElement;
xmlStr+="top most parent ["+parentNode.nodeName+"]<br>";
parseXML(parentNode);
document.getElementById("displayXML").innerHTML = xmlStr;
}



you will need to write parseXML function to go through the rest of the parentNode childNodes so that it can make a sense for u.

cheers

Khalid

BilEde
02-23-2003, 07:03 PM
I have been trying xhtml with xml data islands. Save it as an html file.

<html>
<head><title>PM Report</title>
<script lanuage="JavaScript">
function window.onload(){
xslTarget.outerHTML = xmlData.transformNode(xslStyle.documentElement);
}
</script>

</head>
<body>
<DIV id="xslTarget">Division here</DIV>

<xml id="xslStyle">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<table width="100%" border="1">
<tr>
<td>Name</td>
<td>MPN</td>
<td>Model</td>
<td>Description</td>
<td>Price</td>
<td>Suplier</td>
</tr>
<xsl:for-each select="Items/Item">
<tr>
<td> <xsl:value-of select="Name" /> </td>
<td> <xsl:value-of select="MPN" /> </td>
<td> <xsl:value-of select="Model" /> </td>
<td> <xsl:value-of select="ShtDescription" /> </td>
<td> <xsl:value-of select="Price" /> </td>
<td> <xsl:value-of select="Supplier" /> </td>
</tr>
</xsl:for-each>
</table>

</xsl:template>

</xsl:stylesheet>
</xml>

<xml id="xmlData">
<Items>
<Item>
<Month>8 </Month>
<Supplier>PCWB </Supplier>
<Name>Compaq </Name>
<MPN>470021-219 </MPN>
<Model>Evo D500</Model>
<ShtDescription>P4 1.7GHz,256Mb,20Gb,CD,W2K/XPP </ShtDescription>
<Price>757.58 </Price>
</Item>
<Item>
<Month>8 </Month>
<Supplier>Ccenter </Supplier>
<Name>Compaq </Name>
<MPN>470021-269 </MPN>
<Model>Evo D500</Model>
<ShtDescription>P4 1.7GHz,128Mb,20Gb,CD,W98 </ShtDescription>
<Price>663.41 </Price>
</Item>
<Item>
<Month>8 </Month>
<Supplier>PCWB </Supplier>
<Name>Compaq </Name>
<MPN>470021-373 </MPN>
<Model>Evo D500</Model>
<ShtDescription>P4 1.6GHz,256MB,20Gb,CD,W2K </ShtDescription>
<Price>728.06 </Price>
</Item>
<Item>
<Month>8 </Month>
<Supplier>PCWB </Supplier>
<Name>Compaq </Name>
<MPN>470021-422 </MPN>
<Model>Evo D500 SS</Model>
<ShtDescription>P4 1.7GHz,128MB,20GB,CD,W2K/XPP </ShtDescription>
<Price>695.99 </Price>
</Item>
<Item>
<Month>8 </Month>
<Supplier>PCWB </Supplier>
<Name>Compaq </Name>
<MPN>470021-505 </MPN>
<Model>Evo D500 SS</Model>
<ShtDescription>P4 1.7GHz,256Mb,20Gb,CD,W2k/XPP </ShtDescription>
<Price>739.79 </Price>
</Item>
<Item>
<Month>8 </Month>
<Supplier>Ccenter </Supplier>
<Name>Compaq </Name>
<MPN>470021-531 </MPN>
<Model>Evo D500</Model>
<ShtDescription>P4 1.6GHz,128Mb,20Gb,48xCD,W98 </ShtDescription>
<Price>634.14 </Price>
</Item>
<Item>
<Month>8 </Month>
<Supplier>PCWB </Supplier>
<Name>Compaq </Name>
<MPN>470021-531 </MPN>
<Model>Evo D500</Model>
<ShtDescription>P4 1.6GHz,128Mb,20Gb,48xCD,W98 </ShtDescription>
<Price>639.52 </Price>
</Item>
<Item>
<Month>8 </Month>
<Supplier>Compaq </Supplier>
<Name>Compaq </Name>
<MPN>470021-531 </MPN>
<Model>Evo D500</Model>
<ShtDescription>P4 1.6GHz,128Mb,20Gb,48xCD,W98 </ShtDescription>
<Price>634.14 </Price>
</Item>
</Items>
</xml>

</body>
</html>