[daisy] einclude vs cinclude inside other extension
Bruno Dumon
bruno at outerthought.org
Thu May 3 09:22:46 CDT 2007
On Thu, 2007-05-03 at 15:52 +0200, Vincent Mouton wrote:
> Hello,
>
> I have an extension that I call in some skinning xsl files through the
> einclude mechanism (<einclude:include
> src="cocoon://<sitename>/ext/myExtension"/>). The extension returns an HTML
> blurb.
>
> Those skinning xsl files, say the layout.xsl, are also used in some other
> extensions (e.g. a search or a contact form). And of course, the above
> include should be called there too.
> Except, the <einclude:include> tag is rendered as such in the output html
> when calling the other extensions (search, contact form).
The processing of the einclude tag is done if the appropriate
transformer is present in the pipeline (after the transformation which
added the einclude tag).
Now looking at the Daisy sitemap.xmap:
* there's a cinclude transformer in the form pipeline:
<map:transform type="cinclude"/>
* there an einclude transformer in the document-display pipeline:
<map:transform type="DaisyExternalInclude"/>
For background: the cinclude transformer is Cocoon's default include
transformer, providing a variety of functionality.
The einclude transformer is Daisy's own simple include transformer,
mostly geared towards processing non-"daisy:" includes that users put in
documents. The important difference with the cinclude transformer is in
how it handles errors: if an error occurs fetching the URL or parsing
its result, a nice inline error is displayed in the document, rather
than failing to display the document entirely. This is important as
users might easily make mistakes.
For more developer-oriented includes, cinclude is probably the better
thing to use (and should be faster as it doesn't buffer things). So the
solution would basically be to add a cinclude tranformer to the
document-display pipeline too. You can easily try this out yourself by
modifying the sitemap.
To include this in Daisy by default, I'd first like to test what the
overhead of that transformer is. Maybe you can add an jira issue, and do
some performance tests yourself with/without the transformer (in absence
of includes) -- jakarta jmeter is useful tool for this.
>
> Now, my guess is this is because it's not an external include anymore. As,
> when I replace the einclude namespace with a cinclude one, the extension is
> working in the extension pages, but not anywhere else in the site.
>
> So for now, I've done a dirty hack, using the magnificent <xsl:choose>
> switch, where I call the einclude or the cinclude depending on where I am (a
> daisy document, or another extension).
>
> I was wondering if there is any other way of doing this.
>
>
> Cheers,
> v
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org bruno at apache.org
More information about the daisy
mailing list