Datypic Logo
XQuery

XQuery

Priscilla Walmsley (pwalmsley@datypic.com)

ISBN: 1491915102

2nd edition, 2015, O'Reilly Media, Inc.

Chapter 13: Inputs and outputs

Example 13-1. Retrieving non-XML documents using uri-collection
declare function local:text-collection($uri as xs:string?) as xs:string* {
  for $doc in uri-collection($uri)
  return unparsed-text($doc)
};
Example 13-2. Output declarations
xquery version "3.0";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; 
declare option output:method "xml"; 
declare option output:indent "yes"; 
declare option output:omit-xml-declaration "yes";
Example 13-3. Specifying the name of a parameters document
xquery version "3.0";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; 
declare option output:parameter-document "parameters.xml";
Example 13-4. Serialization parameters in a separate XML document (parameters.xml)
<output:serialization-parameters
   xmlns:output = "http://www.w3.org/2010/xslt-xquery-serialization"
   xmlns:prod="http://datypic.com/prod">
  <output:method value="xml"/>
  <output:version value="1.0"/>
  <output:indent value="yes"/>
  <output:cdata-section-elements value="prod:desc"/>
  <output:use-character-maps>
    <output:character-map character="«" map-string="&lt;%"/>
    <output:character-map character="»" map-string="%&gt;"/>
  </output:use-character-maps>
</output:serialization-parameters>
Datypic XQuery Services