forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brondsema <d...@brondsema.net>
Subject Re: Hugo ? - Open Writer Plugin.
Date Mon, 14 Mar 2005 15:17:19 GMT
Ferdinand Soethe wrote:
>
> 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.
>

Sounds like a good idea.  Unfortunately, I'm not sure if there's any way
for an XSL template to hook in to an error reporting system.  We could
just change "hugo" to be "Error: Non-Hierarchical OpenOffice.org
Headings" and the user would have to look at the file itself to notice
the error.


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

Mime
View raw message