[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Isolate spezial text term with pattern

Subject: Re: Isolate spezial text term with pattern
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Mon, 25 Jul 2005 19:47:00 -0500
string isolate
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.