An open API service indexing awesome lists of open source software.

https://github.com/tomschr/xpointer-example

An Example with XInclude and XPointer
https://github.com/tomschr/xpointer-example

xinclude xmllint xpointer

Last synced: about 2 months ago
JSON representation

An Example with XInclude and XPointer

Awesome Lists containing this project

README

          

# XInclude and XPointer example

An Example with XInclude and XPointer and how to reference them using IDs.

Process the file with:

$ xmllint --xinclude article.xml

The file `article.xml` contains different XIncludes and XPointers:

* `xi:include href="author.xml" xpointer="xpointer(element(/1)/*)"/>`

This is kind of what we know from SLE. Here it means: Include
the "author.xml" file, start with the root element and return all
children

* ``

Includes the file `author.xml`, points to the element with the `xml:id`
"author" (that would be ``, the root element), and return
all children.

* `xi:include xpointer="xpointer(id('editor')/*)"/>`

This is something special: it doesn't have an href attribute! That
means, it points to the current document (which is `article.xml`).
The XPointer points to the element with the `xml:id` "editor" and
returns all it's children.

* ``

For the XML nerds. ;-) Includes the file `intro.xml`, and points to the section with the
`xml:id` "sec.intro". Include all elements except the `title` element.
Useful if you want to specify another title. Use sparingly!
(The `xmlns()` expression is needed to define the DocBook 5 namespace
for the XPointer.)