Subject: Re: [xsl] Isolate spezial text term with pattern From: Jon Gorman <jonathan.gorman@xxxxxxxxx> Date: Mon, 25 Jul 2005 19:47:00 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Isolate spezial text term, KrustyDerClown | Thread | [xsl] Copy element referenced to, Taco Fleur \(@DataBr |
Re: [xsl] Isolate spezial text term, KrustyDerClown | Date | [xsl] Copy element referenced to, Taco Fleur \(@DataBr |
Month |