Hello and thank you for reading my question.
I am creating an xml based menu system, and my goal is to have selected main headings display with a graphic and selected sub headings displayed in bold. The idea is that if the user selects a sub heading, it should be bolded and the subheadings parent heading should display the graphic.
My xsl looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" omit-xml-declaration="yes"
/>
<xsl:param name="fname" select="'test'"/>
<xsl:template match="/">
<xsl:for-each select="/navigation/headin
g">
<xsl:choose>
<xsl:when test="name(child::node())=
$fname">
<span style="vertical-align:midd
le">
<a href="{normalize-space(url
)}"><img src="{graphic}" style="border: none;" alt="-" ></img></a>
</span>
</xsl:when>
<xsl:otherwise>
<ul class="clsMainNav">
<span style="vertical-align:midd
le">
<li><a href="{normalize-space(url
)}"><xsl:v
alue-of select="text"/></a></li>
</span>
</ul>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="subheading1[normaliz
e-space(ur
lsub1) = $fname] or (subheading1 and normalize-space(url) = $fname)">
<ul class="clsSubNav1">
<xsl:for-each select="subheading1">
<xsl:choose>
<xsl:when test="urlsub1= $fname">
<li><a href="{normalize-space(url
sub1)}"><s
pan style="font-weight: 900;"><xsl:value-of select="textsub1"/></span>
</a></li>
</xsl:when>
<xsl:otherwise>
<li> <a href="{normalize-space(url
sub1)}"><x
sl:value-o
f select="textsub1"/></a></l
i>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
and a bit of the xml looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<navigation>
<heading>
<text>Home</text>
<url>index.asp</url>
</heading>
<heading>
<text>About Us</text>
<url>about.asp</url>
<graphic>nav_aboutus.jpg</
graphic>
<subheading1>
<textsub1>HQ at a Glance</textsub1>
<urlsub1>about_hqataglance
.asp</urls
ub1>
</subheading1>
<subheading1>
<textsub1>Mission and History</textsub1>
<urlsub1>about_missionandh
istory.asp
</urlsub1>
</subheading1>
<subheading1>
<textsub1>News and Publications</textsub1>
<urlsub1>about_newsandpubl
ications.a
sp</urlsub
1>
</subheading1>
<subheading1>
<textsub1>Join Our Network!</textsub1>
<urlsub1>about_joinournetw
ork.asp</u
rlsub1>
</subheading1>
</heading>
<heading>
<text>Educaton / Outreach</text>
<url>educationoutreach.asp
</url>
<graphic>nav_educationoutr
each.jpg</
graphic>
<subheading1>
<textsub1>Education</texts
ub1>
<urlsub1>educationoutreach
_education
.asp</urls
ub1>
</subheading1>
<subheading1>
<textsub1>Professional Training</textsub1>
<urlsub1>educationoutreach
_training.
asp</urlsu
b1>
</subheading1>
</heading>
</navigation>
Can someone point me in the right direction?
Thanks again,
FtB
Start Free Trial