[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XPath 2.0: Collection-Valued Expressions (Was: Re:

Subject: RE: XPath 2.0: Collection-Valued Expressions (Was: Re: XQuery 1.0 and XPath 2.0 Functions and Operators Version 1.0)
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Sun, 9 Sep 2001 00:03:59 +0100
xpath 2.0 sort
> Thanks (and to Evan) for illustrating this syntax. It's made it clear
> to me that for xf:sum(), xf:min(), xf:max() and xf:avg() you need a
> two-step process - build the new sequence, then use that as the
> argument to the function. If we're allowed to write our own functions
> in XSLT 2.0 then we don't even need extended XPath expressions like
> the above, aside from for concision/readability.
>
> However, I don't think it's a viable approach for functions that need
> to return the original values from the sequence, such as xf:sort() and
> xf:value-distinct.

I agree: if you take a purely functional-programming approach, then these
things require higher order functions. XPath 2.0 is not taking a purely
functional-programming approach; where the required functionality cannot be
provided using "first-order" functions and operators, it is being provided
using special syntax in the language (either in XPath itself, or in
XSLT/XQuery). This certainly includes sorting, grouping, elimination of
duplicates, and projection.

(I'm reporting the current situation here, not expressing any views as to
whether I think it's the best approach. Personally I'm attracted by the
flexibility and composability of higher-order functions, but I don't know
whether they would be asking too much of our target user population. I also
suspect that custom syntax makes life easier for query optimizers.)

The reason for having a sort() function is primarily for sorting a sequence
of simple values, such as numbers, strings, or dates. For sorting a sequence
of nodes, more powerful syntax will usually be needed, such as xsl:sort.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.