XML file:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="biblio.xsl"?>
<bibliography>
<entry type="article">
<title>A History of MOOCs, Open Online Courses</title>
<author>Jane Karr</author>
<year>2014</year>
</entry>
<entry type="article">
<title>Apple Co-Founder Creates Electronic ID Tags</title>
<author>John Markoff</author>
<year>2003</year>
</entry>
</bibliography>
XSL file:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Bibliography Entries</h2>
<table border="1">
<xsl:for-each select="bibliography/entry">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="year"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
If I don't link the XSLT file to the XML file, my XML file will output the tree structure in my browser's page but if I do link the XSLT file, it will show a blank page.
I am using Chrome, if it helps to know.
Thanks.
I assume you are loading the XML document from the file system and in that case Chrome for security reasons does not apply the linked XSLT, unless you start it with lowered security settings. Use F12 to open the browser console and check whether Chrome shows a message explaining why the Xslt was not applied.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments