Thank you for reading my question.
I have the following xml and xsl files.
There are two things that I would like:
1) add the doc types or whatever I need to do so that it validates at
http://validator.w3.org/2) if the parameter being passed does not have sub elements (i.e. <xsl:if test="subheading1"> ) the page renders fine, otherwise, I get an error saying :
rror Type:
msxml3.dll (0x80004005)
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document.
Here is the code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" omit-xml-declaration="yes"
/>
<xsl:param name="fname" select="'test'"/>
<xsl:template match="/">
<ul class="clsMainNav">
<xsl:for-each select="/navigation/headin
g">
<li>
<xsl:choose>
<xsl:when test="url=$fname">
<a href="{normalize-space(url
)}"><img src="images/NavArrow.gif" style="border: none; margin-left: 5px; valign: middle;" alt="-" /><xsl:value-of select="text"/></a>
<xsl:if test="subheading1">
<ul class="clsSubNav1">
<xsl:for-each select="subheading1">
<li>
<xsl:choose>
<xsl:when test="urlsub1= $fname">
<a href="{normalize-space(url
sub1)}"><i
mg src="images/NavArrow.gif" style="border: none; margin-left: 5px; valign: middle;" alt="-" /><xsl:value-of select="textsub1"/></a>
</xsl:when>
<xsl:otherwise>
<a href="{normalize-space(url
sub1)}"><i
mg src="images/NavBlank.gif" style="border: none; margin-left: 5px; valign: middle;" alt="-" /><xsl:value-of select="textsub1"/></a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<a href="{normalize-space(url
)}"><img src="images/NavBlank.gif" style="border: none; margin-left: 5px; valign: middle;" alt="-" /><xsl:value-of select="text"/></a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="ISO-8859-1"?>
<navigation>
<heading>
<text>Home</text>
<url>index.asp</url>
</heading>
<heading>
<text>About Us</text>
<url>pages/about.asp</url>
<subheading1>
<textsub1>Mission Statement</textsub1>
<urlsub1>pages/missionstat
ement.asp<
/urlsub1>
</subheading1>
<subheading1>
<textsub1>By Laws</textsub1>
<urlsub1>pages/bylaws.asp<
/urlsub1>
</subheading1>
</heading>
<heading>
<text>Events</text>
<url>pages/events.asp</url
>
</heading>
<heading>
<text>Forum</text>
<url>pages/forum.asp</url>
</heading>
<heading>
<text>Resources</text>
<url>pages/resources.asp</
url>
<subheading1>
<textsub1>Medieval</textsu
b1>
<urlsub1>pages/medieval.as
p</urlsub1
>
</subheading1>
<subheading1>
<textsub1>Renaissance</tex
tsub1>
<urlsub1>pages/renaissance
.asp</urls
ub1>
</subheading1>
<subheading1>
<textsub1>Baroque</textsub
1>
<urlsub1>pages/baroque.asp
</urlsub1>
</subheading1>
<subheading1>
<textsub1>18th Century</textsub1>
<urlsub1>pages/eighteenthc
entury.asp
</urlsub1>
</subheading1>
<subheading1>
<textsub1>19th Century</textsub1>
<urlsub1>pages/nineteenthc
entury..as
p</urlsub1
>
</subheading1>
</heading>
<heading>
<text>Archives</text>
<url>pages/archives.asp</u
rl>
</heading>
</navigation>
Thanks again,
FtB
Start Free Trial