[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: expression comparing node and variable
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|