xslt xml to html fails when DTD present



this might fall to category knowing the basics but I could not find spot on answer to this so I would appreciate push to the right direction with this.


I can see the printout in my browser (Chrome) when DTD is removed. The XML that works



<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>

<recipes>
<recipe is="test">
<ind1>Test1</ind1>
<ind2>Test2</ind2>
</recipe>
</recipes>


The XSL:



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="recipes/recipe">
<h2><xsl:value-of select="ind1"/></h2>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Fine and dandy, however with this XML it will fail producing only blank screen:



<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE recipes SYSTEM "recipes.dtd">
<recipes>
<recipe is="test">
<ind1>Test1</ind1>
<ind2>Test2</ind2>
</recipe>
</recipes>


If I understood all what I learned this far the DTD is the way to go but theres something fundamental missing and I would appreciate if you could point the elephant in the living room and help me advance.


Thank you for your time!


No comments:

Post a Comment