Sunday, May 23, 2004
Including XML data from Xindice 1.1b4 in Cocoon 2.1.4
...is really easy.
In your source file, you just put, for example:
So, pretty straightforward. Address of XML resource, # symbol, XPath query to execute.
(For my application, this extracts the data for the first party of each client.)
Then in your sitemap, toss a
The output from the command will look something like this, assuming only 1 nodeset matched:
In your source file, you just put, for example:
<cinclude:includexml>
<cinclude:src>xmldb:xindice://localhost:8080/db/lawoffice/clients/#//party[@id='1']</cinclude:src>
</cinclude:includexml>
So, pretty straightforward. Address of XML resource, # symbol, XPath query to execute.
(For my application, this extracts the data for the first party of each client.)
Then in your sitemap, toss a
<map:transform type="cinclude"/>
in the pipeline for your source file and you're laughing. You will need to add <map:transformer name="cinclude" src="org.apache.cocoon.transformation.CIncludeTransformer"/> to your <map:transformers> section if it's not already present.
The output from the command will look something like this, assuming only 1 nodeset matched:
<xmldb:results xmlns:xmldb="http://apache.org/cocoon/xmldb/1.0" query="//party[@id='1']" resources="1">
<xmldb:result docid="1">
<party xmlns:src="http://xml.apache.org/xindice/Query" id="1" src:col="/db/lawoffice/clients" src:key="1">
<name>
<first>Colin</first>
<middle>L.</middle>
<last>Dellow</last>
</name>
</party>
</xmldb:result>
</xmldb:results>