Subject: Re: expression comparing node and variable
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Tue, 20 Jun 2000 17:43:07 -0400
|
Laura Price wrote:
>
> I'm probably overlooking something simple here... i hope.
The problem is that in your first test you are testing for
the value of section when you are already inside the section
element. You want to use '.'. Corrections and hints follow.
> I have this variable:
> <xsl:variable name="currentsection">other stuff</xsl:variable>
If you want to store a string in a variable, it's probably safer
to use (and quicker to parse) something like this
<xsl:variable name="currentsection" select="'other stuff'" />
Then use <xsl:otherwise> to avoid the second test. If you want
the <section> element in your output, use <xsl:copy-of> to
copy the selected node (in this case .) and all of its children.
> <xsl:for-each select="section">
> <xsl:choose>
> <xsl:when test=". = $currentsection">
> <highlight><xsl:copy-of select="."/></highlight>
> </xsl:when>
> <xsl:otherwise>
> <xsl:copy-of select="."/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:for each
Hope this helps.
--
Warren Hedley
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|