xsl-list
[Top] [All Lists]

Re: [xsl] Any likely prospect of lookahead/ lookbehind regex support in future XPath/XSLT?

2014-05-16 13:01:26
It does no harm to ask. Raise the request as a formal comment on the XPath 3.1 
specification.

I don't think anyone will object on principle, provided that the extension is 
well-defined in terms of Unicode, easy to specify, and widely available in 
regex libraries. They may object on the grounds of resources and timescales.

Michael Kay
Saxonica

On 16 May 2014, at 17:26, David Sewell dsewell(_at_)virginia(_dot_)edu 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

I'm guessing that the answer is going to be "no", but am just wondering 
whether there has been discussion of extending the standard regular 
expression support in XPath to include lookahead and lookbehind assertions 
(both positive and negative). I'm also guessing that this could be more than 
a little tricky for implementors.

Every now and then I find cases where replacement or xsl:analyze-string are 
made hugely easier by availability of those features. For example, at the 
moment I'm doing a transform to convert text like

 VIII, 9, 150 n. 4, 179-80 and n. 3

into something like

<num value="8">VIII</num>, <num n="pg">9</num>, <num n="pg">150</num> n. 4, 
<num n="pg">179-80</num> and n. 3

so that I can create links to the pages and page ranges. It's a lot more 
straightforward to do via xsl:analyze-string when I can use a negative 
lookbehind assertion to ignore numerals preceded by "n. ".

I appreciate the ability to do this in Saxon via an (unsupported) extension, 
but having it part of the standard would mean less worry about whether code 
that works now might not work later.

David

-- 
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400314, Charlottesville, VA 22904-4314 USA
Email: dsewell(_at_)virginia(_dot_)edu   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/

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