You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Charles Palmer <ch...@dspdesign.com> on 2004/08/13 10:42:27 UTC

OpenOffice: Who is Hugo?

Team

Greatly encuraged by the discovery of OpenOffice support with Forrest 0.6, I set about replicating the standard example, and then modifying it (successfully) before setting out to put some on my real content into an OpenOffice format and trying that. As part of that exercise I modified various OpenOffice styles, so they would look as I wanted when printing a paper (and pdf) version of the document.

Well: 
OpenOffice Heading1 style was rendered the same as in Forrest's example (fine!).
OpenOffice Heading2 and Heading3 styles were rendered within <p> tags only, with no navigation links at the top of the page.
OpenOffice Heading4 style was rendered within <p> tags, but preceeded by HTML tables that look like the original ForresanHeading2 style, containing the text Hugo (!!!). And there are navigation links entitled Hugo at the top of the page! There is no "Hugo" anywhere in my OpenOfice document. 

The PDF files is even more curious, with section numberings prepended before my own section 4 heading, like this:

1.1 hugo
1.1.1 hugo
1.1.1.1 Panel Support  # (this is my actual Heading4 text)
#(body of my paragraph follows)
1.2 hugo
1.2.1 hugo
1.2.1.1 Display Modes  # (this is my second Heading4 text)
#(body of my paragraph follows)

Now, I will back-track to find out what chnage between the Forrest OpenOffice file and my own OpenOfice file has broken the Heading2 and Heading3 presentation, and introduced our friend Hugo. But in the mean time, any pointers would be appreciated..

The rendered HTML includes this:

<a name="N100B2"></a><a name="hugo"></a>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="h4 subheading">
<tbody>
<tr>
<td class="top-left"></td><td></td><td></td>
</tr>
<tr>
<td></td><td>
<h4>hugo</h4>
</td><td></td>
</tr>
<tr>
<td class=" bottom-left"></td><td></td><td></td>
</tr>
</tbody>
</table>
<a name="N100B6"></a><a name="hugo-N100B6"></a>
<h4>hugo</h4>
<a name="N100BA"></a><a name="Panel+Support"></a>
<h5>Panel Support</h5>

(PS - should I send this sort of issue to the users list or the dev list, or does it not matter?)

Charles

Re: OpenOffice: Who is Hugo?

Posted by Charles Palmer <ch...@dspdesign.com>.
Team

I have done some more investigation into why OpenOffice Writer files have
trouble with Heading 3, Heading 4 and Heading 5 styles. I seeded a new site,
and added 3 files:

1    Made a copy of the original Forrest openoffice-writer.sxw, and added
some text at the end including Heading 3, Heading 4 and Heading 5 styles.
Result: "hugo" appears in the navigation section at the top and in the
rendered html at the bottom of the file. - ie the faults previously
described.

2    Made a copy of the original Forrest openoffice-writer.sxw, stripped out
all of the contents, then added a succession of Heading 1 to Heading 5
lines, each with one line of Default style following. Result: Result: "hugo"
appears in the navigation section at the top and in the rendered html at the
bottom of the file. - ie the faults previously described.

3    Made a new OpenOffice text document, and added the text described in
(2) above. Result: Expected operation: no sign of "hugo", and the rendered
HTML seems sensible (except - minor point - both Heading 4 and Heading 5
text are rendered within the same <h5> tags).

So my preliminary conclusion would be that there is something wrong with the
original Forrest openoffice-writer.sxw file that breaks when Heading 3
styles are included. It looks as though any other OpenOffice files that are
derived from the original also inherit the fault.

Of course - there may be more to it that this - I will try some more complex
files and see what happens.

Charles







Re: OpenOffice: Who is Hugo?

Posted by Dave Brondsema <da...@brondsema.net>.
On Tue, 17 Aug 2004, Charles Palmer wrote:

> Team
>
> I made a more complex document (based on a fresh OpenOffice document, rather
> than the Forrest openoffice-writer.sxw) with various instances of different
> headings etc. It seemed to work OK but:
>
> Forrest doesn't seem to like a Heading 4 following a Heading 2 without an
> intervening Heading 3 - we get hugo showing up again. Interestingly, when I
> save the file from OpenOffice in DocBook format, Open Office inserts an
> empty Heading 3 <title/> tag  in between the Heading 2 stuff and the Heading
> 4 stuff:
>

I think the ooffice->docv12 stylesheet makes heading X nested X levels
deep.  There's no other way in docv12 to specify a type of section other
than how deep it's nested.  So that's why a heading 3 is necessary.
Similarly DocBook (I think) requires sect4 to be within sect3, not within
sect2.  So a title-less sect3 is created by openoffice.

Tonight I'll remove the hugo title and make that section have no title.

> <sect2><title>ANOTHER H2</title>
> <para>some text.</para>
> <sect3><title/>
> <sect4><title>A spurious H4</title>
> <para>to see what happens</para>
> <para/>
> <para/></sect4></sect3></sect2></sect1></article>
>
> Essentially the same thing happens if a Heading 3 follows a Heading 1
> without an intervening Heading 2.
>
> Now, I don't think this explains the problems with Forrest's
> openoffice-writer.sxw, but it may shine a little light on the problem.
>



-- 
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
http://csx.calvin.edu : student org

Re: OpenOffice: Who is Hugo?

Posted by Charles Palmer <ch...@dspdesign.com>.
Dave Brondsema wrote:

> I looked at the XML of the file you sent me and it did not have
> text:level="3" on the heading 3 node like it should've.  All the other
> ones did.  I created a new file and it worked fine.

Exactly!

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.

So there are two problems:

1    The Heading 3 style within the openoffice-writer.sxw file (and any
files that you derive from it) is screwed up.

2    The Forrest openoffice .xsl file that transforms openoffice files to
Forrest format doesn't behave gracefully when a heading level is missing
(inserts "hugo" amongst other things").

So when I edited openoffice-writer.sxw to add Heading 3 and Heading 4
styles, the Heading 3 style was treated as a paragraph rather than as a
heading, then the missing Heading 3 level caused screw-ups in the xsl
transformation, introducing "hugo" and other faults.

So could I suggest that:

1    You re-create the openoffice-writer.sxw sample file to fix the Heading
3 style, so that others who follow after me don't fall into the same hole,
and

2    Look to see if the .xsl file can behave more gracefully when heading
levels are missing from the sequence.

Charles





Re: OpenOffice: Who is Hugo?

Posted by Dave Brondsema <da...@brondsema.net>.
On Tue, 17 Aug 2004, Charles Palmer wrote:

> Team
>
> I made a more complex document (based on a fresh OpenOffice document, rather
> than the Forrest openoffice-writer.sxw) with various instances of different
> headings etc. It seemed to work OK but:
>
> Forrest doesn't seem to like a Heading 4 following a Heading 2 without an
> intervening Heading 3 - we get hugo showing up again. Interestingly, when I
> save the file from OpenOffice in DocBook format, Open Office inserts an
> empty Heading 3 <title/> tag  in between the Heading 2 stuff and the Heading
> 4 stuff:
>

I looked at the XML of the file you sent me and it did not have
text:level="3" on the heading 3 node like it should've.  All the other
ones did.  I created a new file and it worked fine.

You can view the content.xml file by opening the .sxw file with any
unzipping utility.

I removed the hugo title, but I found that it skips some sections if the
depths do not descend in order (e.g. 1 2 3 4 9 5 skips 9 and 5).  I'll
file an issue for it so it isn't forgotten.

> <sect2><title>ANOTHER H2</title>
> <para>some text.</para>
> <sect3><title/>
> <sect4><title>A spurious H4</title>
> <para>to see what happens</para>
> <para/>
> <para/></sect4></sect3></sect2></sect1></article>
>
> Essentially the same thing happens if a Heading 3 follows a Heading 1
> without an intervening Heading 2.
>
> Now, I don't think this explains the problems with Forrest's
> openoffice-writer.sxw, but it may shine a little light on the problem.
>
> Charles
>
>
>
>

-- 
Dave Brondsema : dave@brondsema.net
http://www.brondsema.net : personal
http://www.splike.com : programming
http://csx.calvin.edu : student org

Re: OpenOffice: Who is Hugo?

Posted by Charles Palmer <ch...@dspdesign.com>.
Team

I made a more complex document (based on a fresh OpenOffice document, rather
than the Forrest openoffice-writer.sxw) with various instances of different
headings etc. It seemed to work OK but:

Forrest doesn't seem to like a Heading 4 following a Heading 2 without an
intervening Heading 3 - we get hugo showing up again. Interestingly, when I
save the file from OpenOffice in DocBook format, Open Office inserts an
empty Heading 3 <title/> tag  in between the Heading 2 stuff and the Heading
4 stuff:

<sect2><title>ANOTHER H2</title>
<para>some text.</para>
<sect3><title/>
<sect4><title>A spurious H4</title>
<para>to see what happens</para>
<para/>
<para/></sect4></sect3></sect2></sect1></article>

Essentially the same thing happens if a Heading 3 follows a Heading 1
without an intervening Heading 2.

Now, I don't think this explains the problems with Forrest's
openoffice-writer.sxw, but it may shine a little light on the problem.

Charles




Re: OpenOffice: Who is Hugo?

Posted by Dave Brondsema <da...@brondsema.net>.
Charles Palmer wrote:
> I've found Hugo! Here is is, buried in line 78 of 
> forrest-0.6\src\core\context\resources\stylesheets\openoffice-writer2forrest.xsl:
>  
>   <xsl:template name="createSection">
>     <xsl:param name="currentLevel"/>
>     <xsl:param name="prevLevel"/>
>     <xsl:choose>
>       <xsl:when test="$currentLevel &gt; $prevLevel+1">
>         <section>
>           <title>hugo</title>
>           <xsl:call-template name="createSection">
>  
> But what he's doing there and how to dig him out I don't know. (I'm not 
> very good with xsl). I suspect he's an artifact of some error that's 
> crept in several levels up...
>  
> A job for dev@forrest.apache.org <ma...@forrest.apache.org>?
>  
> Charles

Thanks for figuring that out!  I'll fix it now, but I'd like to test it 
and make sure it works properly.  Can you send your .sxw file?

-- 
Dave Brondsema : dave@brondsema.net
http://www.splike.com : programming
http://csx.calvin.edu : student org
http://www.brondsema.net : personal

Re: OpenOffice: Who is Hugo?

Posted by Charles Palmer <ch...@dspdesign.com>.
I've found Hugo! Here is is, buried in line 78 of forrest-0.6\src\core\context\resources\stylesheets\openoffice-writer2forrest.xsl:

  <xsl:template name="createSection">
    <xsl:param name="currentLevel"/>
    <xsl:param name="prevLevel"/>
    <xsl:choose>
      <xsl:when test="$currentLevel &gt; $prevLevel+1">
        <section>
          <title>hugo</title>
          <xsl:call-template name="createSection">

But what he's doing there and how to dig him out I don't know. (I'm not very good with xsl). I suspect he's an artifact of some error that's crept in several levels up...

A job for dev@forrest.apache.org?

Charles

Re: OpenOffice: Who is Hugo?

Posted by Charles Palmer <ch...@dspdesign.com>.
Team

Further to my initial report of this problem I have conducted further experiments:

I took the Forrest OpenOffice sample file, stripped out all of the content and added one line each (in succession) of the styles called Heading1 - Heading5, then text body, then default style. Results:

Heading1 is rendered with <h3> tags embedded within a table. It has a navigation entry at the top and an <a> anchor just before the table.
Heading2 is rendered with <h4> tags embedded within a table (of different colour). It has a navigation entry at the top and an <a> annchor just before the table.
Heading3 is rendered within <p> tags, without a navigation entry or an <a> anchor.
Headings4 rendered within <h5> tags. It has a navigation entry at the top with text reading"hugo", and with an anchor and "hugo" prepended as shown here:

<a name="N10011"></a><a name="hugo"></a>
<h4>hugo</h4>
<a name="N10015"></a><a name="Heading+4"></a>
<h5>Heading 4</h5>

Heading5 is rendered within <h5> tags, without a navigation entry at the top, BUT WITH an <a> anchor just before the text.

So only Heading1 and Heading2 are rendered "properly".

I won't burden you with the details, but in some cases these same styles (including Heading2) are rendered differently from this within my own OpenOffice document (in which I have adjusted the styles).

Surely some mistake? Is the OpenOffice rendered with an XSL file? If you pointed me at it I can see if I could fix it.

Charles