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

Re: Re: xsl--accessing a speciic part of a string

Subject: Re: Re: xsl--accessing a speciic part of a string
From: "james walker" <jameswalkerandy@xxxxxxxxxxx>
Date: Thu, 02 Oct 2003 15:09:07 +0100
select part of string
Is it possible just to take off the last 4 characters from the string instead as it may be "- CP1" or "- CP2" OR "- CP3"?


From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Re: xsl--accessing a speciic part of a string
Date: Thu, 2 Oct 2003 14:25:08 +0200

"james walker" <jameswalkerandy@xxxxxxxxxxx> wrote in message
news:Law9-F104b2zrhQTZ9v000077fd@xxxxxxxxxxxxxx
> When in template match=prod, I wanted to pull out the value "wanted text"
> which will change according to what prod its under. However, the structure
> of the <text> tags under some <prod> elements are different:
>
> The first example, i need to select the value of "wanted text" within
prod:
>
> <prod position="1.1.1">
> <entrydata columnnumber="6">
> <text>wanted text - cp1</text></entrydata>
> </prod>
>
> The second example, i need to select "wanted text" from the first text tag
> within prod:
>
> <prod position="1.1.1">
> <entrydata columnnumber="6">
> <textlist><text>wanted text - cp1</text><text>wanted text
> -cp2</text></textlist></entrydata>
> </prod>
>
> is their one select statement that could cater for either of these
> situations?? I assume to remove "-cp1" i need to use the string function
> substring before? There will be instances when "wanted text" may have a
> hyphen in anyway.


Use:

substring-before(descendant::text[1], '-')



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




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



_________________________________________________________________ Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile


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.