RE: RE: [xml-dev] XQuery and DTD/Schema?

From
Michael Kay <>
To
'Dare Obasanjo' <>, 'Mike Champion' <>,
Date
2002-07-04T08:31:25Z
ID
<00a101c22335$2fac1200$6401a8c0@pcukmka>
Thread
RE: RE: [xml-dev] XQuery and DTD/Schema?
> 
> > 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: 
work: