Re: [xsl] Split string and assign result to variables

Subject: Re: [xsl] Split string and assign result to variables
From: Markus Abt <abt@xxxxxxxx>
Date: Tue, 30 Aug 2011 18:53:35 +0200
You can use something like this:

<xsl:variable name="input">string1/string2/string3</xsl:variable>
<xsl:variable name="var1" select="substring-before($input, '/')"/>
<xsl:variable name="var2" select="substring-before(substring-after($input, '/'), '/')"/>
<xsl:variable name="var3" select="substring-after(substring-after($input, '/'), '/')"/>

Cheers,
Markus


----------
Von: 	Lighton Phiri
Gesendet: 	Dienstag, 30. August 2011 18:24
An: 	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: 	[xsl] Split string and assign result to variables

I am using xslt 1.0 and trying to split a string into three chunks and
then assign them to individual variables. I came across a useful way
of splitting up strings here
dpawson.co.uk/xsl/sect2/StringReplace[DOT]html
However, I cannot seem to find a reliable resource on how I can
dynamically assign variables to the resulting chunks.

A sample string would be as depicted below.
string1/string2/string3

--
------------------------------
Lighton Phiri
http://lightonphiri.org/
------------------------------

Current Thread