RE: XPath 2.0: Collection-Valued Expressions (Was: Re:
> One thing that seems to be missing from the F&O WD is support for > XPath 2.0 Requirement 2.5 "Should Support Aggregation Functions Over > Collection-Valued Expressions". > > There are frequently cases where it would be useful to evaluate an > expression to use for calculating sums, maxima, minima, averages, sort > values and so on. We currently have to use case-specific templates or > something along the lines of Dimitre's generic templates to do this > kind of thing. The current intention is to do this with special syntax, not with a higher-order function; this puts it outside the scope of the F&O document. As you'll see from the published data model, there is no current intention to support functions or expressions as a data type in the language. So there's likely to be syntax akin to XQuery's sum(for $i in //item return $i/@price * $i/@qty) We've also been toying with extending path expressions: sum(//item/(@price*@qty)) but that causes backwards-compatibility difficulties that we haven't solved yet. > > Tied in with this is the oft-requested functionality of being able to > dynamically evaluate a string as an XPath. Put these together, and an > expression data type along the lines of the one in Saxon seems like a > good idea. There is an aim to have a much more rigorous type system in XQuery and XPath 2.0 than is present in XPath 1.0, with much more scope for static type checking and optimization. Unfortunately this makes the addition of dynamic features to the language, such as the ability to create expressions from strings, rather more difficult. Although this feature is much wanted, there was an explicit decision not to include it in the XSLT 2.0 or XPath 2.0 requirements. Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format