Previous Up Next


p:xquery

p:xquery — Performs XQuery processing.

Synopsis

<p:declare-step type="p:xquery">
     <p:input port="source" sequence="true" primary="true"/>
     <p:input port="query"/>
     <p:input port="parameters" kind="parameter"/>
     <p:output port="result" sequence="true"/>
</p:declare-step>

Description

The p:xquery step applies an [XQuery 1.0] query to the sequence of documents provided as input.

The first document provided on the source port is used as the initial context item. The whole sequence is also the default collection. If no documents are provided on the source port, the initial context item is undefined and the default collection is empty.

The query port must receive a single document:

  • If the document root element is c:query, the text descendants of this element are considered the query.

  • If the document root element is in the XQueryX namespace, the document is treated as an XQueryX-encoded query. Support for XQueryX is implementation-defined.

  • If the document root element is c:data and either does not have a content-type attribute or has a content-type attribute that specifies a text content type or a media type that the implementation recognizes, then the text descendants of this element are considered the query.

  • If the document root element is not c:data but has a c:content-type attribute that specifies a text content type or a media type that the implementation recognizes, then the text descendants of this element are considered the query.

  • Otherwise, the interpretation of the query is implementation-defined.

The result of the p:xquery step must be a sequence of documents. It is a dynamic error (err:XC0057) if the sequence that results from evaluating the XQuery contains items other than documents and elements. Any elements that appear in the result sequence will be treated as documents with the element as their document element.

For example:

  1 
    <c:query>
    declare namespace atom="http://www.w3.org/2005/Atom";
    /atom:feed/atom:entry
  5 </c:query>

The output of this step may include PSVI annotations.

Errors

Error Description
err:C0057 Occurs if the sequence that results from evaluating the XQuery contains items other than documents and elements.

Examples

FIXME: tbd.