xsl-list
[Top] [All Lists]

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

2003-10-02 07:09:07
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(_at_)yahoo(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Re: xsl--accessing a speciic part of a string
Date: Thu, 2 Oct 2003 14:25:08 +0200

"james walker" <jameswalkerandy(_at_)hotmail(_dot_)com> wrote in message
news:Law9-F104b2zrhQTZ9v000077fd(_at_)hotmail(_dot_)com(_dot_)(_dot_)(_dot_)
> 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