<xquery>
[<xq-param name="xquery_param_name" [type="xquery_param_type"]>
body as xquery parameter value
</xq-param>] *
<xq-expression>
body as xquery language construct
</xq-expression>
</xquery>
| Name | Required | Default | Description |
|---|---|---|---|
| name | yes | Name of XQuery parameter | |
| type | no | node() |
Type of XQuery parameter - one of the values:
node(), integer, long,
float, double, boolean,
string,
node()*, integer*, long*,
float*, double*, boolean*, string*.
|
xq-expression in the form:
declare variable $<xquery_param_name> as <xquery_param_type> external;
node(), integer, long,
float, double, boolean, string
and analog sequence types:
node()*, integer*, long*,
float*, double*, boolean*, string*.
If not specified, default XQuery parameter is node().
<xquery>
<xq-param name="doc">
<html-to-xml>
<http url="${sys.fullUrl(startUrl, articleUrl)}"/>
</html-to-xml>
</xq-param>
<xq-expression><![CDATA[
declare variable $doc as node() external;
let $author := data($doc//div[@class="byline"])
let $title := data($doc//h1)
let $text := data($doc//div[@id="articleBody"])
return
<article>
<title>{$title}</title>
<author>{$author}</author>
<text>{$text}</text>
</article>
]]></xq-expression>
</xquery>
The xquery is applied to the downloaded page resulting XML containing information about newspaper's articles.