<oXygen/> XML Editor User Guide

XInclude

XInclude is a standard for assembling XML instances into another XML document through inclusion. It enables larger documents to be dynamically created from smaller XML documents without having to physically duplicate the content of the smaller files in the main file. XInclude is targeted as the replacement for External Entities. The advantage of using XInclude is that, unlike the entities method, each of the assembled documents is permitted to contain a Document Type Declaration (DocType Decl.). This means that each file is a valid XML instance and can be independently validated. It also means that the main document to which smaller instances are included can be validated without having to remove or comment the DocType Decl. as is the case with External Entities. This is makes XInclude a more convenient and effective method for managing XML instances that need to be stand-alone documents and part of a much larger work.

The main application for XInclude is in the document orientated content frameworks such as manuals and Web pages. Employing XInclude enables authors and content managers to manage content in a modular fashion that is akin to Object Orientated methods used in languages such as Java, C++ or C#.

The advantages of modular documentation include: reusable content units, smaller file units that are easier to edited, better version control and distributed authoring.

Here is an example of a chapter file that is included in a book file using XInclude.

Chapter file introduction.xml:

<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
    "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> 
<chapter id="introduction">
        <title>Getting Started</title>
        <section id="installing-oxygen">
            ...
        </section>
</chapter>

                
            

Main book file:

<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
                      "http://www.docbook.org/xml/4.3/docbookx.dtd"
[ <!ENTITY % xinclude SYSTEM "xinclude.mod">
%xinclude;
]>
<book>
    <title>Installation Guide</title>
    <para>This guide explain how to install the <oXygen/> XML Editor.</para>
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"  href="introduction.xml">
        <xi:fallback>
            <para>
                <emphasis>FIXME: MISSING XINCLUDE CONTENT</emphasis>
            </para>
        </xi:fallback>
    </xi:include>
    ...
</book>

                
            

In this example the following is of note:

The XInclude support in <oXygen/> is turned off by default. You can turn it on by using the Options/Preferences/XML/XML Parser Options , the entry Enable XInclude processing. When enabled <oXygen/> will be able to validate and transform documents comprised of XIncluded content.