[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: [xsl] Any likely prospect of lookahead/ lookbehind regex support in future XPath/XSLT?
From: "David Sewell dsewell@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 May 2014 16:26:03 -0000

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@xxxxxxxxxxxx   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/


Current Thread
Keywords