cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conal Tuohy" <Conal.Tu...@vuw.ac.nz>
Subject RE: Data-driven decorator design
Date Wed, 20 Jul 2005 22:28:16 GMT
Peter van Hardenberg wrote:

> I'd like to "decorate" my XML files as an early processing 
> step with XML from another source. The source documents are 
> Shakespearean texts, and I want to use Cocoon to overlay 
> annotations from various sources onto the file.
> 
> I am considering using map:aggregate, but it seems needlessly 
> ugly to have to say something like this in every match:
> 
> <map:aggregate>
>    <my old source>
>    <my annotation file>
> </map:aggregate>
> <map:transform purpose="move the annotation file into the 
> source and unwrap the new root node"/> ...
> 
> Does anyone have any advice about a Better Way? I am 
> considering using the same approach I currently use to create 
> templates. Start with a simple XSLT, XInclude the data for 
> that request into it, then use a the cocoon:/ protocol 
> transform step to interleave the two. That would let me move 
> the whole ugly mess into a single line in each match rule and 
> any messiness could be contained in an internal pipeline.

Hi Peter. I've used both of the techniques you've described! You must
work in a digital library too? :-)

The first, as you say, is a bit awkward. 

The second technique, if I understand you correctly, is where you
transform your source (Shakespeare) documents to add many "XInclude"
elements pointing at cocoon:/ pipelines? Then you run the XInclude
transformer and make a multitude of other sitemap calls? If so, there's
an obvious downside which is the overhead of all those individual
sitemap calls.

A third technique we've used is to transform the "annotation file" into
an XSLT, and apply that XSLT to the source, e.g.

<map:match pattern="annotation/*.xslt">
	<map:generate src="annotations/{1}.xml"/>
	<map:transform src="xslt/annotations-to-xslt.xsl"/>
	<map:serialize type="xml"/>
</map:match>

<map:match pattern="annotated-source/*.xml">
	<map:generate src="source/{1}.xml"/>
	<map:transform
src="cocoon:/annotation/my-annotation-file.xslt"/>
	...

</map:match>

HTH!

Conal

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message