The Xquery language and the DITA Open Toolkit

Presentation at the 22 April 2009 meeting of the RTP DITA Users' Group by Tom Ed White, Tekelec.

Xquery is a powerful query language designed specifically for XML content. It can be used for querying, processing, manipulation, and transformation of xml content. I will demonstrate how Xquery can be used to add to the feature set of the Dita Open Toolkit. I also will introduce three of the basic statements that the language uses to manipulate content.
URL: 
AttachmentSize
xquery-presentation.pdf309.51 KB

Here is the code I use for deploying xquery:

The xquery engine I've been using is available at: http://www.gnu.org/software/qexo/ So far, it's been very stable. To set it up in Ant:

First, define properties for the locations of the xquery libs and the xquery
script you want to run:

<property name="xquery" value="${toolkit_dir}${file.separator}..${file.separator}DOT-xquery"/>

<property name="xquery-script" value="${xquery}${file.separator}scripts${file.separator}glossary.xqp"/>

And here is the target for running the script. Notice how the $glofile and $mapfile external variables that are in the xquery script are defined here.

<!--Process glossary via xquery-->
<target name="glossary">
<mkdir dir="${output.dir}${file.separator}references"/>
<java jar="${xquery}${file.separator}lib${file.separator}kawa-1.
9.1.jar" fork="true" dir="${projdir}" output="${output.dir}${file.separator}references${file.separator}glossary.html" failonerror="true">
<arg value="--xquery"/>
<arg value="mapfile=${args.input}"/>
<arg value="glofile=${projdir}${file.separator}references${file.separator}r_MasterGlossary.xml"/>
<arg line="-f ${xquery-script}"/>
</java>
</target>

Happy xquerying!

Regards,
Tom Ed White

 

Thanks for putting this together. Do you plan to call the query from the ANT script? I see what you're doing, but I'm not quite sure how it works with the OT.

 

Thanks again,

-seth

XML.org Focus Areas: BPEL | DITA | ebXML | IDtrust | OpenDocument | SAML | UBL | UDDI
OASIS sites: OASIS | Cover Pages | XML.org | AMQP | CGM Open | eGov | Emergency | IDtrust | LegalXML | Open CSA | OSLC | WS-I