OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: Reasoning behind epub <h> level numbering


Thanks Robert. That solution gives me the H level numbers I'd expect for all section levels. I also had to customise the template for bridgeheads, because that was generating an H number that was one level higher than it should be (e.g. sect1 was rendered as H1).

In <xsl:template match="d:bridgehead"> I changed the following:

<xsl:variable name="hlevel">
      <xsl:choose>
        <!--workaround added 22/2/12:-->
        <xsl:when test="@renderas = 'sect1'">2</xsl:when>
        <xsl:when test="@renderas = 'sect2'">3</xsl:when>
        <xsl:when test="@renderas = 'sect3'">4</xsl:when>
        <xsl:when test="@renderas = 'sect4'">5</xsl:when>
        <xsl:when test="@renderas = 'sect5'">6</xsl:when>
       
        <xsl:otherwise>
          <xsl:value-of select="$clevel + 1"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

Then I compared the epub output with web output and realised the web stylesheets were generating the wrong H level number for the components preface, glossary, bibliography and index (these were H2). So in component.xsl (for XHTML 1-1) my customisation is now:

<xsl:template name="component.title">
...
 <!--workaround 22/2/12 - removed $level+1 :-->
        <xsl:element name="h{$level}" namespace="http://www.w3.org/1999/xhtml">

It's interesting (confusing?) that this is part of coding for "when a component occurs inside a section" - when would that ever happen?

On 22-02-12 6:47 AM, Robert Nagle wrote:
With regard to this problem, I wrote this description of how I solved
it last year. It probably is not the ideal solution, but it worked for
me..... Hopefully the epub3 won't have this problem (and Kindle Fire
won't have it).  The main reason it mattered was that Kindle 3 and
below only did styling for H tags.

rj



Because of a Docbook bug, chapters and sections and subsections are
all h1. This is bad for Kindle format (i.e., Kindle 3)  because that
is the only way to contrast headings. Kindle can only differentiate
between h1, h2, h3 and not h1.chapter, h1.section, h1.subsection.

I have noticed that when you use the epub/docbook.xsl stylesheet,  by
default epub output shows h1 for both  chapters and sections (which is
bad).  Sections are supposed to output h2, subsections as h3, etc.
With epub output, this problem is not so bad because you can create a
css rule for div.chapter and div.section, but still that is not right.
 I think there is a bug in epub/docbook.xsl which causes this.  To fix
this, I copied the entire contents of  the code inside and including
<xsl:template name="section.heading">from epub/docbook.xsl into my XSL
customization layer and simply edited one line:


<xsl:variable name="hlevel">
<xsl:choose>
<!-- highest valid HTML H level is H6; so anything nested deeper than
7 levels down just becomes H6
 Note from Robert: I added + 1 on the xsl: otherwise statement-->
 <xsl:when test="$level &gt; 6">6</xsl:when> <xsl:otherwise>
<xsl:value-of select="$level+1"/> </xsl:otherwise> </xsl:choose>
</xsl:variable>




--
Dave Gardiner
Xmplar
info@xmplar.biz
http://xmplar.biz
Mob. 0416 833 993


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]