xsl-list
[Top] [All Lists]

Re: [xsl] Syntax error in regex pattern

2019-07-13 11:45:24
On Sat, Jul 13, 2019 at 04:32:39PM -0000, Scott Vanderbilt 
lists(_at_)datagenic(_dot_)com scripsit:
    <xsl:analyze-string select="$stringtoproc" regex="\p{L}">

It's usually safest to use the pattern:

<xsl:variable name="search" as="xs:string" select="'\p{L}'"/>
<xsl:analyze-string select="$stringtoproc" regex="{$search}">

because otherwise you have to remember the parsing rules the regex attribute is 
using.  ("Do I have to double the braces to escape them?, etc.)  I can never 
quite manage to do that, so putting the regular expression in a string variable 
is just easier.

In the specific case, because the regex attribute accepts attribute value 
templates, the braces are going to have the AVT meaning unless escaped.

-- Graydon
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>