[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Split string and assign result to variables
Subject: Re: [xsl] Split string and assign result to variables From: Lighton Phiri <lighton.phiri@xxxxxxxxx> Date: Tue, 30 Aug 2011 19:14:28 +0200 |
@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@xxxxxxxx> 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@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/ > ------------------------------ > > -- ------------------------------ Lighton Phiri http://lightonphiri.org/ ------------------------------
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Split string and assign r, Markus Abt | Thread | [xsl] Outputting Formatted XML with, Sall, Kenneth |
Re: [xsl] Split string and assign r, Markus Abt | Date | [xsl] text replacement with mixed c, Geert Bormans |
Month |
Keywords