[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Isolate spezial text term with pattern
Hi Oliver, > But i want only PB123. > With the function substring-after i get "PB123 Rest of the Comment". > > Any solution ? Errr, well, since I have no clue what the "Rest of the comment" actually contains it's a little hard to guess. If you're using an XSLT 2.0 processor, you can try a regular expression. Not really going to bother trying to figure out how to do the regular expression in XSLT 2.0 since I haven't done it before. I think there's some examples in the spec chapter 15 (http://www.w3.org/TR/xslt20/#regular-expressions). On the other hand, if your text is regular enough that it is deliminated by at the end of the sequence (say a space) you could do some more string chunking. My example improved a bit (and with correct quotations this time I think) <xsl:template match="comment"> <td>PB<xsl:value-of select='substring-before(substring-after(.,"PB")," ")' /></td> </xsl:template> This writes out PB, then gets everything after the PB (string x), everything before the space in string x (string y), and writes string y. If either the above suggests don't work, I think it would be far more helpful to see a small but complete example of the XML. Also any details like restrictions in processor choice, languages, development environment might help. Jon Gorman
|
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
|