[Home] [By Thread] [By Date] [Recent Entries]
On 02/05/2015 22:53, John Lumley john@xxxxxxxxxxxx wrote: ... I'd suggest that one of the most elegant would be written in XSLT in the following manner:
I'm talking about 'focheck' at XML London in June. 1. XPath string expressions are parsed with Gunther Rademacher's parser-generated parser, which of course has been projected to generate XSLT 2.0 code.
2. The resulting XPath parse tree (which is now an XML tree) is interpreted against a context node by a series of XSLT push templates matching each of the XPath EBNF productionsE7, internal (local variable) state being held in a map transmitted as a tunnelled variable. Calls to built-in functions are mapped to calls to the built-in functions in the executing XSLT implementation.
3. The resulting sequence of the evaluation is produced by the result of the topmost parse match. Yep. Of course as this is executed in an XSLT environment, the evaluation of all XPath expressions required to evaluate the XPath expression, including those used in the parser, are executed by an XPath evaluator that is written entirely in XSLT.
The tension for 'focheck', where the parsing is meant to run as an adjunct to Schematron checking in an editor, is over how many FO functions to fully implement rather that just return an <Object/>, since the more complete the parsing is, the slower it will be. However, thanks to memorising expression results, any expression is only slow once. ... I can't see anything else being as 'elegant' as that.....
Regards,
|

Cart



