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

Re: string question

Subject: Re: string question
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 21 Feb 2001 13:10:16 +0000
Re:  string question
Hi David,

>>From this xml (those IP persons might recognize this):
> <b310>08/773,384</b310>
>
> I need:
> PR_08/773,384 PR_08 PR_773 PR_384
>
> Basically, all punctuation (and spaces) are "segment" delimiters. Starting
> with entire content, each segment is then prefixed with PR_. Any help would
> be greatly appreciated.

Assuming that your strings are always of the form:

  DD/DDD,DDD

(where D is a digit) you could use:

PR_<xsl:value-of select="b310" />
PR_<xsl:value-of select="substring(b310, 1, 2)" />
PR_<xsl:value-of select="substring(b310, 4, 3)" />
PR_<xsl:value-of select="substring(b310, 8, 3)" />

If the lengths of the different parts of the strings can vary, then
you need to use substring-before() and substring-after():

PR_<xsl:value-of select="b310" />
PR_<xsl:value-of select="substring-before(b310, '/')" />
PR_<xsl:value-of select="substring-before(
                           substring-after(b310, '/'), ',')" />
PR_<xsl:value-of select="substring-after(
                           substring-after(b310, '/'), ',')" />

If there can be more parts to the string, then you need a recursive
solution.  If that's the case, then can you write a general pattern
for the string, and we'll try to work something out?
                           
I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.