Re: [xsl] IF in a variable declaration

Subject: Re: [xsl] IF in a variable declaration
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 17 May 2002 02:29:09 +0200
Xavier DAMAY wrote:
In fact i've got a list of numbers enclosed in <pdf> tags and i want to set the variable "present" with O if the number i search for is present
<xsl:variable name="present">
<xsl:for-each select="/liste/id/compte/pdf">
<xsl:if test="/liste/id/compte/pdf=$ID">O</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="$present"/>

The test test="/liste/id/compte/pdf=$ID" will succeed if there is at least one of the pdf elements with a content equal to value of $ID. This seems to be exactly what you ask for. Try:

   <xsl:variable name="present">
      <xsl:if test="/liste/id/compte/pdf=$ID">O</xsl:if>
   </xsl:variable>

J.Pietschmann


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



Current Thread