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: [docbook-apps] Subject: epub/chunking : why h1 tags for sectionsinstead of H2?


On Tue, Mar 15, 2011 at 21:25, Robert Nagle <idiotprogrammer@gmail.com> wrote:
> [snip]
>
> 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.
>
> [snip]
>
> 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 ).
>
> Result:
> 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:choose>
>                <xsl:when test="ancestor::section">
>                    <xsl:value-of select="count(ancestor::section)+1"/>
>                </xsl:when>
> ...
> </xsl:choose>
>
>  </xsl:variable>
>  </xsl:template>
>
>  <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?

Are you sure everything looks the same?  Based on the code you’ve
posted and the code in the repo[1] it seems to me that if you make it
+2, all sections nested at least one level should gain an extra
heading level.  In other words, what you seem to have changed is the
case when the element being processed has at least one ‘section’
ancestor.  You could try this:

1. Change the +1 to +2.
2. Increase the values on lines 1667–1671 by one. (Just the values,
not the tag names, obviously.)
3. Add this line before the ‘xsl:otherwise’:

  <xsl:when test="local-name($node) = 'section'">2</xsl:when>

Untested, mind you. :-)

Aankhen

[1]: http://docbook.svn.sourceforge.net/viewvc/docbook/trunk/xsl/epub/docbook.xsl?revision=8910&view=markup#l1662


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