Reputation: 11
I'm having a lot of problems trying to display my XML in my XSL page. The table is not displaying the content at all. It works fine in a preview but when I actually load the page nothing is displayed in the table.
XSL :
<?xml version="1.0" encoding="iso-8859-1"?><!-- DWXMLSource="XML.xml" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>XML</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<div id="header">
<div>
<div class="logo">
</div>
</div>
<table width="568" height="133" border="1" align="center">
<xsl:for-each select="movie-List/movie">
<tr>
<td><xsl:value-of select="name"/></td>
</tr>
<tr>
<td><xsl:value-of select="price"/></td>
</tr>
<tr>
<td><xsl:value-of select="genre"/></td>
</tr>
<tr>
<td><xsl:value-of select="age"/></td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
</xsl:for-each>
</table>
<div id="footer">
<div class="clearfix">
<p>
©2014 All Rights Reserved for Josh Entertainment </p>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XML :
<?xml version="1.0" encoding="iso-8859-1"?>
<movie-List>
<movie>
<name> Birdemic: Shock and Terror </name>
<price> £15 </price>
<genre> Horror </genre>
<age> 2010 </age>
</movie>
<movie>
<name> Overboard </name>
<price> £5 </price>
<genre> Drama</genre>
<age> 1987 </age>
</movie>
<movie>
<name> Going Overboard </name>
<price> £20 </price>
<genre> Comedy</genre>
<age>1989 </age>
</movie>
<movie>
<name> Marvin's Room </name>
<price> £3 </price>
<genre> Drama </genre>
<age> 1996 </age>
</movie>
<movie>
<name> Iron Sky </name>
<price> £30 </price>
<genre> Horror Comedy </genre>
<age> 2012 </age>
</movie>
<movie>
<name> Quills </name>
<price> £1.99 </price>
<genre> Romantic </genre>
<age> 2000 </age>
</movie>
<movie>
<name> The Machinist </name>
<price> £11.99 </price>
<genre> Crime </genre>
<age> 2004 </age>
</movie>
<movie>
<name> Swimming With Sharks </name>
<price> £9.99 </price>
<genre> Comedy </genre>
<age> 1994 </age>
</movie>
</movie-List>
Any help is appreciated!
Upvotes: 0
Views: 1361
Reputation: 22617
Change
<div class="logo">
to
<div class="logo"/>
Then, the transformation works with Saxon 9.5 and viewing the HTML output with Firefox. This might be a typo in your post only, though.
This is the output I get (please comment if this is not what you expected - to let us know what the real problem is):
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8"></meta>
<title>XML</title>
<link rel="stylesheet" href="css/style.css" type="text/css"></link>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta>
</head>
<body>
<div id="header">
<div>
<div class="logo"></div>
</div>
</div>
<table width="568" height="133" border="1" align="center">
<tr>
<td> Birdemic: Shock and Terror </td>
</tr>
<tr>
<td> £15 </td>
</tr>
<tr>
<td> Horror </td>
</tr>
<tr>
<td> 2010 </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td> Overboard </td>
</tr>
<tr>
<td> £5 </td>
</tr>
<tr>
<td> Drama</td>
</tr>
<tr>
<td> 1987 </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td> Going Overboard </td>
</tr>
<tr>
<td> £20 </td>
</tr>
<tr>
<td> Comedy</td>
</tr>
<tr>
<td>1989 </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td> Marvin's Room </td>
</tr>
<tr>
<td> £3 </td>
</tr>
<tr>
<td> Drama </td>
</tr>
<tr>
<td> 1996 </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td> Iron Sky </td>
</tr>
<tr>
<td> £30 </td>
</tr>
<tr>
<td> Horror Comedy </td>
</tr>
<tr>
<td> 2012 </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td> Quills </td>
</tr>
<tr>
<td> £1.99 </td>
</tr>
<tr>
<td> Romantic </td>
</tr>
<tr>
<td> 2000 </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td> The Machinist </td>
</tr>
<tr>
<td> £11.99 </td>
</tr>
<tr>
<td> Crime </td>
</tr>
<tr>
<td> 2004 </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td> Swimming With Sharks </td>
</tr>
<tr>
<td> £9.99 </td>
</tr>
<tr>
<td> Comedy </td>
</tr>
<tr>
<td> 1994 </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
</tr>
</table>
<div id="footer">
<div class="clearfix">
<p>
©2014 All Rights Reserved for Josh Entertainment
</p>
</div>
</div>
</body>
</html>
Upvotes: 1