Subject: Re: [xsl] xsl:analyze-string and multiple matching groups From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Wed, 01 Feb 2012 16:07:19 +0100 |
Let's say I have a string of the form "a:b;c:d;" where there can be any number of sub-parts of the form "x:y;", that I'd like to parse using xsl:analyze-string. With the following regex:
^(([a-z]):([a-z]);)+$
which matches indeed, I cannot use the regex-groups to retrieve all values. For instance the following:
<xsl:analyze-string select="'a:b;c:d;'" regex="^(([a-z]):([a-z]);)+$"> <xsl:matching-substring> <group num="0" value="{ regex-group(0) }"/> <group num="1" value="{ regex-group(1) }"/> <group num="2" value="{ regex-group(2) }"/>
Are my expectations wrong? If yes why? And if yes, is there any general solution to this problem? (by "general", I mean not recursing on the string and using substring on ';' because here this is a simple delimiter)
<xsl:analyze-string select="'a:b;c:d;'" regex="([a-z]):([a-z]);"> <xsl:matching-substring> <!-- now access groups here --> </xsl:matching-substring> </xsl:analyze-string>
Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl:analyze-string and multip, Florent Georges | Thread | Re: [xsl] xsl:analyze-string and mu, Michael Kay |
[xsl] xsl:analyze-string and multip, Florent Georges | Date | Re: [xsl] xsl:analyze-string and mu, Michael Kay |
Month |