This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: IF in a variable declaration
- From: "J.Pietschmann" <j3322ptm at yahoo dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 17 May 2002 02:29:09 +0200
- Subject: Re: [xsl] IF in a variable declaration
- References: <3CE3B4B1.9070902@netcourrier.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
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