[xquery-talk] How to retrieve Sequence of atomic values?
mhk at mhk.me.uk
Mon Feb 20 15:06:39 PST 2006
> Sorry if this question is too simple, but I didn't found an
> answer yet:
> How is it possible to handle an element:
> <test>1 2 3 4</test>
> as sequence of atomic types (xs:integer) in an XQuery?
If there's a schema that describes the element's type as being a sequence if
integers, then atomizing the element node (which usually happens implicitly)
will automatically yield the content in this form. For example, sum(test) in
your example will be 10.
If there's no schema then you need to do the conversion by hand, e.g. as
for $i in tokenize(test, ' ') return xs:integer($i)
More information about the talk