Usage
Although Cobble does not have any dependency, it uses XSLT2.0 and some XQuery 1.0 to generate the documentation and should be used with XSLT processor which supports both such as the excellent Saxon.
Command Line
Cobble can be invoked directly on the command line using java (> Java 6).
The first argument is the path to the file to process. It should be either a Schematron file (.sch) or XSLT (.xsl or .xslt).
It currently supports the following options:
|
to generate HTML documentation |
|
to specify where the documentation should be generated |
For example, to generate XML documentation:
java -jar wo-cobble.jar your_stylesheet.xsl > documentation.xml
Or as HTML
java -jar wo-cobble.jar your_stylesheet.xsl -html -o doc
ANT
There is no dedicate ANT task but you can invoke Cobble using the <java>
ANT task .
For example:
<target name="test-java-xslt-xml"> <mkdir dir="doc/xml"/> <java jar="wo-cobble.jar" classpath="saxonhe-9.x.jar"> <arg value="your_stylesheet.xsl"/> <arg value="-html"/> <arg value="-o"/><arg value="doc"/> </java> </target>
If your environment requires the java process to be forked in ANT (for example within an IDE). You can run Cobble as below
<target name="generate-doc"> <java classname="org.weborganic.cobble.Main" classpath="lib/wo-cobble.jar;lib/saxonhe-9.x.jar" fork="true"> <arg value="your_stylesheet.xsl"/> <arg value="-html"/> <arg value="-o"/><arg value="doc"/> </java> </target>
Java
You can of course use the Java directly.
XML
The XMLGenerator class generates the XML documentation:
File source = new File("your_stylesheet.xsl"); File xmldoc = new File("documentation.xml"); XMLGenerator generator = new XMLGenerator(source); generator.generate(xmldoc);
HTML
The HTMLGenerator class generates the HTML documentation:
File source = new File("your_stylesheet.xsl"); File htmldoc = new File("doc"); htmldoc.mkdir(); XMLGenerator generator = new XMLGenerator(source); generator.generate(htmldoc);
For convenience, Cobble also outputs in the required resources for the HTML (styles, CSS, etc...) in the same directory.
Warning!
If you intend to code against the current Java API, beware that this library has just been released and the API is still subject to change. Refer to the Javadoc.Created on , last edited on