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

Re: xsl:when element test with number

Subject: Re: xsl:when element test with number
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 24 Oct 2003 07:04:11 -0700 (PDT)
element test
> I have an xsl:when test that is testing for an exact element name:
> <xsl:when test="name(.)='my_element'> ...</xsl:when>
> 
> This works fine if this is all I need, but the problem is that it also 
> needs to test for the possibility of 'my_element_N' where N is any 
> positive number
> ('my_element_12' for example).  I've tried the following to account for 
> the extra underscore in the element name:
> <xsl:when test="name(.)='my_element' or starts-with(name(.),
> 'my_element_')"> ...</xsl:when>
> 
> This worked until I realized there are names such as 'my_element_data'
or
> 'my_element_information' etc. which are elements I do not want to
process
> here.
> 
> Is there a way to search for exactly 'my_element_N' using number() or 
> some other function so I can test for the possibility of 'my_element_1' 
> or 2 or 3 or 672?  Any suggestions would be appreciated! 

Use the translate() function, so that it will produce "'my_element_" from
any "'my_element_"N





=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

 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.