carvin5string
IS-IT--Management
So here I am learning XML, just started this week with the Dummys XML book. I'm working out the examples, finding some don't work as described (see my other post for another example). This time I have an xml file and an xslt file to transform it to html. When viewed in Netscape and Mozilla I see all the text in one blob across the top of the window, the xslt formatting instructions completely ignored. In IE it gives an error:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Keyword xsl:template may not be used here.
Any suggestions on what I should be looking for to fix this problem? Or is it just the browsers don't support xslt enough yet?
Thanks,
Chip
Below is the xslt I am using, which validates as well-formed.
--
Chip
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Keyword xsl:template may not be used here.
Any suggestions on what I should be looking for to fix this problem? Or is it just the browsers don't support xslt enough yet?
Thanks,
Chip
Below is the xslt I am using, which validates as well-formed.
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] xmlns="[URL unfurl="true"]http://www.w3.org/TR/REC-html40">[/URL]
<xsl:output method="xml" encoding="iso-8859-1"/>
<xsl:template match="recipe">
<html>
<head>
<title>
<xsl:value-of select="recipe/title"/>
</title>
</head>
<body>
<xsl:apply-templates/>
</body>
<xsl:template match="recipe/title">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
<xsl:template match="recipe/ingredients">
<h2>Ingredients</h2>
<ul>
<xsl:for-each select="item">
<li>
<xsl:apply-templates/>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template match="recipe/cookinginstructions">
<h2>Cooking Instuctions</h2>
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="recipe/servinginstructions">
<h2>Serving Instructions</h2>
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
</html>
</xsl:template>
</xsl:stylesheet>
--
Chip