xml_newbie
07-08-2010, 08:43 AM
Hi all, very new to XML, i am unable to store and recall hyperlinks from XML, I have the following code;
XML;
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Table>
<Row>
<JobTitle>Doctor</JobTitle>
<Training>Fire</Training>
<Frequency>Every 12 months</Frequency>
<Link>http://www.bbc.co.uk</Link>
</Row>
<Row>
<JobTitle>Doctor</JobTitle>
<Training>Safe Prescribing</Training>
<Frequency>Every 12 months</Frequency>
<Link>http://www.bbc.co.uk</Link>
</Row>
</Table>
-------
XSL;
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<table border="2" bgcolor="yellow">
<tr>
<th>JobTitle</th>
<th>Training</th>
<th>Link</th>
</tr>
<xsl:for-each select="Table/Row[JobTitle='Doctor']">
<tr>
<td><xsl:value-of select="Training"/></td>
<td><xsl:value-of select="Frequency"/></td>
<td><xsl:value-of select="Link"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-------
HTML;
<html>
<body>
<script language="javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("jobs.xml")
// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("jobs.xsl")
// Transform
document.write(xml.transformNode(xsl))
</script>
</body>
</html>
------
The HTML just shows the links as text not active links.
Please could someone kindly explain where i am going wrong, all help very much appreciated:D
XML;
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Table>
<Row>
<JobTitle>Doctor</JobTitle>
<Training>Fire</Training>
<Frequency>Every 12 months</Frequency>
<Link>http://www.bbc.co.uk</Link>
</Row>
<Row>
<JobTitle>Doctor</JobTitle>
<Training>Safe Prescribing</Training>
<Frequency>Every 12 months</Frequency>
<Link>http://www.bbc.co.uk</Link>
</Row>
</Table>
-------
XSL;
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<table border="2" bgcolor="yellow">
<tr>
<th>JobTitle</th>
<th>Training</th>
<th>Link</th>
</tr>
<xsl:for-each select="Table/Row[JobTitle='Doctor']">
<tr>
<td><xsl:value-of select="Training"/></td>
<td><xsl:value-of select="Frequency"/></td>
<td><xsl:value-of select="Link"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-------
HTML;
<html>
<body>
<script language="javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("jobs.xml")
// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("jobs.xsl")
// Transform
document.write(xml.transformNode(xsl))
</script>
</body>
</html>
------
The HTML just shows the links as text not active links.
Please could someone kindly explain where i am going wrong, all help very much appreciated:D