在主文件docbook_dev_note.xml中:
例 6.22. xinclude主文件中使用xinclude
<?xml version='1.0' encoding="utf-8"?>
......
<book version="5.0"
xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xl="http://www.w3.org/1999/xlink"
xml:lang="zh_CN"
>
<info>
<title>Docbook开发手记</title>
<subtitle></subtitle>
......
</info>
<xi:include href="preface.xml" />
<xi:include href="ch01_build_env.xml" />
......
</book>
然后被包含的文件中,是正常的xml文件。
比如preface.xml:
例 6.23. 被xinclude包含的子文件:preface.xml
<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE preface>
<preface
xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xl="http://www.w3.org/1999/xlink"
xml:id="preface">
<title>Docbook介绍</title>
<sect1 xml:id="what_is_docbook"><title>什么是Docbook</title>
......
</sect1>
</preface>
比如ch01_build_env.xml:
例 6.24. 被xinclude包含的子文件:ch01_build_env.xml
<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE chapter
[
......
]>
<chapter
xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xl="http://www.w3.org/1999/xlink"
xml:id="ch01_build_env">
<title>Windows下的Docbook的环境搭建</title>
<abstract></abstract>
<sect1><title>搭建Docbook之前需要知道的最基本的事情</title>
......
</sect1>
</chapter>





