Pau*_*aul 1 xml docbook xpointer docbook-5
我试图使用 xi:include 将 a.xml 元素的所有子元素(部分)包含到 b.xml 中。这两个 XML 文件都是有效的 docbook 5 文件。
xml文件
<chapter xml:id="TheChapter">
<section>
<title>section 1</title>
</section>
<section>
<title>section 2</title>
</section>
<section>
<title>section 3</title>
</section>
</chapter>
Run Code Online (Sandbox Code Playgroud)
b.xml
<section>
<xi:include href="a.xml" xpointer="element(/TheChapter/*)"/>
</section>
Run Code Online (Sandbox Code Playgroud)
我正在使用 XMLMind,它报告错误。
cannot parse inclusion directive: cannot parse XPointer "element(/TheChapter/*)": "/TheChapter/*", XPointer element() scheme syntax error
Run Code Online (Sandbox Code Playgroud)
我对 element() 方案的使用不正确吗?
您对该element()方案的使用不正确。
*不能使用通配符 ( )。“子序列”只能包含正斜杠和数字。这是一个有效的表达式:
element(TheChapter/1)
Run Code Online (Sandbox Code Playgroud)
它将选择由TheChapterID 标识的元素的第一个子元素。使用该方案无法完成您想要的操作element()。
您可以使用该xpointer()方案:
xpointer(id('TheChapter')/*)
Run Code Online (Sandbox Code Playgroud)
该xpointer()方案从未成为 W3C 推荐标准(它仍然只是一个草案),并且没有得到广泛实施。
XMLmind XML 编辑器确实支持xpointer(). 这是包含更多详细信息的邮件列表帖子:http://permalink.gmane.org/gmane.editors.xxe.general/10220。
| 归档时间: |
|
| 查看次数: |
2008 次 |
| 最近记录: |