forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <>
Subject Re: Using Xinclude
Date Tue, 22 Nov 2005 09:39:40 GMT
Andres Olarte wrote:
> I want to use Xinclude to have "shared" parts of my documentation,
> fragments that are stored once but shown in multiple places.  I know
> that you can do this with Xinclude, according to a previous post, but
> I'm lost as to how to actually do it in Forrest.  I'm really, not very
> experienced with advanced XML.  Does anybody has a simple example?

You need to the xinclude namespace to the document:

<document  xmlns:xi="">

Then you add the XIinclude instruction at the relevant point in your 
document. The href can be any legal URL.

<xi:include href="cocoon://index.xml"/>

The problem with this is that it includes the whole document, including 
the header, whcih you probably don't want. To include a part of the 
document you can add an XPointer part to your URL:

<xi:include href="cocoon://index.xml#xpointer(//body/*)"/>



So a complete example would be (note this is a n old document using 
document v1.2 schema, there is no technical reason for this, it can be 
any supported schema):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" 
<document  xmlns:xi="">
     <title>ECommerce - Session 1 - Introduction and Networking 
BasicsComplete Notes</title>

     <title>Course Outline</title>
     <xi:include href="cocoon://index.xml#xpointer(//body/*)"/>
     <xi:include href="cocoon://description.xml#xpointer(//body/*)"/>
     <xi:include href="cocoon://objectives.xml#xpointer(//body/*)"/>
     <xi:include href="cocoon://methodology.xml#xpointer(//body/*)"/>
     <xi:include href="cocoon://evaluation.xml#xpointer(//body/*)"/>
     <xi:include href="cocoon://resources.xml#xpointer(//body/*)"/>
     <xi:include href="cocoon://schedule.xml#xpointer(//body/*)"/>
     <xi:include href="cocoon://coursework.xml#xpointer(//body/*)"/>

   <!-- and so on -->



View raw message