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] WebHelp - consistent topic headings


Hi Janice,
Yes, there is a way to do this. You'll need to create a stylesheet customization layer and customize the template named 'section.heading' copied from xhtml/sections.xsl.

That template computes a variable named 'hlevel' that sets the HTML heading level. The default is to take the section level and add 1 (this assumes the content is within a chapter or article). You can modify that xsl:choose to do something else.

In your case, you need to determine the depth of the current section in the current chunk. There is a utility template named 'chunk' that can be called to test whether an element generates its own chunk:

  <xsl:variable name="is.chunk">
    <xsl:call-template name="chunk">
      <xsl:with-param name="node" select="."/>
    </xsl:call-template>
  </xsl:variable>

The "chunk" template returns 1 if the param node is a chunk, or zero otherwise. Since the context node for 'section.heading' is the current section element, a test for the current section would be with node="." Then the test inside hlevel is:

<xsl:when test ="$is.chunk != 0">1</xsl:when>

and this sets $hlevel = 1 to generate an <h1> in the output.

If this is not a chunk, then you need to check the current node's parent by calling the "chunk" template with $node set to ".." to select the parent. If it is then, set hlevel = 2, and so on. You'll either need to go as many steps as you have section levels, or rewrite this as a recursive template that works its way up the tree from the current node.

Let me know if you need more details in coding this.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

On 2/10/2015 6:06 AM, Janice Manwiller wrote:
When generating WebHelp, the headings always reflect the level within
the document.

So heading at the top of a topic could be a heading 1, heading 2,
heading 3, etc. depending on where it falls in the structure of the
document.

What I'd prefer is to have the heading at the top of the topic always be
the same, presumably heading 1. If there are subheadings within a topic
(from bridgeheads or because of different chunking), then they should
start with heading 2.

Is there any way to do this?

Thanks,

Janice


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