xsl-list
[Top] [All Lists]

RE: simple matching problem

2003-03-29 02:39:24
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="//*[(_at_)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="//*[(_at_)task=$nextTask]">
        @TASK = <xsl:value-of select="@task" />
</xsl:for-each>

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


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



<Prev in Thread] Current Thread [Next in Thread>