[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Getting text from string
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.j.welch@xxxxxxxxx> wrote: > On 3 November 2011 12:04, Stan Mikita <markev8@xxxxxxxxx> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|