forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ferdinand Soethe <samm...@soethe.net>
Subject Re: Hugo ? - Open Writer Plugin.
Date Mon, 14 Mar 2005 14:53:13 GMT


Dave Brondsema wrote:

DB> The OO.o plugin does not properly handle headers, so you may encounter
DB> other weird issues too.  I think things work best if you have an ordered
DB> heirarchy of headings, like this:

DB> heading1
DB> heading2
DB> heading2
DB> heading2
DB> heading3
DB> heading2
DB> heading1
DB> heading2

DB> and not jump from 1 to 3 for example because the stylesheet doesn't know
DB> how to create proper <section>s out of that.

I think it is important to know that the OO-Plugin processes documents
assuming a correct hierarchie of headings. It's technical approach
enforces this assumption by

- using headlines as a starting point (template match) for the
  processing of all elements.

  (This in fact helps translate the flat structure of oo-files (headings
  are not parents of paragraphs) into the hierarchie of forrest
  documents where the section surrounds all the elements within it.)

  and

- checking that a headline is never more than one level below the
  previous one (which is, I believe, the recommended use in html as
  well)

The mysterios 'hugo' is actually no more that a strange way to report
a layering error in common2forrest-stylesheet:

>   <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">
>             <xsl:with-param name="currentLevel" select="$currentLevel"/>
>             <xsl:with-param name="prevLevel" select="$prevLevel +1"/>
>           </xsl:call-template>
>         </section>
>       </xsl:when>
>       <xsl:otherwise>
>         <section class="{.}">
>           <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>

Rather then fixing (that is removing this check), how about replacing
it with some other way of reporting and rewrite the template like

>  <xsl:template name="createSection">
>     <xsl:param name="currentLevel"/>
>     <xsl:param name="prevLevel"/>
>     <xsl:choose>
>         <xsl:if test="$currentLevel &gt; $prevLevel+1">
>             new error reporting here
>         </xsl:if>
>         <section class="{.}">
>           <title>
>             <xsl:apply-templates/>
>           </title>
>           <xsl:apply-templates select="key('rootChildren', generate-id())"/>
>           <xsl:apply-templates select="key('chieldElements', generate-id())"/>
>         </section>
>   </xsl:template>

If somebody suggests which reporting mechnisms to use here, I'll add
this to the changes to the ooplugin (support for howtos) I'll be
posting this week.

Cheers,
Ferdinand



--
Ferdinand Soethe


Mime
View raw message