Re: [docbook-apps] HTML heading tags issue with article

From
Alan Oehler <>
Date
2013-07-16T22:54:19+00:00
ID
CAPGDEsUAqbZjC0oqOePkEoepOz1KNNeZotPCwWPRNsqF=
Thread
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 <> wrote:

Thanks, Bob! 

On Tue, Jul 16, 2013 at 1:11 PM, Bob Stayton <> 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


From: Alan Oehler 

Sent: Tuesday, July 16, 2013 11:11 AM

To: docbook-apps 

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

M: 650.504.7003
www.instartlogic.com

-- 

Alan C. Oehler
Senior Technical Writer | Instart Logic

M: 650.504.7003

www.instartlogic.com

-- 

Alan C. Oehler
Senior Technical Writer | Instart Logic

M: 650.504.7003
www.instartlogic.com