xsl-list
[Top] [All Lists]

Re: [xsl] Getting text from string

2011-11-03 11:28:29
I used the following:

<xsl:variable name="varPath" select="string-join(tokenize(@path,
'/')[position() ne last()], '/')"/>


On Thu, Nov 3, 2011 at 8:21 AM, Andrew Welch 
<andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> wrote:
On 3 November 2011 12:04, Stan Mikita <markev8(_at_)gmail(_dot_)com> wrote:
Thanks!

Is it also possible to use the tokenize to retrieve the following?

Input: @path = "dir1/dir2/dir3/dir4/filename"

Output: @path = "dir1/dir2/dir3/dir4"

Yep, tokenize(@path, '/') will return a sequence of strings, 'dir1',
'dir'2 etc, everything except the string used to split them.

You can then rejoin them using string-join($tokens[position() ne last()], '/')


--
Andrew Welch
http://andrewjwelch.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--