[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Strings Position


Subject: Re: [xsl] Strings Position
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Tue, 25 Nov 2003 23:14:00 +0100

Bruno LLopes wrote:
I have a string for exemple '00643cam 022002291 04500'
and I need look at every position of the string a see if each element
has the correct value...
How can  I shift the string position by position?

I'm not quite sure what your question is. If you want to split your string at certain positions, use substring(), for example <xsl:variable name="part1" select="substring($str,1,8)"/> If you want to split the string at certain characters, use substring-before() and substring-after(), like in <xsl:variable name="part1" select="substring-before($str,' ')"/>

If the string contains multiple parts, you can program unrolled code,
like
 <xsl:variable name="part1" select="substring-before($str,' ')"/>
 <xsl:variable name="tail1" select="substring-after($str,' ')"/>
 <xsl:variable name="part2" select="substring-before($tail1,' ')"/>
 <xsl:variable name="tail2" select="substring-after($tail1,' ')"/>
or use a recursive template as described in the XSL FAQ:
 http://www.dpawson.co.uk/xsl/sect2/N7240.html#d8065e280

J.Pietschmann


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




Current Thread
Keywords
xsl