RE: [xsl] simple matching problem

Subject: RE: [xsl] simple matching problem
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sat, 29 Mar 2003 09:39:24 -0000
> Here's another: This seems to find the element node where 
> @task = 1, but it doesn't actually write out the value of 
> @task. Why? It just writes out: @TASK =
> 
> Thanks-
>  Mac
> 
> <xsl:param name="$nextTask" select="1" />
> 
> <xsl:if test="//*[@task=$nextTask]">
> 	@TASK = <xsl:value-of select="@task" />
> </xsl:if>
> 

Your <xsl:if> tests whether an element exists satisfying certain
conditions, but it doesn't make this element the context node. To
achieve that, write:

<xsl:for-each select="//*[@task=$nextTask]">
 	@TASK = <xsl:value-of select="@task" />
</xsl:for-each>

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread