Database Reference
In-Depth Information
(: some function body here:)
}
Within eXist, annotations are also used for RESTXQ (see “Building Applications with
RESTXQ” on page 215 ).
Serialization
eXist now supports the new XQuery 3.0 manner of controlling serialization. For
instance, this:
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization" ;
declare option output:method "xml" ;
declare option output:media-type "text/xml" ;
is exactly the same as (eXist's incumbent nonstandard mechanism):
declare option exist:serialize "method=xml media-type=text/xml" ;
The options supported are the same also. More about serialization and the full list of
options supported can be found in “Controlling Serialization” on page 119 .
The group by clause
eXist has had an order by clause for its FLWOR expressions since 2006. Unfortu‐
nately, this was not compatible with the XQuery 3.0 group by clause, and so it was
replaced in the 2.0 release with the official version. Here is an example:
let $ data as element ()* := (
<item> Apples </item> ,
<item> Bananas </item> ,
<item> Apricots </item> ,
<item> Pears </item> ,
<item> Brambles </item>
)
return
<GroupedItems>
{
for $ item in $ data
group by $ key := upper-case ( substring ( $ item , 1 , 1 ))
order by $ key
return
<Group key = "{ $ key }" >
{ $ item }
</Group>
}
</GroupedItems>
The fruits are grouped and sorted based upon the uppercased first characters of their
names. This returns:
Search WWH ::




Custom Search