|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: substrings and identical 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








