You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Web Maestro Clay <th...@gmail.com> on 2006/04/25 06:12:51 UTC

ODT: adding

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.

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
the.webmaestro@gmail.com

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




Re: ODT: adding title element to pages

Posted by Clay Leeds <we...@mac.com>.
This might have some interesting stuff in it:

http://issues.apache.org/jira/browse/NUTCH-125

Clay Leeds
webmaestro@mac.com

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




Re: ODT: adding title element to pages

Posted by Clay Leeds <we...@mac.com>.
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




Re: ODT: adding title element to pages

Posted by Clay Leeds <we...@mac.com>.
On Apr 27, 2006, at 3:45 PM, Thorsten Scherler wrote:
> The problem is that the common odt is actually coming from David
> Eisenberg and in no way lenya specific (IMO best for us to use an
> svn:external reference to his svn server instead of providing a  
> copy). I
> think we should only enhance it (as we finding bugs) but normally  
> use it
> as it like I tried to explain in FOR-872 and demonstrated in
> http://svn.apache.org/viewcvs?rev=397657&view=rev.

I understand now. Thank you for clarifying it!

> Regarding the above downsides I agree we should implement *another*
> common xsl (for forrest and lenya - common-apache-odt.xsl) and  
> import it
> in e.g. odt-to-forrest-xhtml.xsl. If we (lenya and forrest as first
> tester) are happy with the results *then* we should patch the common
> (from D. Eisenberg) and send the patch to him that he can incorporate
> them in his next version.
>
> salu2
> -- 
> thorsten
>
> "Together we stand, divided we fall!"
> Hey you (Pink Floyd)

Makes sense to me!

Clay Leeds
webmaestro@mac.com

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




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: ODT: adding title element to pages

Posted by Clay Leeds <we...@mac.com>.
On Apr 27, 2006, at 3:45 PM, Thorsten Scherler wrote:
> The problem is that the common odt is actually coming from David
> Eisenberg and in no way lenya specific (IMO best for us to use an
> svn:external reference to his svn server instead of providing a  
> copy). I
> think we should only enhance it (as we finding bugs) but normally  
> use it
> as it like I tried to explain in FOR-872 and demonstrated in
> http://svn.apache.org/viewcvs?rev=397657&view=rev.

I understand now. Thank you for clarifying it!

> Regarding the above downsides I agree we should implement *another*
> common xsl (for forrest and lenya - common-apache-odt.xsl) and  
> import it
> in e.g. odt-to-forrest-xhtml.xsl. If we (lenya and forrest as first
> tester) are happy with the results *then* we should patch the common
> (from D. Eisenberg) and send the patch to him that he can incorporate
> them in his next version.
>
> salu2
> -- 
> thorsten
>
> "Together we stand, divided we fall!"
> Hey you (Pink Floyd)

Makes sense to me!

Clay Leeds
webmaestro@mac.com

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




Re: ODT: adding title element to pages

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> Web Maestro Clay escribi??:
> > Thorsten Scherler wrote:
> > > 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).
> > 
> > Although you say we should leave the COMMON as is, but there are  
> > holes in the current ODT implementation:
> > - no graphics support
> > - no support for numbered lists
> > - Forrest fixme, warning, note (Forrest-specific, but doesn't Lenya  
> > want Fixme, Warning & Note too?)
> > - <sub> & <sup>
> > - <strong>, <em>
> > 
> > Shouldn't those be added to the COMMON, so Lenya can benefit as well?
> 
> The problem is that the common odt is actually coming from David
> Eisenberg and in no way lenya specific (IMO best for us to use an
> svn:external reference to his svn server instead of providing a copy).

I don't like the idea of relying on some other
organisation's SVN server.

-David

> I
> think we should only enhance it (as we finding bugs) but normally use it
> as it like I tried to explain in FOR-872 and demonstrated in
> http://svn.apache.org/viewcvs?rev=397657&view=rev.
> 
> Regarding the above downsides I agree we should implement *another*
> common xsl (for forrest and lenya - common-apache-odt.xsl) and import it
> in e.g. odt-to-forrest-xhtml.xsl. If we (lenya and forrest as first
> tester) are happy with the results *then* we should patch the common
> (from D. Eisenberg) and send the patch to him that he can incorporate
> them in his next version.
> 
> salu2
> -- 
> thorsten
> 
> "Together we stand, divided we fall!" 
> Hey you (Pink Floyd)
> 

Re: ODT: adding title element to pages

Posted by Thorsten Scherler <th...@apache.org>.
El jue, 27-04-2006 a las 15:28 -0700, Web Maestro Clay escribió:
> On Apr 25, 2006, at 12:40 AM, Thorsten Scherler wrote:
> > 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).
> 
> Although you say we should leave the COMMON as is, but there are  
> holes in the current ODT implementation:
> - no graphics support
> - no support for numbered lists
> - Forrest fixme, warning, note (Forrest-specific, but doesn't Lenya  
> want Fixme, Warning & Note too?)
> - <sub> & <sup>
> - <strong>, <em>
> 
> Shouldn't those be added to the COMMON, so Lenya can benefit as well?

The problem is that the common odt is actually coming from David
Eisenberg and in no way lenya specific (IMO best for us to use an
svn:external reference to his svn server instead of providing a copy). I
think we should only enhance it (as we finding bugs) but normally use it
as it like I tried to explain in FOR-872 and demonstrated in
http://svn.apache.org/viewcvs?rev=397657&view=rev.

Regarding the above downsides I agree we should implement *another*
common xsl (for forrest and lenya - common-apache-odt.xsl) and import it
in e.g. odt-to-forrest-xhtml.xsl. If we (lenya and forrest as first
tester) are happy with the results *then* we should patch the common
(from D. Eisenberg) and send the patch to him that he can incorporate
them in his next version.

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: ODT: adding title element to pages

Posted by Thorsten Scherler <th...@apache.org>.
El jue, 27-04-2006 a las 15:28 -0700, Web Maestro Clay escribió:
> On Apr 25, 2006, at 12:40 AM, Thorsten Scherler wrote:
> > 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).
> 
> Although you say we should leave the COMMON as is, but there are  
> holes in the current ODT implementation:
> - no graphics support
> - no support for numbered lists
> - Forrest fixme, warning, note (Forrest-specific, but doesn't Lenya  
> want Fixme, Warning & Note too?)
> - <sub> & <sup>
> - <strong>, <em>
> 
> Shouldn't those be added to the COMMON, so Lenya can benefit as well?

The problem is that the common odt is actually coming from David
Eisenberg and in no way lenya specific (IMO best for us to use an
svn:external reference to his svn server instead of providing a copy). I
think we should only enhance it (as we finding bugs) but normally use it
as it like I tried to explain in FOR-872 and demonstrated in
http://svn.apache.org/viewcvs?rev=397657&view=rev.

Regarding the above downsides I agree we should implement *another*
common xsl (for forrest and lenya - common-apache-odt.xsl) and import it
in e.g. odt-to-forrest-xhtml.xsl. If we (lenya and forrest as first
tester) are happy with the results *then* we should patch the common
(from D. Eisenberg) and send the patch to him that he can incorporate
them in his next version.

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: ODT: adding title element to pages

Posted by Web Maestro Clay <th...@gmail.com>.
On Apr 25, 2006, at 12:40 AM, Thorsten Scherler wrote:
> 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).

Although you say we should leave the COMMON as is, but there are  
holes in the current ODT implementation:
- no graphics support
- no support for numbered lists
- Forrest fixme, warning, note (Forrest-specific, but doesn't Lenya  
want Fixme, Warning & Note too?)
- <sub> & <sup>
- <strong>, <em>

Shouldn't those be added to the COMMON, so Lenya can benefit as well?

Clay Leeds
the.webmaestro@gmail.com

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




Re: ODT: adding title element to pages

Posted by Clay Leeds <we...@mac.com>.
On Apr 25, 2006, at 1:13 PM, Clay Leeds wrote:
> Earlier today, I got a 404 when I went to that page (after removing  
> the 'and' below, which appended itself to the URL). Now when I see  
> it, this diff looks like a bunch of empty lines to me. What am I  
> supposed to see?

I figured it out... the browser was not showing the elements in  
brackets... I'll view source and see...

Clay Leeds
webmaestro@mac.com

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




Re: ODT: adding title element to pages

Posted by Clay Leeds <we...@mac.com>.
On Apr 25, 2006, at 12:40 AM, Thorsten Scherler wrote:
> 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. ;)

BTW, the filename doesn't appear to be stored anywhere in the  
document, so if we want it, we'll have to pass it in. Then again, I  
don't know if it really matters that much.

> 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).

I like 'common' elements as much as the next guy. However, we'll need  
to make modifications to that 'common' file, since it is missing  
things like a more intelligent <title> element. I would suspect that  
Lenya would want an intelligent <title> element as well.

In any case, I think we're in agreement that forrest-specific stuff  
goes into forrest-specific xsl & lenya-specific stuff goes into lenya- 
specific xsl.

> 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

Earlier today, I got a 404 when I went to that page (after removing  
the 'and' below, which appended itself to the URL). Now when I see  
it, this diff looks like a bunch of empty lines to me. What am I  
supposed to see?

> and
> http://svn.apache.org/viewcvs?rev=394204&view=rev

I can see those files fine.

> HTH


Clay Leeds
webmaestro@mac.com

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




Re: ODT: adding title element to pages

Posted by Thorsten Scherler <th...@wyona.com>.
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


Re: ODT: adding title element to pages

Posted by Clay Leeds <we...@mac.com>.
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?

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




Re: ODT: adding

Posted by Clay Leeds <we...@mac.com>.
On Apr 26, 2006, at 2:00 AM, Ferdinand Soethe wrote:
> Web Maestro Clay wrote:
> I finally had a moment to look it up again. The relevant part is
> actually in openoffice-common-to-forrest.xsl and it does access parts
> meta elements:
>
> <xsl:template match="/">
>     <document>
>       <header>
>         <title>
>           <xsl:choose>
>             <xsl:when test="/office:document/office:meta/dc:title =  
> '' or not(/office:document/office:meta/dc:title)">
>               <xsl:value-of select="$filename"/>

<snip>

> Hope that helps,
>
> --
> Ferdinand Soethe

Thanks for finding. It doesn't really help (IMO), as I don't believe  
there's any difference to the current mechanism. I'll still have to  
figure out how to get the $filename and read meta.xml (in addition to  
content.xml)...

On Apr 25, 2006, at 2:54 PM, Web Maestro Clay wrote:
> I checked, and it doesn't help. It's done there the same way it was  
> done in OOo (by passing the '$filename' xsl:variable). In addition  
> to getting the data out of the meta.xml file, I'll have to figure  
> out how to pass the variable through to the odt_to_xhtml.xsl  
> stylesheet.
>
> Thanks for remembering!

However, David's recent post explaining pipelines and such should help!

Clay Leeds
webmaestro@mac.com

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




Re: ODT: adding

Posted by Ferdinand Soethe <fe...@apache.org>.
Web Maestro Clay wrote:

> I checked, and it doesn't help. It's done there the same way it was
> done in OOo (by passing the '$filename' xsl:variable). In addition to
> getting the data out of the meta.xml file, I'll have to figure out  
> how to pass the variable through to the odt_to_xhtml.xsl stylesheet.

I finally had a moment to look it up again. The relevant part is
actually in openoffice-common-to-forrest.xsl and it does access parts
meta elements:

<xsl:template match="/">
    <document>
      <header>
        <title>
          <xsl:choose>
            <xsl:when test="/office:document/office:meta/dc:title = '' or not(/office:document/office:meta/dc:title)">
              <xsl:value-of select="$filename"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="/office:document/office:meta/dc:title"/>
            </xsl:otherwise>
          </xsl:choose>
        </title>
        <!-- Abstract is required field in HowTos, so always create it and fill with description field  -->
        <abstract>
          <xsl:value-of select="/office:document/office:meta/dc:description"/>
        </abstract>

Hope that helps,

--
Ferdinand Soethe


Re: ODT: adding

Posted by Web Maestro Clay <th...@gmail.com>.
On Apr 25, 2006, at 1:59 PM, Ferdinand Soethe wrote:
> Clay Leeds wrote:
>
>> Do you have a link or path to the file? I surfed svn a bit, and the
>> Forrest HowTo section a bit, but couldn't find it.
>
> No but you could check if the sample file openoffice-writer-howto.sxw
> still works ok and if so find out where it is processed. Probably as
> part of the normal writer-document processing.

Thanks! That was the clue I needed. It wasn't in the HowTo section...  
It was in the OOo-Writer section.

I checked, and it doesn't help. It's done there the same way it was  
done in OOo (by passing the '$filename' xsl:variable). In addition to  
getting the data out of the meta.xml file, I'll have to figure out  
how to pass the variable through to the odt_to_xhtml.xsl stylesheet.

Thanks for remembering!

Clay Leeds
the.webmaestro@gmail.com

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




Re: ODT: adding

Posted by Ferdinand Soethe <fe...@apache.org>.





Clay Leeds wrote:

> Do you have a link or path to the file? I surfed svn a bit, and the  
> Forrest HowTo section a bit, but couldn't find it.

No but you could check if the sample file openoffice-writer-howto.sxw
still works ok and if so find out where it is processed. Probably as
part of the normal writer-document processing.

--
Ferdinand Soethe


Re: ODT: adding

Posted by Clay Leeds <we...@mac.com>.
On Apr 24, 2006, at 11:39 PM, Ferdinand Soethe wrote:
> Not sure if this helps (and don't have time to look it up) but I
> remember having accessed that information when I created the OOo-to
> HowTo-Transformer. Might help to take a look how it is done.
>
> Regards,
> Ferdinand Soethe

Do you have a link or path to the file? I surfed svn a bit, and the  
Forrest HowTo section a bit, but couldn't find it.

Clay Leeds
webmaestro@mac.com

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




Re: ODT: adding

Posted by Ferdinand Soethe <fe...@apache.org>.
Not sure if this helps (and don't have time to look it up) but I
remember having accessed that information when I created the OOo-to
HowTo-Transformer. Might help to take a look how it is done.

Regards,
Ferdinand Soethe

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.

> 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
> the.webmaestro@gmail.com

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

--
Ferdinand Soethe