[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Converting SSI variables to XML
Hi Tom,
Looking at your data, I'd recommend one of two approaches: 1. Make the conversion a two step process. You CDATA section closely resembles something that looks like XML to me, turning it into XML will give you a document that you can process more easily in the second step. This seems to be the approach you took. 2. Using the regular expression approach, you can turn the CDATA section into a node-set and traverse over the contents of this node-set using normal XSLT. This is a one-pass approach (meaning: it will need only one xslt processing call) and I normally use it that way. On your problem with getting the number out. It appears as if it always has something *without* a dot at the end and the number itself will consist of only numbers. The easiest (?) way to extract the number is using replace() function: <xsl:value-of select="replace ( @name , '^.*\.([0-9]+)\.[^.]+$', '$1' ) " /> In human language this says: ^.+ from the start of the string, one or more chars \. then a dot ([0-9]+) grab one or more digits and place it in $1 \. followed by a dot [^.]+ followed by one ore more non-dots $ till the end of the string '$1' replaces the whole string between the anchors ^ and $ with the number. Hope this helps, Cheers, Abel Braaksma http://abelleba.metacarpus.com tom tom wrote: Hi all, I wish to turn the following CDATA input:
|
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
|