Subject: Re: [xsl] Strings Position From: "J.Pietschmann" <j3322ptm@xxxxxxxx> Date: Tue, 25 Nov 2003 23:14:00 +0100 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Strings Position, Bruno LLopes | Thread | [xsl] Performance tuning in msxsl/m, Dipesh Khakhkhar |
Re: [xsl] Recursive walk up tree, Wendell Piez | Date | Re: [xsl] XSL - using for-each with, Rick Taylor |
Month |