Inserting dynamic content

There may be situations where you need to insert modular content that is generated dynamically. For example, a table might include data from a database, and you want the table to represent the most up-to-date version of the data in the database.

XML and XSLT have no native mechanism for creating content by executing an external process such as database extraction. However, the href attribute of an XInclude can be any URI. If you set up an HTTP server with the capability of generating dynamic content, then your XInclude could use that content generated by the HTTP server. The server could be set up to use a CGI process, Apache Cocoon, or any other process that can generate DocBook XML. The following is a simple example:

<xi:include  href=""  

The HTTP server must be set up to process the CGI script named That script must return DocBook XML content that is valid for the insertion point in the document. From the point of view of the XML parser handling the document, all it sees is DocBook elements. Of course, the document is dependent on the CGI process each time it is processed. See the section “XIncludes and XML catalogs” for another example of using dynamically generated content.