Subject: Re: [xsl] substrings and identical numbers From: Dan Diebolt <dandiebolt@xxxxxxxxx> Date: Wed, 9 May 2001 09:41:01 -0700 (PDT) |
>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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] substrings and identical , Jeni Tennison | Thread | [no subject], Stephane . Le-Deaut |
RE: [xsl] Developing an image brows, Richard Lander | Date | [xsl] How generate encoding="ISO-88, Cristobal Galiano Fe |
Month |