[
Lists Home |
Date Index |
Thread Index
]
>
> > I can think of lots of scenarios where I would want my
> > get-total() function to
> > process the "merely well-formed elements whose name happens
> > to be 'invoice'".
> >
>
> I agree. I am both dissappointed and stunned that such functionality
> does not exist in XQuery.
>
Of course this functionality exists.
function getTotal (element* $nodes) {
return sum(for $x in $nodes[self::invoice] return
number($x//item/@price))
}
The fact that you are allowed to write specific types in function
signatures doesn't stop you writing generic ones if you prefer.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
|