xsl-list
[Top] [All Lists]

Re: [xsl] Analyze-string Regex to Match Content within Curly Braces

2020-11-17 08:31:11
On Tue, Nov 17, 2020 at 01:57:30PM -0000, Michael Kay 
mike(_at_)saxonica(_dot_)com scripsit:
A suggestion that I've thought about from time to time:

If an attribute in XSLT expects an expression or an AVT, then a leading 
undoubled "}" in the attribute value indicates that is to be treated as a 
plain string.

So for an expression

<xsl:param name="x" select="}O'Reilly"/>

indicates that the default value is the string "O'Reilly"

and in an AVT

regex="}[a-z]{4}"

indicates that the regex is [a-z]{4}

This relies on the fact that neither an AVT nor an expression can legally 
begin with an undoubled "}", nor is it ever likely to. And you can think of 
"}" as meaning "exit expression mode, here is plain text".

Nice idea, or just too quirky?

Perhaps more terse than quirky?

Like David, I'd prefer to see switchable AVT interpretation via an
attribute.  Single leading undoubled close brace is going to look like
a mistake to my brain.

What's the opposite of template?  "literal" is wrong,
xsl:analyze-string/@regex still gets interpreted, just differently.

@select-not-template or @regex-not-template as booleans?

-- 
Graydon Saunders  | graydonish(_at_)gmail(_dot_)com
Þæs oferéode, ðisses swá mæg.
-- Deor  ("That passed, so may this.")
--~----------------------------------------------------------------
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>