forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clay Leeds <cle...@medata.com>
Subject Re: OOo Problem with sub-level Headings
Date Tue, 05 Oct 2004 19:46:46 GMT
Charles,

Thanks for the reply, the info and the link. Is this problem solely 
with the openoffice-write.sxw file? My first attempts to use OOo files 
to generate HTML & PDF output worked great. I'm thinking of a 
workaround for this problem

   <!--+
       | headings
       +-->
   <xsl:template match="text:h[@text:level='1']">
     <xsl:call-template name="createSection">
       <xsl:with-param name="currentLevel" select="@text:level"/>
       <xsl:with-param name="prevLevel" select="1"/>
     </xsl:call-template>
   </xsl:template>
   <xsl:template match="text:h[@text:level]">
     <xsl:variable name="level" select="@text:level"/>
     <xsl:call-template name="createSection">
       <xsl:with-param name="currentLevel" select="$level"/>
       <xsl:with-param name="prevLevel" 
select="preceding-sibling::text:h[@text:level &lt; 
$level][1]/@text:level "/>
     </xsl:call-template>
   </xsl:template>
   <xsl:template name="createSection">
     <xsl:param name="currentLevel"/>
     <xsl:param name="prevLevel"/>
     <xsl:choose>
       <xsl:when test="$currentLevel &gt; $prevLevel+1">
         <section>
           <title/>
           <xsl:call-template name="createSection">
             <xsl:with-param name="currentLevel" select="$currentLevel"/>
             <xsl:with-param name="prevLevel" select="$prevLevel +1"/>
           </xsl:call-template>
         </section>
       </xsl:when>
       <xsl:otherwise>
         <section>
           <title>
             <xsl:apply-templates/>
           </title>
           <xsl:apply-templates select="key('rootChildren', 
generate-id())"/>
           <xsl:apply-templates select="key('chieldElements', 
generate-id())"/>
         </section>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>

I would change the following section:

   <xsl:template match="text:h[@text:level]">
     <xsl:variable name="level" select="@text:level"/>
     <xsl:call-template name="createSection">
       <xsl:with-param name="currentLevel" select="$level"/>
       <xsl:with-param name="prevLevel" 
select="preceding-sibling::text:h[@text:level &lt; 
$level][1]/@text:level "/>
     </xsl:call-template>
   </xsl:template>

to something like this:

   <xsl:template match="text:h[@text:level] || text:p 
@text:style-name[.=contains("Heading")]">
     <xsl:variable name="level" select="@text:level"/>
     <xsl:call-template name="createSection">
       <xsl:with-param name="currentLevel" select="$level"/>
       <xsl:with-param name="prevLevel" 
select="preceding-sibling::text:h[@text:level &lt; 
$level][1]/@text:level "/>
     </xsl:call-template>
   </xsl:template>

WDYT?

On Oct 5, 2004, at 2:41 AM, Charles Palmer wrote:
> This rings a bell - I have had issues where OOo variously changes 
> headings
> from <text:h> tags to text:p> tags. See the following extract from a 
> posting
> of mine to user@forrest.apache.org on 18 August:
>
> SNIP:
>
> The openoffice-write.sxw file included in the Forrest examples has 
> something
> broken with the "Heading 3" style, as do all other openoffice .sxw 
> files
> that I created by modifying it. For example, when I take the original
> openoffice-write.sxw, cut out all the text and replace it with a 
> sequence of
> Heading1 to Heading 5 lines, then examine the resulting content.xml (by
> unzipping the sxw file) I get this (note the special treatment for 
> Heading
> 3):
>
> <text:h text:style-name="Heading 1" text:level="1">Heading 1</text:h>
> <text:h text:style-name="Heading 2" text:level="2">Heading 2</text:h>
> <text:p text:style-name="Heading 3">Heading 3</text:p>
> <text:h text:style-name="Heading 4" text:level="4">Heading 4</text:h>
> <text:h text:style-name="Heading 5" text:level="5">Heading 5</text:h>
>
> But if I start a fresh Openoffice file and add the same content I get 
> this:
>
> <text:h text:style-name="Heading 1" text:level="1">Heading 1</text:h>
> <text:h text:style-name="Heading 2" text:level="2">Heading 2</text:h>
> <text:h text:style-name="Heading 3" text:level="3">Heading 3</text:h>
> <text:h text:style-name="Heading 4" text:level="4">Heading 4</text:h>
> <text:h text:style-name="Heading 5" text:level="5">Heading 5</text:h>
>
> I don't know why the Heading 3 style within the openoffice-writer.sxw 
> file
> is screwed up.
>
> /SNIP
>
> I have seen this again on my own documents and I suspect it is a bug 
> in OOo
> but I have not had time to investigate. Maybe I can find an hour or so
> tonight. The thing is that openoffice-write2forrest.xsl processes 
> "headings"
> differently than "paragraphs", and I think that sometimes OOo creates
> something that looks to OOo users like a heading but is actually 
> implemented
> using <text:p> tags, so Forrest treats it differently.
>
> Charles
>
>
> ----- Original Message -----
> From: "Clay Leeds" <cleeds@medata.com>
> To: "Forrest USER" <user@forrest.apache.org>
> Sent: Tuesday, October 05, 2004 12:17 AM
> Subject: OOo Problem with sub-level Headings
>
>
>> I posted the following question to the OpenOffice.org board[1], but it
>> may be more of a Forrest issue.
>>
>> This may be an Apache Forrest http://forrest.apache.org/ problem.
>>
>> I'm having problems with OpenOffice.org output, which I process with
>> Apache Forrest to generate a documentation web site (the
>> documentation's original format is SXW :-)). Normally if I follow the
>> instructions on this page, I get Headings for levels 1-5:
>>
>> http://forrest.apache.org/docs/oowriter.html
>>
>> Unfortunately, I am not getting that now. It might be the result of a
>> NeoOffice/J installation (which is a Java-based OOo port), although I
>> don't think so.
>>
>> Code:
>> <text:h text:style-name="P3" text:level="2">My Heading 2 text</text:h>
>>
>> The above code does actually 'look' like an <H2/> when processed by
>> Forrest. Unfortunately, the following code is now being output by OOo
>> when I apply the Heading 2 style:
>>
>> Code:
>> <text:p text:style-name="Heading 2">Running FOP with 
>> Barcode4J</text:p>
>>
>> Interestingly enough, the above does not look like "Heading 2" but the
>> the previous one does.
>>
>> Any ideas?
>>
>> Web Maestro Clay
>>
>> p.s. BTW, this may be related to another problem I have a workaround
>> for, involving carriage returns being processed incorrectly by
>> forrest[2]. I haven't looked into that problem yet, but this issue may
>> prompt me to revisit that problem.
>>
>> [1]
>> <http://trinity.neooffice.org/modules.php?
>> name=Forums&file=viewtopic&t=748>
>> [2]
>> <http://issues.apache.org/eyebrowse/ReadMsg?
>> listName=user@forrest.apache.org&msgNo=592>
>>
>
>
>
-- 
Clay Leeds - <cleeds@medata.com>
Webmaster/Developer - Medata, Inc. - <http://www.medata.com/>
PGP Public Key: <https://mail.medata.com/pgp/cleeds.asc>


Mime
View raw message