xsl-list
[Top] [All Lists]

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

2011-08-30 12:14:38
@Markus: Thank you very much I wonder why I never thought about this *SMH*
@Andrew Welch: I believe I left out that little important detail --I
am using xsltproc

On 30 August 2011 18:53, Markus Abt <abt(_at_)comet(_dot_)de> wrote:
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(_at_)lists(_dot_)mulberrytech(_dot_)com
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/
------------------------------

--~------------------------------------------------------------------
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>
--~--





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

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>