<oXygen/> User Guide |
XInclude is a standard for building up XML documents from smaller pieces, being a replacement for the external entities. The external entities can be a problem because they cannot have a DOCTYPE declaration, and threfore are not valid documents on their own.
The main usage is in the documentation frameworks where the documents may be composed of many files, XInclude allowing the validation of the master file also the validation of the individual sections.
The advantages of modular documentation are: reusable content units, smaller file units that are edited, better version control, distributed authoring.
Here is an example of a chapter file and a book file that includes the chapter using XInclude.
Chapter file introduction.xml:
<?xml version="1.0"?> <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> <chapter id="introduction"> <title>Getting Started</title> <section id="Installing Oxygen"> ... </chapter>
Main book file:
<?xml version="1.0"?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> <book> <title>User Guide</title> <para>This guide shows you how to use the editor.</para> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml" /> ... </book>
The XInclude support in Oxygen is turned off by default. You can turn it on by using the
, the entry .