In working with XML or HTML, it is often the case that you need to work with multiple documents at the same time. And in most cases that's rather awkward. For instance, an XSLT transformation processes a single document. And yes, of course you can get others by calling the doc() function or produce others using <xsl:result-document>. But, especially when there are a lot of relations between the documents, this requires careful and sometimes heavy programming. The idea of XML containers tries to make this more manageable.

An XML container (as handled/used by this module) is an XML structure that holds other XML documents and references to binary files. Here is a short example:

<document-container xmlns="" 

  <document href-target="index.html">
    <html> … </html>

  <document href-target="page1.html">
    <html> … </html>

  <external-document href-source="/my/resources/image.jpg" href-target="resources/image.jpg"/>

This example shows a container, probably generated by some pipeline or XSLT stylesheet, that contains the contents of a simple website. All two pages and some image are there. Running this container through xtlcon:container-to-disk will write it to the path indicated in /*/@href-target-path: /my/website/location. The documents index.html and page1.html come from the container, the binary image.jpg is copied from the indicated source location. Because everything, every separate file, is in (or referenced in) a single encompassing document, lots of things get easier: creating or checking internal referencing, making classes consistent, etc. An XSLT stylesheet that gets this as its main document has access to all information.


1.1 Applications

As it turned out, the whole idea of working with multiple documents in an XML container had several applications:

1.2 Working with containers

The container format is described here Working with XML container documents is done using XProc 1.0 or XProc 3.0 pipelines.

WARNING: The container formats and processing features differ between the 1.0 and the 3.0 version! More about this in the container format description.


There are some notable missing features in the current container handling. These are not impossible to implement, the need for them just hasn't arisen yet.