XIncludes vs Document Function
In order to display the contents of another document in the document you are editing you can use XIncludes or you can use the document function offered by the MSXML library in IE only.
Displaying contents from another document can be used for many different things. It is hard to give a defining example. Some examples include:
-
Having an image from a central repository in the document and displaying a caption that is saved with the image rather than in the document.
-
Having a list of references to other documents and displaying their titles (DITA Map)
-
Wanting to display a menu, and aggregated list, or some other data that is not stored in the document
XIncludes
XIncludes are an XML standard from the W3C. They work as follows:
-
an
<xi:include href="other-document.xml"/>exists in the main document -
the main document is then run through a process that resolves the XIncludes. In Xopus this can be done with resolveXIncludes in the configuration pipeline
-
the resolved content then replaces the
<xi:include>
In order to get an <xi:include> in the main document, without saving them in the document, you can often do an extra XSL transformation to rewrite simple href attributes or src attributes into proper XIncludes. An example of how this can be used in Xopus can be found on the resolveXIncludes page.
XIncludes work are resolved by Xopus and will therefore work in all browsers supported by Xopus.
The Document Function
The document() function can be used to achieve the above in a faster way, but only works in Internet Explorer as this browsers makes use of the MSXML library. The function can be called from an XSL, and therefore doesn't require the XML document to be changed.
- Documentation
- › FAQ
- › XIncludes vs Document Function