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?
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:
It will select the first child of the element identified by the
TheChapter
ID. What you want cannot be done using theelement()
scheme.You could use the
xpointer()
scheme: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.