forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@apache.org>
Subject Re: [jira] Commented: (FOR-872) Updated odt_to_xhtml.xsl to pass <title> & <h1> elements.
Date Fri, 05 May 2006 10:01:34 GMT
Clay Leeds (JIRA) wrote:
>     [ http://issues.apache.org/jira/browse/FOR-872?page=comments#action_12377927 ] 
> 
> Clay Leeds commented on FOR-872:
> --------------------------------
> 
> BTW, you could add the following to resources/stylesheets/odt-to-forrest-xhtml.xsl to
get T1 to be styled as STRONG/BOLD:
> 
>   <xsl:template match="text:p/text:span[@text:style-name='T1']">
>     <strong>
>       <xsl:apply-templates/>
>     </strong>
>   </xsl:template>

I've not looked at your full stylesheets yet, but have a comment on the 
above.

The problem with this kind of approach is that it assumes that "T1" is 
always "strong". My experience with OOo tells me this is a bad 
assumption (may have changed in OOo2.

It is better to dynamically generate the CSS from the styles definitions 
in the ODT file. They are already in CSS format so it is not a big job. 
I did this in the OOo plugin as an experiment [1]. What it does is use 
the template below to generate the style definitions in the head of the 
XDoc, but see [2] for some discussion about this.

<xsl:template name="style">
     <!-- HACK: This makes intermediate documents invalid per the
     Forrest Document DTD. To find out why this is done this way
     nonetheless, read the comments attached to issue FOR-433. -->
     <style>
       <xsl:apply-templates select="//office:styles/style:style"/>
       <xsl:apply-templates select="//office:automatic-styles/style:style"/>
     </style>
</xsl:template>

Now, as you can see this not valid in the XDoc schema. It works, but it 
is a hack (at least it did in my experiments, but that was a long time 
ago, things may have changed to break it now). Instead of embedding the 
content in the XDoc head we should have a separate request that 
generates the extra-css for the skinnning stage. We had a discussion 
about how to do this recently [3]

My ultimate goal with these experiments (which stalled a long time ago) 
was to allow a subset of the OOo style information to pass through to 
the rendering of a Forrest content object. The idea was to have this 
subset defined in a config file, thus individual users would be able to 
say what style information from OOo was vald in their final output. For 
example, they could choose to not allow colour definition trough in 
order to ensure a consistent colour scheme, but to allow underlines through.

Ross

[1] 
http://svn.apache.org/viewcvs.cgi/forrest/trunk/plugins/org.apache.forrest.plugin.input.OpenOffice.org/resources/stylesheets/openoffice-common-to-forrest.xsl?rev=332656&view=markup
[2] http://issues.apache.org/jira/browse/FOR-433
[3] http://marc.theaimsgroup.com/?l=forrest-dev&m=114605585503695&w=2

Mime
View raw message