forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thorsten.scher...@wyona.com>
Subject Re: ODT: adding title element to pages
Date Tue, 25 Apr 2006 07:40:47 GMT
El lun, 24-04-2006 a las 21:15 -0700, Clay Leeds escribió:
> Updated Subject line. Sorry.
> 
> I meant to add, that OOo grabs the file name via an xsl:param, which  
> is passed through via a Cocoon pipeline. Will we want to do a similar  
> thing with this odt plugin?

I reckon it is a nice enhancement. ;)

Let us see how it is best (*IMO*) integrated.

...more inline...

> 
> Clay
> 
> 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>

and then we should create a forrest specific xsl and import the common
one. IMO we should leave the common *as it* since one can import/include
xsl and override only specific matches (less code to maintain). 

You can see what I mean if you look at 
http://svn.apache.org/viewcvs/lenya/trunk/src/modules/opendocument/xslt/opendocument2xhtml.xsl?rev=394204&r1=394203&r2=394204&view=diff
and
http://svn.apache.org/viewcvs?rev=394204&view=rev

HTH

> > Here's what I've got so far:
> >
> > <xsl:stylesheet ..>
> > <!-- FIXME Grab the file name -->
> > <xsl:variable name="filename">Insert Client Name</xsl:variable>
> >
> > <xsl:output
> > 	method="xml"
> > 	indent="yes"
> > 	omit-xml-declaration="yes"
> > 	doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
> > 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1- 
> > transitional.dtd"
> > 	encoding="UTF-8"
> > />
> >
> > <..>
> >
> > <!--
> >        Following hanged to match="/" from match="/office:document- 
> > content"
> >        with optimistic hope I could grab the dc:title element from / 
> > meta.xml
> > -->
> > <xsl:template match="/">
> > <!-- At this point, we are inside /content.xml, but we need to grab  
> > the 'title' element from /meta.xml (a sibling of /content.xml),  
> > but /meta.xml is a sibling inside the ODT ZIP file. How do we get  
> > to that? I don't think xsl:import would work, since we're in a ZIP  
> > file. -->
> >
> > <html xmlns="http://www.w3.org/1999/xhtml">
> > <head>
> > <title>
> >   <xsl:choose>
> >     <!-- if no title element or h1 elements, display $filename -->
> >     <xsl:when test="(/office:document-meta/office:meta/dc:title =  
> > '' or
> >         not(office:document-meta/office:meta/dc:title)) and
> >         office:document-content/office:body/text:h[1] = ''">
> >       <xsl:value-of select="$filename"/>
> >     </xsl:when>
> >     <!-- if no title element, display 1st h1 -->
> >     <xsl:when test="not(/office:document-meta/office:meta/dc:title)  
> > and
> >         office:document-content/office:body/text:h[1] != ''">
> >       <xsl:value-of select="office:document-content/office:body/ 
> > text:h[1]"/>
> >     </xsl:when>
> >     <!-- display title element from ODT File:Properties -->
> >     <xsl:otherwise>
> >       <xsl:value-of select="/office:document-meta/office:meta/ 
> > dc:title"/>
> >     </xsl:otherwise>
> >   </xsl:choose>
> > </title>
> > <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
> > <xsl:apply-templates select="office:document-content/ 
> > office:automatic-styles"/>
> > </head>
> > <body>
> > <xsl:apply-templates select="office:document-content/office:body/ 
> > office:text"/>
> > </body>
> > </html>
> > </xsl:template>
> 
> 
> Clay Leeds
> webmaestro@mac.com
> 
> My religion is simple. My religion is kindness.
> -- HH Dalai Lama of Tibet
> 
> 

-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org


Mime
View raw message