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

RE: Comma Separated Values - XSLT1.0

Subject: RE: Comma Separated Values - XSLT1.0
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Thu, 21 Oct 2004 12:24:23 +0300
comma separated values
Hi,

> I have 2 XML elements each containing comma separated values.
> I need to
> take each individual value from <elem2> and see if it exists
> in <elem1>. If
> true is returned, go off and do something..... otherwise get
> the next value
> from <elem2> and compare it to all the values in <elem1> etc etc.
>
> <data>
>       <elem1>bloggs,smith,jones,bush,howard,bennis</elem1>
>       <elem2>skeen,seinfield,longshaw,bloggs,keitel</elem2>
> </data>
>
>
> So the approach would be:
>
> Take 'skeen' and compare it to all the comma separated values
> in <elem1>.
> If FALSE is returned, take 'seinfield' and compare to all
> values in <elem1>
> and so on...If TRUE is returned at any stage DO SOMETHING. If
> at the end
> nothing is found, DO SOMETHING DIFFERENT......

See my reply to "RE:  [Fwd: CLARIFICATION IN XML 2 XML TRANSFORMATION]",
that contains a solution to a similar problem. What you need is to write a
recursive template that tokenizes using COMMA as a delimiter, then on each
token check if that appears in the other list, e.g. with contains(concat(',',
elem1, ','), concat(',', $token, ',')). You can find more info on recursive
templates in the FAQ.

Cheers,

Jarno

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.