Passing variable to variable

Subject: Passing variable to variable
From: Linda van den Brink <lvdbrink@xxxxxxx>
Date: Thu, 29 Jul 1999 15:39:12 +0200

My XML file contains over 500 items belonging to different categories, some
to more than one category. A page is generated by category containing those
items belonging to that particular category. The page contains a banner
displaying the directory structure, like this: web_browser = Internet /
Browsers / Web Browsers

I want that banner to be populated, depending upon the category items within
a category belong to.

I've gotten as far as recognizing the category an item belongs to using the
XSL stylesheet submitted earlier today by G. Ken Holman. The categories with
their respective items are properly generated, but the banner remains the

I was thinking that it might be possible to pass on the <xsl:variable> that
selects the category element, to another variable that assigns the processor
the correct string (Internet / Browsers / Web Browsers). Is it possible
doing this without having to completely redesign my current stylesheet?


BTW, this is my current stylesheet:


<xsl:template match="/">                              <!--root rule-->
	<xsl:for-each select="//item">           <!--process all people-->
		<xsl:sort select="category"/>
		<xsl:variable name="cat" select="category"/>
		<!--process only one entry per sorted year-->
		<xsl:if test="not(preceding-sibling::item[category=$cat])">
select="$cat"/></title><link rel="stylesheet" type="text/css"
href="../../../styles/intro.css"></link><script language="JavaScript"
language="JavaScript">function hideAll(itemPrefix){for ( var i = 1; i &lt;=
<xsl:number value="count(//item[category=$cat])"/>; i++){hideItem(itemPrefix
+ i);}}</script></head><body><table class="bannerList"><tr><td
class="bannerList"><xsl:value-of select="$cat"/>s</td></tr></table><table
style="margin-top: 30px;"><tr><td colspan="2"><h4 style="margin-bottom:
10px">Application</h4></td><td colspan="1">	<h4 style="margin-bottom:
10px">Description</h4>	</td>	</tr><tr><td class="left" colspan="2"><ul
			<!--reselect only those in the given year-->
					<xsl:element name="a">
name="href">javascript:showItem('item<xsl:number value="position()"
select="name"/>&#160;<xsl:apply-templates select="version"/></li>
			</ul></td><td class="right">
					<xsl:sort select="name"/>
					<xsl:element name="div">
name="id">item<xsl:number value="position()" format="1"/></xsl:attribute>
select="name"/>&#160;<xsl:apply-templates select="version"/></h4>


 XSL-List info and archive:

Current Thread