简体   繁体   English

Docbook xi:包括

[英]Docbook xi:include

I am trying to create a docbook. 我正在尝试创建一个docbook。 I have created a main XML book and inside it I am using <xi:include> to add different chapters. 我已经创建了一本主要的XML书籍,并且在其中使用<xi:include>添加了不同的章节。

I am following DocBook XSL: The Complete Guide / Using XInclude to create book and chapter files. 我正在遵循DocBook XSL:完整指南/使用XInclude创建书和章文件。

Here is my main XML file book1.xml . 这是我的主要XML文件book1.xml

<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
                      "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<book>
  <title>MAIN NOTES</title>
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="CH1.xml" />
</book>

And here is my chapter1 ( CH1.xml ). 这是我的第1章( CH1.xml )。

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
                         "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="CH1">
  <title>Chapter 1</title>
  <para>This is Test</para>
</chapter>

Now when I am validating these XML files, CH1.xml is ok. 现在,当我验证这些XML文件时, CH1.xml就可以了。 But I am always getting 但是我总是

No Declaration found for element "xi:include" 找不到元素“ xi:include”的声明

for book1.xml . 用于book1.xml What am I missing here? 我在这里想念什么? Please help. 请帮忙。

How to make DTD validation work when using XInclude is described in another section of "DocBook XSL: The Complete Guide": http://www.sagehill.net/docbookxsl/ValidXinclude.html . “ DocBook XSL:完整指南”的另一部分中介绍了如何使用XInclude进行DTD验证: http : //www.sagehill.net/docbookxsl/ValidXinclude.html

In short, there are two alternatives: 简而言之,有两种选择:

  1. Validate after XInclude processing. 在XInclude处理之后进行验证。 With xmllint, this can be done using this command: xmllint --xinclude --postvalid book1.xml 使用xmllint,可以使用以下命令完成此操作: xmllint --xinclude --postvalid book1.xml
  2. Customize the DTD to include the xi:include element. 自定义DTD以包括xi:include元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM