forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clay Leeds <webmaes...@mac.com>
Subject Re: ODT: adding title element to pages
Date Tue, 25 Apr 2006 20:55:41 GMT
On Apr 25, 2006, at 12:40 AM, Thorsten Scherler wrote:
>> On Apr 24, 2006, at 9:12 PM, Web Maestro Clay wrote:
>>> ODT uses a similar structure to OOo. I want to grab the document
>>> title element (stored in 'odt_file.odt/meta.xml' as /
>>> office:document-meta/office:meta/dc:title). But the ODT transformer
>>> currently only looks at /content.xml.
>
> Then we need to do an aggregate to as well pass this file into the
> transformation.
> <map:aggregate element="odt" >
>  <map:part src="zip://content.xml@{lm:project.{uri}.odt}" />
>  <map:part src="zip://meta.xml@{lm:project.{uri}.odt}" />
> </map:aggregate>

I was able to view the DIFF you sent. It didn't make any light-bulbs  
go off for me...

I found something in the Cocoon Generator for SXW OpenOffice.org  
Writer documents (Ross's 'Resume' plugin[1]):

<!-- ==== -->
Here's one snippet that looked interesting:
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   <map:components>
     <map:generators>
       <map:generator name="sxw"  
src="org.apache.cocoon.generation.SXWGenerator"/>
     </map:generators>
   </map:components>
   <map:pipelines>
     <map:pipeline>
       <map:match pattern="**.html">
         <map:select type="exists">
           <!-- OpenOfficeWriter -->
           <map:when test="{context-attr:xfolio.efolder}{1}.sxw">
             <map:generate type="sxw" src="{context- 
attr:xfolio.efolder}{1}.sxw"/>
             <map:transform src="transform/oo/oo2html.xsl"/>
             <map:serialize/>
           </map:when>
         </map:select>
       </map:match>
     </map:pipeline>
   </map:pipelines>
</map:sitemap>
<!-- ==== -->

BTW, Ross had so many problems doing 'aggregate' he ended up going  
the <cinclude> route:

<!-- ==== -->
   == Forrest ==

For now, the best solution is in Forrest, using the new zip protocol  
from cocoon, able to resolve things like src="zip://content.xml@ 
{folder}/test.sxw". This is a part of the trick. The problem of their  
solution is to use a cinclude transformer, which is not cacheable.  
You need to regenerate your aggregation each time it is requested.  
This is not a big problem in Forrest context (essentially generate a  
site), but on a real life server...

Their solution looks like that

{{{
<map:generate src="transform/cocoon/dummy.xml"/>
<map:transform src="transform/cocoon/sxw2oo.xsl">
   <map:parameter name="src" value="{context-attr:xfolio.efolder} 
{1}.sxw"/>
</map:transform>
<map:transform type="cinclude"/>
<map:serialize type="xml"/>
}}}

The dummy.xml is only there because you need something to begin with  
pure cocoon.
The job is done by the XSL, to write something like that.
{{{
<office:document xmlns:**>
   <c:include select="...">
     <xsl:attribute name="src">zip://meta.xml@<xsl:value-of  
select="$src"/></xsl:attribute>
   </c:include>
   <c:include select="...">
     <xsl:attribute name="src">zip://content.xml@<xsl:value-of  
select="$src"/></xsl:attribute>
   </c:include>
</office:document>
}}}

Problems are
  * an Xpath include is expensive (all document need to be loaded as  
DOM)
  * Cinclude (like Xinclude) haven't seem to be cacheable for me

You may say, try a {{{<map:agreggate/>}}}... I tried, and produce so  
much problems of validation that I stopped.
<!-- ==== -->

Just the same, I'll poke around with this <map:aggregate/> stuff to  
see how frust^H^H^H^H^H far I get.

[1]
http://svn.apache.org/viewcvs.cgi/forrest/trunk/whiteboard/plugins/ 
org.apache.forrest.plugin.input.Resume/src/java/org/apache/forrest/ 
generation/SXWGenerator.java?rev=230687&view=markup

Clay Leeds
webmaestro@mac.com

My religion is simple. My religion is kindness.
-- HH Dalai Lama of Tibet




Mime
View raw message