Namespace complications

Included elements could conform to any namespace. Unfortunately, namespaces are often declared at a higher level in the document hierarchy than the elements to be extracted, but are still needed to make sense of the element name prefix (or to identify the default namespace, if no prefix is present). Consider the following example, and the effect of copying just the embedded chapter title, which includes a bold word enclosed in the XHTML B (bold) element:

This title is to be copied into the following document, which does not define the same namespace:

 <chapterTitles xmlns:xi="..."> <xi:include href=".../#xpointer(book/chapter[1]/title[1])"/> ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.