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/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--