Subject: Re: [xsl] analyze-string regex From: John Lumley <john@xxxxxxxxxxxx> Date: Fri, 28 Mar 2014 10:29:36 +0000 |
However, another approach I have seen is to build the regular expression methodically, for example with a sequence of variables:another advantage of this technique, when using <xsl:analyze-string> is that you can reuse the definitions within a choose inside matching-substring, e.g.
<xsl:variable name="number">\d+</xsl:variable> <xsl:variable name="string">"[^"]*"</xsl:variable> <xsl:vairable name="number-or-string" select="{$number}|{$string}"/>
<xsl:analyze-string select="." regex="{$number-or-string}"> <xsl:matching-substring> <xsl:choose> <xsl:when test="matches(.,$number)">...... <xsl:when test="matches(.,$string)">......
-- *John Lumley* MA PhD CEng FIEE john@xxxxxxxxxxxx <mailto:john@xxxxxxxxxxxx> on behalf of Saxonica Ltd
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] analyze-string regex, Michael Kay | Thread | Re: [xsl] analyze-string regex, Abel Braaksma (Exsel |
Re: [xsl] analyze-string regex, Michael Kay | Date | Re: [xsl] XSLT Hello World - outrea, David Rudel |
Month |