XIncludes, was: Re: [Petal] Petal 0.80 released

Chris Croome chris at webarchitects.co.uk
Wed Jan 22 16:49:22 GMT 2003


Hi

On Thu 12-Dec-2002 at 12:18:54 +0000, Jean-Michel Hiver wrote:
> 
> Currently with Petal includes are made using a XML processing
> instruction: <?include file="/some/thing.xml"?>
> 
> My collegue Chris Croome suggested implementing XInclude support. What
> do you think about this?

OK here are some arguments in favour of using XIncludes...

It is an established standard that is designed exactly for the task,
read more here:

  http://www.w3.org/TR/xinclude/

It has cool features like the ability to have fallback errors, for
example:

  <xi:include href="../../../fragments/menu/en.html">
    <xi:fallback>
      <p>Sorry the was an error including the menu.</p>
    </xi:fallback>
  </xi:include>

It is already supported by many tools and it is probably only a matter
of time before WYSIWYG HTML editors suport it. There is a short list of
application that it here:

  http://www.w3.org/XML/2002/09/xinclude-implementation

There is some SAX support for XIncludes:

  http://search.cpan.org/author/MSERGEANT/XML-Filter-XInclude-1.0/lib/XML/Filter/XInclude.pm

Though I think we would probably want to limit support for URIs to files
on the filesystem for security?

Personally I use xmllint for checking the XML validity of petal
templates while working on them and this tool has XIncludes support:

  # xmllint --xinclude template.html

The above command will resolve all the includes and also check them for
validity :-)

There is a article on XIncludes and docbook here which is quite
interesting:

  http://www.xml.com/lpt/a/2002/07/31/xinclude.html

Are you all convinced yet, or should I continue...?

Chris

-- 
Chris Croome                               <chris at webarchitects.co.uk>
web design                             http://www.webarchitects.co.uk/ 
web content management                               http://mkdoc.com/   
everything else                               http://chris.croome.net/  



More information about the Petal mailing list