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]

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


Hi Jim,

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.

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.

Examples of how I'd like to see it working:

Work out the total payable on a purchase order:

  xf:sum(Order/Item, xf:expression('@Price * @Quantity'))

Find the row with the most cells in it:
  
  xf:max(tr, xf:expression('count(td)'))

Sort a sequence of strings by their length:

  xf:sort('fubar foo foobar', xf:expression('string-length(.)'))

Is there a reason that this requirement isn't covered in the F&O
document?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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]