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: epub/chunking : why h1 tags for sections instead of H2?

I'm not sure what is going on here.

I'm trying to make sure that for chunked XHTML/epub output that
chapters have h1 titles, h2 sections and h3 subsections. The reason I
need this is that the Kindle format won't let you style individual
instances of the H1 tag. All Kindle knows how to do is to distinguish
between h1 and h2. (Yeah, Amazon!)

For some reason the epub stylesheets seem to be preventing that.

It works if I try simple html chunking. Namely I have:

 <xsl:import href="../../1latest/docbook-xsl-1.76.1/xhtml-1_1/chunk.xsl"/>
    <xsl:param name="chunk.section.depth" select="0"></xsl:param>

A copy  of the named template component.title with an additional line
(as mentioned here: http://markmail.org/message/774saiew7szgkwhn )

<xsl:when test="ancestor::chapter">0</xsl:when>

When I do that,
book= h1
chapter = h1
section = h2
     section = h3

In other words, perfect!

Using the same parameters and the epub stylesheet, I get something different:

    <xsl:import href="../../1latest/docbook-xsl-1.76.1/epub/docbook.xsl"/>
     (this also imports the xhtml-1_1/chunk.xsl ).

book = h1
chapter = h1
section = h1
    subsection = h2

This is wrong because section should be h2 and subsection should be h3.

I'm guessing  that the problem and the solution lies in the template
named component.title (components.xsl)  or section.level
(sections.xsl). I also notice that epub/docbook.xsl and
xhtml-1_1/component.xsl both have identical component.title templates.
But I'm unclear what's going on here.

I see that these two statements probably have something to do with it:

<xsl:template name="component.title">
  <xsl:variable name="level">
                <xsl:when test="ancestor::section">
                    <xsl:value-of select="count(ancestor::section)+1"/>


  <xsl:element name="h{$level}" namespace="http://www.w3.org/1999/xhtml";>

As I said I'm not sure I follow the sequence, but I'm guessing it's
saying this:  let the variable = the number of sections above the
current node and add one to the level number which corresponds to the
H tag in the output.

It sounds like just adding +2 instead of +1 would do the trick inside
the value-of statement, But when I change it to +2 inside the
xsl:value-of-select statement, everything still looks the same.

Anybody have ideas?

Robert Nagle
12777 Ashford Point Dr #1417
Houston, Texas 77082
713 893 3424

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