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] HTML heading tags issue with article


Aha! Thanks, I'd probably have never figured that out.

Alan


On Fri, Jul 19, 2013 at 9:50 AM, Bob Stayton <bobs@sagehill.net> wrote:
Hi Alan,
Close, but you want to use this test instead:
 
<xsl:when test="$node/self::article">0</xsl:when>
The context node for this template is title, but the $node param contains the parent element of the title, so that is why self::article would work here.  The parent::book syntax is used to select all *children* of a book, which gives h1 to chapter titles and such.
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

Sent: Tuesday, July 16, 2013 3:54 PM
Subject: Re: [docbook-apps] HTML heading tags issue with article

Hmmm... looks like it should be easy, but I've had no luck.

Here's the code you referred to:

  <xsl:variable name="level">
    <xsl:choose>
      <!-- chapters and other book children should get <h1> -->
      <xsl:when test="$node/parent::book">0</xsl:when>
      <xsl:when test="ancestor::section">
        <xsl:value-of select="count(ancestor::section)+1"/>
      </xsl:when>
      <xsl:when test="ancestor::sect5">6</xsl:when>
      <xsl:when test="ancestor::sect4">5</xsl:when>
      <xsl:when test="ancestor::sect3">4</xsl:when>
      <xsl:when test="ancestor::sect2">3</xsl:when>
      <xsl:when test="ancestor::sect1">2</xsl:when>
      <xsl:otherwise>1</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

I added a line 

  <xsl:when test="$node/parent::article">0</xsl:when>

after the similar line with "book," but it had no apparent effect on the output.

Alan



On Tue, Jul 16, 2013 at 1:14 PM, Alan Oehler <aoehler@instartlogic.com> wrote:
Thanks, Bob! 


On Tue, Jul 16, 2013 at 1:11 PM, Bob Stayton <bobs@sagehill.net> wrote:
Hi Alan,
Article titles are handled by the template named 'component.title' in the component.xsl stylesheet file.  There is an xsl:choose statement in there that sets the "section level", to which 1 is added to get the <h> level.  That template does not properly handle article titles, which should get a section level of zero.  But it is a short template and you can customize it.
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

Sent: Tuesday, July 16, 2013 11:11 AM
Subject: [docbook-apps] HTML heading tags issue with article

I'm puzzled by some behavior I observed generating some HTML documents. The source files are articles. The article section titles seem to be coming out as I would expect - sect1 title is tagged as an h2, sect2 as an h3, etc. But the article's title itself, which the documentation clearly says should be output as an h1, is coming out as an h2. Looking at the file html/titlepage.xsl, it clearly is inserting an h1. 

I had a custom spec file which doesn't do much except not show some of the things that are usually output by default:
<t:titlepage t:element="article" t:wrapper="div" class="titlepage">
  <t:titlepage-content t:side="recto">
    <title/>
    <subtitle/>
  </t:titlepage-content>
  ...

I merely removed the usual set of elements inside the t:titlepage-content element, leaving just the title and subtitle, then generated my titlepage XSL from it.

My grasp of XSLT is tenuous at best, and the complexity of the cover page customization is such that my head is swimming trying to see where the h2 is coming from.

Here's what the rendered article title looks like in the output. (It also strikes me as odd that there are so many divs in there...)
...
<body>
<div class="article" id="idp8939920">
  <div class="titlepage">
    <div>
      <div>
         <h2 class="title">My article title</h2>
      </div>
    </div>
  </div>
...

Any hints about how I can attack this - other than do something kludgey like give the article title a role attribute like, say,"realtitle" and use CSS to style a h2 of class"realtitle" to be a bit bigger?

Thanks!

--
Alan C. Oehler
Senior Technical Writer | Instart Logic



--
Alan C. Oehler
Senior Technical Writer | Instart Logic



--
Alan C. Oehler
Senior Technical Writer | Instart Logic



--
Alan C. Oehler
Senior Technical Writer | Instart Logic
M: 650.504.7003
www.instartlogic.com


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