This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: XPath 2.0: Collection-Valued Expressions (Was: Re: XQuery 1.0 and XPath 2.0 Functions and Operators Version 1.0)


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]