This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: IF in a variable declaration


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]