XMLWriter
Synopsis
Writes the corpus data structure into a file via an XSLT stylesheet.
Description
XMLWriter evaluates roots as a list of elements. The for each element, it writes a file using the xslTransform stylesheet. The file name is specified by the evaluation of fileName as a string with the root element as he context element. Relative file names are relative to outDir .
The stylesheet operates on an empty XML document bound to the root element, however XMLWriter provides XSLT element and function extensions in order to retrieve elements as a DOM structure. All extensions are defined in the namespace xalan://fr.inra.maiage.bibliome.alvisnlp.bibliomefactory.modules.xml.XMLWriter2
.
Extension functions
NodeSet elements(String expression)
: evaluates expression as a list of elements with the element bound to the context node as the context element. Each element is converted as an XML element; the result of this function is then a node set that can be used in afor-each
statement. The returned elements have the nameelement
in thehttp://bibliome.jouy.inra.fr/alvisnlp/XMLReader2
namespace. For each feature of the element, the corresponding XML element has an attribute. Each returned XML element is bound to to the corresponding AlvisNLP element.String string(String expression)
: evaluates expression as a string with the element bound to the context node as the context element. The string is returned.Number integer(String expression)
: evaluates expression as an integer with the element bound to the context node as the context element. The integer is returned.Number number(String expression)
: evaluates expression as a double with the element bound to the context node as the context element. The double is returned.NodeSet features()
: returns all features of the element bound to the context node as a node set. The returned XML elements have the namefeature
in thehttp://bibliome.jouy.inra.fr/alvisnlp/XMLReader2
namespace. The feature name and values are set in the attributesname
andvalue
.NodeSet inline(String expression)
: evaluates expression as a list of elements with the element bound to the context node as the context element. If the context element was a section, and if the result contains annotations, then this funcion returns the section contents with the annotations as XML elements included in the text. This function is used to convert annotations into in-text XML format.
Snippet
<xmlwriter class="XMLWriter">
<fileName></fileName>
<outDir></outDir>
<roots></roots>
<xslTransform></xslTransform>
</xmlwriter>
Mandatory parameters
fileName
Expression evaluated as a string with the file root element as the context element. The result specifies the file where to write the result.
outDir
Base directory where all file are written.
roots
Expression evaluated as a list of elements with the corpus as the context element. XMLWriter writes a file for each element in the result.
xslTransform
XSLT stylesheet that specifies the output.
Optional parameters
indent
Either to indent the resulting XML.