This repository was archived by the owner on Sep 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Invoke xquerydoc from XProc
xquery edited this page Feb 21, 2012
·
3 revisions
##method 1: use xqd:xquerydoc step
This pipeline will generate a directory of html formatted xquery api docs in the /tmp/xqdoc2 directory. Source xquery is taken from the /Some/directory/with/xquery/in/it directory.
<p:declare-step
xmlns:xqd="http://github.com/xquery/xquerydoc"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:ml="http://xmlcalabash.com/ns/extensions/marklogic"
xmlns:test="http://www.marklogic.com/test"
name="run-xquerydoc-example"
version="1.0"
exclude-inline-prefixes="c ml p">
<!-- import xquerydoc //-->
<p:import href="../../xquerydoc.xpl"/>
<p:input port="source"/>
<p:output port="result"/>
<xqd:xquerydoc currentdir="/tmp"
xquery="/Some/directory/with/xquery/in/it"
output="xqdoc2"
format="html"/>
</p:declare-step>
The following lists the options xqd:xquerydoc accepts (all are required).
- currentdir - current directory
- xquery - xquery source directory, either absolute or relative to currentdir
- output - output directory, either absolute or relative to currentdir
- format - html, markdown, xqdoc, raw
##method 2: use p:xquery step
Alternately you can invoke the xquerydoc XQuery library using p:xquery step. You will need to pass in xquery source as a parameter or get directly via xquery.
<p:xquery name="run">
<p:with-param name="source" select='$source'/>
<p:input port="query">
<p:inline>
<query>
xquery version "1.0" encoding "UTF-8";
import module namespace xqdoc="http://github.com/xquery/xquerydoc" at "src/xquery/xquerydoc.xq";
import module namespace xqp="XQueryML30" at "src/xquery/parsers/XQueryML30.xq";
declare variable $source as xs:string external;
xqp:parse-XQuery($source)
</query>
</p:inline>
</p:input>
<p:input port="parameters">
<p:pipe step="vars" port="result"/>
</p:input>
</p:xquery>