xquery
XQuery
Release Notes
attachGoldenThread
cast
copy
cutGoldenThread
cwu
delete
dpml
dump
entrypoint
exists
expire
fls
guid
hotRestart
HTTPCookie
HTTPRedirect
isUnix
locationToXPath
lock/unlock
log
loglevel
luceneIndex
luceneSearch
mapper
mapper-export
md5
mls
netkernel:*
new
Orchextra
org.ten60.util.aspell
org.ten60.util.image.SVG2PNG
org.ten60.util.image.Text2PNG
org.ten60.util.image.xchart
plainTextToXHTML
regex
relativizeURI
requestWithArgs
resolveURI
serialize
sleep
sqlBatch
sqlBooleanQuery
SQLEncodeElement
SQLEscapeXML
sqlQuery
sqlUpdate
stm
stopWatch
StringToCanonicalString
throw
toRelaxNG
trace
validateDTD
validateRNG
validateSchematron
validateXSD
xacml
xform
XHREFlinker
XHTMLredirect
XHTMLTidy
xinclude
xmltidy
xpatheval
xpur
xquery
xrl
xsign
xslfo-fop
xslfo-fop
xslt
xverify
License
Change History
NetKernel History
Acknowledgements

xquery

Used to execute xquery scripts

Module

urn:org:ten60:netkernel:ext:xquery

Definition

Format

<instr>
  <type>xquery</type>
  <operand>foo.xml</operand>
  <operator>bar.xml</operator>
  <target>this:response</target>
</instr>

Syntax

ElementRulesDescription
typeMandatory xquery
operandOptional optional a resource which may be referenced as operand.xml in the xquery
operatorOptional required a document containng the xquery operations
paramOptional optional a resource which may be referenced as param.xml in the xquery
targetOptional required the target resource

The xquery accessor executes xquery scripts. The xquery script is provided through the operator. The resulting document is returned to the target.

This xquery implementation uses the LGPL Qexo XQuery implementation on the Kawa engine. Xqueries are serialized and compiled to native bytecode before execution in the Kawa runtime.

In order to provide access to resources passed from the dexter runtime platform we provide access to the operand and parameter documents in the xquery script. These can be loaded with the xquery document() operation as operand.xml and param.xml respectively. Here is an example of loading the operand into a variable in the xquery script:

<xquery> let $operand := document("operand.xml")/PLAY/ACT[1]/SCENE[1] return &lt;SPEECHES&gt; {$operand//SPEECH[SPEAKER='GLOUCESTER']} &lt;/SPEECHES&gt; </xquery>

XQuery can be used for processing/querying the operand/param documents. It can also be used as a generative scripting language for dynamically creating documents with or without reference to the operand and param documents.

Operator Syntax

The xquery accessor requires an xquery script. The xquery script is passed in by the operator in an <xquery> document.

<xquery> &lt;table&gt;{ for $y in 1 to 10 return ( &lt;tr&gt;{ for $x in 1 to 10 return let $bg:=(if($x mod 2 + $y mod 2 &lt;= 0) then "lightgreen" else if ($y mod 2 &lt;= 0) then "yellow" else if ($x mod 2 &lt;= 0) then "lightblue" else "white"), $prod:=$x*$y return &lt;td align="right" bgcolor="{$bg}"&gt;{ if ($x &gt; 1 and $y &gt; 1) then $prod else &lt;b&gt;{$prod}&lt;/b&gt;}&lt;/td&gt; }&lt;/tr&gt;, " ") }&lt;/table&gt;," " </xquery>

<xquery> contains an escaped xquery script for execution by the xquery engine. Note it is important that all xml symbols such as angle brackets <, >, are escaped.

Example

TBD


(C) 2003, 1060 Research Limited
© 2003,2004, 1060® Research Limited
1060 registered trademark, NetKernel trademark of 1060 Research Limited