xsl-list
[Top] [All Lists]

Re: [xsl] Escaping Curly Braces in Regex

2009-10-01 06:47:47
rowan(_at_)sylvester-bradley(_dot_)org wrote:

But now I need to do this:
<xsl:analyze-string select="." regex="^\s*\{([^\}]+)\}\s*$">
because I need to capture the the string between the braces. In Saxon this
gives me:
 XPath syntax error at char 7 on line 43 in {^\s*\{([^}: Invalid character
'^' in expression.

What am I doing wrong this time?

That attribute regex allows an attribute value template I think so {} is supposed to have an XPath expression inside. You would need to double the curly braces or you can define a variable e.g.
  <xsl:variable name="pattern1" select="'^\s*\{([^\}]+)\}\s*$'"/>
and then use that
  <xsl:analyze-string select="." regex="{$pattern1}"/>

--

        Martin Honnen
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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