xsl-list
[Top] [All Lists]

Re: [xsl] XSLT Regex for Matching Curly Braces

2019-06-11 12:33:16


On 11.06.2019 19:26, Liam R. E. Quin liam(_at_)fromoldbooks(_dot_)org wrote:
<xsl:variable as="xs:string" name="within-braces">
     [{]      <!--* opening bace *-->
     (        <!--* $1 *-->
       [^{}]+ <!--* not containing a brace *-->
     )        <!--* end $1 *-->
     [}]      <!--* closing brace *-->
</xsl:variable>

I like this! It never came to me that I can just have text content with XML comments when defining a regex for 'x'-flag matching.


and then fn:replace($input, $within-braces, 'x'), or more likely,
   <xsl:analyze-string regex="$within-braces" flags="x" . .. . >

Correction:
regex="{$within-braces}"

There’s always something additional to point out here in pedant’s paradise, dear Liam!

Gerrit
--~----------------------------------------------------------------
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>