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

Re: Tokenize comma separated string in XSL

Subject: Re: Tokenize comma separated string in XSL
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 21 Mar 2007 12:19:37 +0100
Re:  Tokenize comma separated string in XSL
Lalit.Chanchlani@xxxxxxxxxxxxxxxxxx wrote:
Hi All,
I have a comma-separated string like ABC,DEF,GHI which I want to
tokenize and return to a template which retrieves separately its
corresponding code from a XML input.
What version of XSLT are you using?

In XSLT 2, this is:

<xsl:for-each select="tokenize($your_input, ',')" >
   <Description value="{.}" />
</xsl:for-each>

In XSLT 1, use a recursive template call with substring-before and substring-after to "walk" through the string.

The output should be:

<AllCodes>
<Code value = "A">
<Description="ABC">
your output is not valid XML and as such is not (easily) possible with XSLT. I assume you meant something else?

Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

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.