xsl-list
[Top] [All Lists]

Re: [xsl] XSLT Regex for Matching Curly Braces

2019-06-10 12:30:44
On 10.06.2019 19:21, Michael Kay mike(_at_)saxonica(_dot_)com wrote:


On 10 Jun 2019, at 17:56, Imsieke, Gerrit, le-tex
gerrit(_dot_)imsieke(_at_)le-tex(_dot_)de 
<mailto:gerrit(_dot_)imsieke(_at_)le-tex(_dot_)de>
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com
<mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>> wrote:

If you want to use xsl:analyze-string with XSLT 2.0 (or 3.0), you can
put the regex in a variable, like so:


 <xsl:variable name="regex" as="xs:string" select="'\{([^}]+)\}'"/>

I think it's even clearer to use

<xsl:variable name="regex" as="xs:string"
expand-text="no">{([^}]+)\}</xsl:variable>

You would still need to escape the curly brace { as \{, no?
--~----------------------------------------------------------------
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>