public
Description: XSLT XInclude Processor
Homepage:
Clone URL: git://github.com/arnau/xiproc.git
xiproc /
name age message
file .gitignore Loading commit data...
file README.mdown
file xiproc.xsl
README.mdown

xiproc

XSLT XInclude Processor to merge in a XML document XML or text documents. It has support of xpointer() scheme and xmlns() scheme partially.

xiproc is heavily inspired in XInclude Processor (XIPr) (http://dret.net/projects/xipr/). Thanks to Erik Wilde (http://dret.net/netdret/) for it.

TO-DO

  • Prevent infinite recursive calls
  • Child predicate expression: xpointer(/e[f])
  • element() scheme
  • Overwrite xmlns() scheme
  • Multiple xpointer() scheme

Requeriments

xiproc needs an XSLT 2.0 parser (tested with Saxon 9).

Usage

Declare the /xi:include element in your input.xml:

<dml xmlns:dml="http://purl.oclc.org/NET/dml/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
  <title>Input document</title>
  <!-- Entire document -->
  <xi:include href="chapter1.xml"/>
  <!-- First /section child of root -->
  <xi:include href="chapter2.xml" xpointer="xpointer(/*/section[1])"/>
</dml>

And execute XSLT 2.0 parser:

java -jar saxon9.jar -s:input.xml -xsl:xiproc.xsl -o:output.xml

xpointer() scheme support

This version supports a few XPointer expressions:

xpointer(/*) (: root element :)
xpointer(/e) (: root e element:)
xpointer(/e/f) (: f elements children of root e element:)
xpointer(//e) (: all e elements of document :)
xmlns(p=http:/example/ns) xpointer(//p:e) (: all e elements of document associated to p namespace prefix :)
xpointer(/*/e//f) (: all f elements descendant of e elements children of root :)
xpointer(/*/e[1]) (: first e element child of root :)
xpointer(//id('value')) (: element with @id attribute equal to 'value' :)
xpointer(//e[@attr]) (: e element with @attr attribute :)
xpointer(//e[@attr='value']) (: e element with @attr attribute equal to 'value' :)

Multiple xpointer() schemes are not supported.

Author

Arnau Siches http://blog.esbudellat.net/

License

GNU Lesser General Public License (LGPL), see xiproc.xsl