xsl-list
[Top] [All Lists]

Re: [xsl] Regex in @select Escaping Puzzle

2020-08-16 13:03:07
Thanks--Martin's solution seems like the easiest to work with and it works for 
me. I didn't even consider putting the expression into a variable to avoid the 
worst of the double escaping heck.

Cheers,

E.

--
Eliot Kimber
http://contrext.com
 

On 8/16/20, 11:15 AM, "Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

    Am 16.08.2020 um 18:06 schrieb Martin Honnen 
martin(_dot_)honnen(_at_)gmx(_dot_)de:

    > Part of the problem I think is that the "regexp" attribute of
    > "xsl:analyze-string" allows attribute value templates so you either have
    > to double curly braces or better declare your pattern as a parameter or
    > variable before the element e.g. using Michael's suggestion
    >
    >    <xsl:param name="pattern"
    > as="xs:string">\{\{image_[^}]+\}\}([^{]+)\{\{/image\}\}</xsl:param>

    And to be safe in XSLT 3 in any context you probably want

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


    otherwise the use of expand-text="yes" higher up the tree causes the
    same problem you run in with using the regular expression in the attribute.
    

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