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

Re: XPath (and other W3C drafts)

Subject: Re: XPath (and other W3C drafts)
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Wed, 16 Dec 2009 15:57:14 +0000 (GMT)
Re:  XPath (and other W3C drafts)
Eliot Kimber wrote:

> At the risk of seeming dim or lazy or both, can someone
> explain the implications of these new features?

  Using 'let', you can bind
a variable directly in XPath.  There
is of course no impact on XQuery.  In
XSLT, that is sometimes
convenient to be able to write a single XPath
expression without
requiring to split it into several expressions or to write
a
stylesheet function.  And that's important too for other host
languages.
Using first-class function items, you can manipulate functions
as items.  For
instance, you can pass a function as parameter to
another function.  Think for
instance about a sorting function,
taking a function item parameter to compare
two items:

    sort(
      $seq as items()*,
      $comparator as
function($lhs as item(), $rhs as item())
    )

  You can call it like:
sort((2, 1, 3), my:less-than#2)

or even like:

    sort(
      (2, 1, 3),
function ($lhs as xs:integer, $rhs as xs:integer)
        as xs:boolean
{
        if ( $ascending ) then $lhs le $rhs else $lhs gt $rhs
      }
    )
That allow one to write higher-order functions (such a function
that takes a
function item as param or return a function item as
result).  I hope that will
boost writing of more general-purpose
libraries for XSLT and XQuery...

  Well
that's just what comes directly in mind, others can maybe
give more (and more
precise) use cases.

  Regards,

-- 
Florent Georges
http://www.fgeorges.org/

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.