[Home] [By Thread] [By Date] [Recent Entries]


> 
> > 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@n...
work: Michael.Kay@s... 


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member