Database Reference
In-Depth Information
Hello XInclude
eXist can also do XInclude processing for you. This means that on the way out, when
the final results of an XQuery operation are serialized, they are inspected for
xi:include
elements. When found, these references are expanded.
An interesting feature of the XInclude processing is that you can also refer to XQuery
scripts. The script is executed and the result included.
Example 2-6
demonstrates this.
Example 2-6. XInclude
<?xml version="1.0" encoding="UTF-8"?>
<XIncludeEnvelope
xmlns:xi=
"http://www.w3.org/2001/XInclude"
>
<xi:include
href=
"xinclude-content.xml"
/>
<xi:include
href=
"hello-world-1.xq"
/>
</XIncludeEnvelope>
hello-world-1.xq
is the XQuery script presented in
Example 2-3
. The included XML
file contains the fragment shown in
Example 2-7
.
Example 2-7. XML fragment to include with XInclude
<XIncludeContent>
This element was included by the XInclude processing
in eXist. Yes!
</XIncludeContent>
Now if you retrieve
xinclude-envelope.xml
from the database, the XInclude references
are resolved, resulting in
Example 2-8
.
Example 2-8. The result of the XInclude processing
<XIncludeEnvelope
xmlns:xi=
"http://www.w3.org/2001/XInclude"
>
<XIncludeContent>
This element was included by the XInclude processing in eXist. Yes!
</XIncludeContent>
<results
timestamp=
"2013-02-21T13:12:21.399+01:00"
>
<message>
Hello XQuery
</message>
</results>
</XIncludeEnvelope>
There are more features to XInclude processing, like
fallback
instructions and the
ability to pass parameters to XInclude-d XQuery scripts. Read more about this in
“XInclude” on page 243
.
Hello XForms
XForms is a
W3C standard
that defines declaratively the contents of a form on a web
page, its behavior, and its result. It's neither a thick nor a complicated standard.
Search WWH ::
Custom Search