xsl-list
[Top] [All Lists]

Re: [xsl] A better xsl:analyze-string

2009-08-20 21:17:11
On Thu, Aug 20, 2009 at 5:29 PM, Michael 
Sokolov<sokolov(_at_)ifactory(_dot_)com> wrote:
I like the avoidance of the clumsy numbered capture groups, (my non-starting
proposal would be to add perl capture variables ala $1,$2,$3,$@,$'$`,etc...)

But how would you retrieve the value of the matching subgroup (the decimal
portion) in:
<xsl:matching-substring regex="\d+(\.\d*)?">

Same way as you can do it now: regex-group(1). The only difference is
that group indices are local for each matching-substring/@regex.

In general, however, in scenarios where you'd typically use this, you
would not care about subgroups. See below.

There's something asymmetric about your proposal that bothers me.  There are
other cases of combining multiple capture groups that wouldn't get the same
special treatment (like the nesting in the example).  Why assume that
capture groups are always combined as (...)|(...)?  It's a very special
case: is it so common as to warrant special syntax?

It is definitely a special case, but I believe it is a fairly common
and broad one: it is a general-purpose tokenizing lexer, the analog of
lex/flex in XSLT.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>