[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Length of a variable?

Subject: Re: Length of a variable?
From: barrys@xxxxxxxxxx
Date: Thu, 16 Mar 2000 09:51:47 +0000
xsl if variable length
Nigel,

Try using

<xsl:if test="count(colour) > 0">...</xsl:if>

Regards
Stuart Barry
Chief Technical Officer
ACI Worldwide (EMEA) Ltd.
59 Clarendon Road
WATFORD
Herts WD1 1LA
United Kingdom

Tel:         +44 1923 813907
Fax:        +44 1923 813935
e-mail      barrys@xxxxxxxxxx


                                                                                                                       
                    nigel.byrnes@philips.                                                                              
                    com                          To:     <xsl-list@xxxxxxxxxxxxxxxx>                                   
                    Sent by:                     cc:                                                                   
                    owner-xsl-list@mulber        Subject:     Re: Length of a variable?                                
                    rytech.com                                                                                         
                                                                                                                       
                                                                                                                       
                    15/03/00 18:45                                                                                     
                    Please respond to                                                                                  
                    xsl-list                                                                                           
                                                                                                                       
                                                                                                                       



Problem solved from reading
http://www.xmlsoftware.com/articles/xsl-by-example.html:

<xsl:if test="not(boolean($colours))">...</xsl:if>

Nigel

Hi all

Considering a the following xml code:

<paint>
 <colour>red</colour>
 <colour>yellow</colour>
</paint>

it is possible to set the variable colours to contain both colour elements
as follows:

<xsl:variable name="colours" select="colour"/>

Further on in the stylesheet, there is to be a branch on whether $colours
contains any colur elements or not. I have tried the following expressions
without any success:

<xsl:if test="$colours[last()=0]">...</xsl:if>
<xsl:if test="$colours=''">...</xsl:if>

Does anyone have any ideas?

Thanks

Nigel
Nigel Byrnes, Philips Research
     Cross Oak Lane, Redhill. Surrey, RH1 5HA
Voice: +44 (0) 1293 815578
Fax: +44 (0) 1293 815500



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





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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.