Re: [xsl] Regex in @select Escaping Puzzle

Subject: Re: [xsl] Regex in @select Escaping Puzzle
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 16 Aug 2020 17:01:25 -0000
On Sun, 2020-08-16 at 15:43 +0000, Eliot Kimber ekimber@xxxxxxxxxxxx
wrote:
> 
> <xsl:analyze-string select="."
> regex="\{{\{{image_.+}}(.+)\{{\{{/image}}}}">

Remember that the attribute is an attribute value template so curly
braces are special.

Best is probably,

<xsl:variable as="xs:string" name="regex"
  select="\{\{image_100\}\}GEO_AS_MC_M01_T02_05.eps\{\{/image\}\}" />

<xsl:analyze-string regex="{ $regex }" select="." />

I sometimes write [{] and [}] for braces - and the same for parens - as
it's hard to remember which regex syntaxes treat \{ as special and
which are the other way round!


-- 
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread