|
Subject: Re: [xsl] XPath (and other W3C drafts) From: Florent Georges <lists@xxxxxxxxxxxx> Date: Wed, 16 Dec 2009 15:57:14 +0000 (GMT) |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] XPath (and other W3C draf, Eliot Kimber | Thread | Re: [xsl] XPath (and other W3C draf, Eliot Kimber |
| [xsl] XSLT is not an editor [ was: , steve.majewski@xxxxx | Date | Re: [xsl] Entities in XSLT (from XM, David Carlisle |
| Month |