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

Re: substrings and identical numbers

Subject: Re: substrings and identical numbers
From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Date: Wed, 9 May 2001 09:41:01 -0700 (PDT)
xsl parse comma formatted numbers
>a_a_20_20

Your problem is no different that parsing comma or semicolon 
seperated values.

Here is my general advice:

If you have to parse a limited number of known elements (and you
don't have any escaping of characters) you can use the following
approach:

<xsl:variable name="item1" select="substring-before($string,$seperator)"/>
<xsl:variable name="rest1" select="substring-after($string,$seperator)"/>

<xsl:variable name="item2" select="substring-before($rest1,$seperator)"/>
<xsl:variable name="rest2" select="substring-after($rest1,$seperator)"/>

<xsl:variable name="item3" select="substring-before($rest2,$seperator)"/>
<xsl:variable name="rest3" select="substring-after($rest2,$seperator)"/>

If you have to parse a variable number of elements or if you have
any type of escaping of characters, you need to write an custom
iterative solution.

If you need any type of random access to the i'th token in your string,
or if you will do anything more than make one pass on the data, you
are better off preprocessing you  XML to retag your string:

<info>
 <item1>a</item1>
 <item2>a</item2> 
 <item3>20</item3>
 <item4>20</item4>
</info>

Hope that helps. Regards,

Dan

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.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.