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
- Host: GitHub
- URL: https://github.com/tomschr/xpointer-example
- Owner: tomschr
- License: mit
- Created: 2019-05-23T07:03:17.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-13T06:24:20.000Z (almost 7 years ago)
- Last Synced: 2025-05-29T19:04:01.133Z (10 months ago)
- Topics: xinclude, xmllint, xpointer
- Size: 10.7 KB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.)