Reputation: 2564
I am trying to include all child elements (sections) of an element from a.xml into b.xml with xi:include. Both XML files are valid docbook 5 files.
a.xml
<chapter xml:id="TheChapter">
<section>
<title>section 1</title>
</section>
<section>
<title>section 2</title>
</section>
<section>
<title>section 3</title>
</section>
</chapter>
b.xml
<section>
<xi:include href="a.xml" xpointer="element(/TheChapter/*)"/>
</section>
I am using XMLMind which reports an error.
cannot parse inclusion directive: cannot parse XPointer "element(/TheChapter/*)": "/TheChapter/*", XPointer element() scheme syntax error
Is my use of element() scheme not correct?
Upvotes: 1
Views: 2136
Reputation: 51002
Your use of the element()
scheme is not correct.
*
) cannot be used. The "child sequence" can contain forward slashes and numbers only.This is a valid expression:
element(TheChapter/1)
It will select the first child of the element identified by the TheChapter
ID. What you want cannot be done using the element()
scheme.
You could use the xpointer()
scheme:
xpointer(id('TheChapter')/*)
The xpointer()
scheme never became a W3C recommendation (it's still just a draft) and it is not widely implemented.
XMLmind XML Editor does support a subset of xpointer()
. Here is a mailing list post with some more details: http://permalink.gmane.org/gmane.editors.xxe.general/10220.
Upvotes: 5
Reputation: 2564
The following usage works fine:
<xi:include href="a.xml" xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('TheChapter')/db:section)"/>
Or
<xi:include href="a.xml" xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('TheChapter')/*)"/>
Upvotes: 0