For some reson the values "Name , Job" ect, in my xml document wont print out on the screen using this XSL file. It cant find the values. am i navigating the nodes wrongly? the files ar below :
*********XML********
<?xml version="1.0" standalone = "yes"?>
<?xml-stylesheet type="text/xsl" href="UIConfigStyle.xsl" ?>
<data>
<Person>
<Name> Kenny Birney </Name>
<Job> Programmer </Job>
<Details> This data has been transformed into HTML through xsl and formatted through JavaScript and xml </Details>
</Person>
</data>
********XSL*********
<?xml version="1.0"?>
<xsl:stylesheet version = "1.0" xmlns:xsl="<xslutput method="html"/>
<xsl:template match="/">
<html>
<head>
<title> Formatted data through xsl, 2 xml documents and Javascript </title>
</head>
<body onload = "init()" id="body">
<SCRIPT LANGUAGE="javascript">
function init()
{
testXML.async = false;
testXML.load("./ui.xml"
formatUI(testXML);
}
function formatUI(testXML)
{
i = 0;
itemElement = testXML.documentElement.childNodes.item(i);
document.bgColor = itemElement.childNodes.item(0).childNodes.item(0).nodeValue;
document.fgColor = itemElement.childNodes.item(1).childNodes.item(0).nodeValue;
document.all.body.style.fontSize= itemElement.childNodes.item(2).childNodes.item(0).nodeValue;
}
</SCRIPT>
<xsl:for-each select="data/Person">
<H1> <xsl:value-of select = ".//Name"/> </H1>
<xsl:value-of select = "Job" />
<p> <xsl:value-of select = "Details"/> </p>
</xsl:for-each>
</body>
<XML ID="testXML">
</XML>
</html>
</xsl:template>
</xsl:stylesheet>
Thanks!
*********XML********
<?xml version="1.0" standalone = "yes"?>
<?xml-stylesheet type="text/xsl" href="UIConfigStyle.xsl" ?>
<data>
<Person>
<Name> Kenny Birney </Name>
<Job> Programmer </Job>
<Details> This data has been transformed into HTML through xsl and formatted through JavaScript and xml </Details>
</Person>
</data>
********XSL*********
<?xml version="1.0"?>
<xsl:stylesheet version = "1.0" xmlns:xsl="<xslutput method="html"/>
<xsl:template match="/">
<html>
<head>
<title> Formatted data through xsl, 2 xml documents and Javascript </title>
</head>
<body onload = "init()" id="body">
<SCRIPT LANGUAGE="javascript">
function init()
{
testXML.async = false;
testXML.load("./ui.xml"
formatUI(testXML);
}
function formatUI(testXML)
{
i = 0;
itemElement = testXML.documentElement.childNodes.item(i);
document.bgColor = itemElement.childNodes.item(0).childNodes.item(0).nodeValue;
document.fgColor = itemElement.childNodes.item(1).childNodes.item(0).nodeValue;
document.all.body.style.fontSize= itemElement.childNodes.item(2).childNodes.item(0).nodeValue;
}
</SCRIPT>
<xsl:for-each select="data/Person">
<H1> <xsl:value-of select = ".//Name"/> </H1>
<xsl:value-of select = "Job" />
<p> <xsl:value-of select = "Details"/> </p>
</xsl:for-each>
</body>
<XML ID="testXML">
</XML>
</html>
</xsl:template>
</xsl:stylesheet>
Thanks!