-
Notifications
You must be signed in to change notification settings - Fork 0
Saxon CLI
You just need an XSLT 3.0 processor to use xtriples-micro for extracting
triples from XML. You can use the Home Edition of Saxon on the command line.
To keep things simple, we first export an environment variable that stores our command:
export XSLT=java -jar saxon-he-10.9.jarIf you have the Tooling environment
installed and setup, say export XSLT=$(realpath target/bin/xslt.sh)
for this exercise.
For this exercise, the following input to your shell should give you this:
$ $XSLT -?
Saxon-HE 10.9J from Saxonica
Usage: see http://www.saxonica.com/documentation/index.html#!using-xsl/commandline
Format: net.sf.saxon.Transform options params
Options available: -? -a -catalog -config -cr -diag -dtd -ea -expand -explain -export -ext -im -init -it -jit -l -lib -license -m -nogo -now -ns -o -opt -or -outval -p -quit -r -relocate -repeat -s -sa -scmin -strip -t -T -target -TB -threads -TJ -Tlevel -Tout -TP -traceout -tree -u -val -versionmsg -warnings -x -xi -xmlversion -xsd -xsdversion -xsiloc -xsl -y --?
Use -XYZ:? for details of option XYZ
Params:
param=value Set stylesheet string parameter
+param=filename Set stylesheet document parameter
?param=expression Set stylesheet parameter using XPath
!param=value Set serialization parameterYou should also provide a variable with a path to your
xtriples-micro installation:
export XTRIPLES=$(realpath .)There are 3 different ways to use xtriples-micro:
The straight forward usage is applying the xtriples-micro XSLT on an
XTriples configuration file as source.
$XSLT -xsl:$XTRIPLES/xsl/extract-collection.xsl -s:CONFIGURATION.xmlWhich XML documents are extracted is determined by the <collection>
elements in the configuration file. This usage is compatible with the
reference implementation. We use it in CI/CD
Pipelines.
xsl/extract.xsl extracts
from an XML document given as source by applying a configuration
passed in via the stylesheet parameter config-uri.
$XSLT -xsl:$XTRIPLES/xsl/extract.xsl -s:DOCUMENT.xml config-uri=CONFIGURATION.xmlThis is the only transformation that makes sense deploying on a micro service.
xsl/extract-doc-param.xsl takes a
configuration as source document and applies it to an XML document
referenced by the source-uri stylesheet parameter.
$XSLT -xsl:$XTRIPLES/xsl/extract-param-doc.xsl -s:CONFIGURATION.xml source-uri=DOCUMENT.xml