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

Re: Comparing comma seperated string in XSLT

Subject: Re: Comparing comma seperated string in XSLT
From: Peter Flynn <peter@xxxxxxxxxxx>
Date: 04 May 2003 12:16:23 +0100
xsl comma seperated string
On Sun, 2003-05-04 at 01:41, Girish Savadatti wrote:
> Hello,
> 
> I am passing a parameter to XSLT which is comma
> seperated value. e.g. depts = 1,2,3,4,5
> 
> XML source is 
> 
> <metaData>
>   <docTitle>FooBar News</docTitle>
>   <url>FooBar.html</url>
>   <departments>22,2,23,236</departments>
> </metaData>
> 
> Here any one deparment from depts string matches in
> departments element then I want to to display this
> News on the page. 
> 
> i.e. use string tokenizer on depts string get one
> department and then do contains on <departments> 
> 
> Is it possible to do using XSLT?

Mike Brown has posted useful links for this on using substring-before
and substring-after with recursion.

Whenever I see a question of this type, I am reminded of the function
in PPL (the 4GL inside the P-Stat package)

	[IF ANY (expr1) IN (expr2), action...]

where <exprn> could be anything from a couple of variable names to an
arbitrarily complex expression containing -- in this case -- string-
split operations. This provides a feature of rather high productivity
as it replaces a quite large amount of user code each time, although
the implicit nested loop is linearly expensive for large numbers of
values generated by the expressions. 

Is there a policy for XSLT >1.1 on what level of function-bloat
people are likely to tolerate? I'm not suggesting this particular one
should be included, but I'm interested to know what people feel is
a good way to measure what should go in and what should not.

///Peter



 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.