XML technologies / XML / XML in a Nutshell / XInclude

(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)

XInclude is a new W3C technology for combining several well-formed, possibly valid documents or fragments into one document. Its operation resembles external entity references assembling a document from parts. However, XInclude can use resources that are themselves complete well-formed documents, containing XML declarations and even document type declarations. It can also use XPointers to extract only part of an external document.

XInclude defines two elements, xi:include and xi:fallback, both in the namespace "http://w ww.w3.org/2001/XInclude". An xi:include element has an href attribute pointing to a document. An XInclude processor replaces all xi:include elements in a master document with the documents they reference. These may be XML documents or plain text such as Java source code. If the xi:include element has a xpointer attribute, then the xi:include element is replaced only by those parts of the remote document specified by the XPointer. If the processor cannot find the external document referenced by the href attribute, it replaces the xi:include element with the content of its xi:fallback child element.

Note: The following pages are based on the second XInclude Candidate Recommendation of 13 April 2004. We consider this draft fairly stable, though some details may change before the final version. The latest version of the XInclude specification is XML Inclusions (XInclude) Version 1.0 of 15 November 2006.

  

  

 

 

 

back to top