[xquery-talk] XQuery treatment of xs:positiveInteger?
David Sewell
dsewell at virginia.edu
Tue Jul 20 00:31:29 PDT 2004
Given the following XQuery code:
declare namespace my = "uri:foo";
declare function my:simple-add($x as xs:positiveInteger,
$y as xs:positiveInteger) as xs:positiveInteger
{ $x + $y };
my:simple-add(2, 3)
Shouldn't this happily produce '5' for output, as it would if the data
types were all xs:integer?
I get complaints about argument type when I run this on three different
XQuery processors. For example, Saxon 8:
"Required type of first argument of my:simple-add()
is xs:positiveInteger; supplied value has type xs:integer"
How can '2' not be interpreted as xs:positiveInteger? (Adding a "+"
before the arguments doesn't make a difference.)
Am I missing something totally obvious about use of derived data types,
or is this a parser bug?
David
--
David Sewell, Editorial and Technical Manager
Electronic Imprint, The University of Virginia Press
PO Box 400318, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: dsewell at virginia.edu Tel: +1 434 924 9973
More information about the talk
mailing list