docbook-apps

  • 1.  WebHelp - consistent topic headings

    Posted 02-10-2015 14:07
    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



  • 2.  Re: [docbook-apps] WebHelp - consistent topic headings

    Posted 02-10-2015 18:06
    Following code segment in webhelp-common.xsl does the generation of this
    heading in the webhelp header section. I'm too lazy right now to understand
    how all the generation happens. :)


    <xsl:apply-templates select="/*[1]" mode="title.markup"/>


    <xsl:choose>
    <xsl:when
    test="count($up) > 0 and generate-id($up) !=
    generate-id($home)">
    <xsl:apply-templates select="$up"
    mode="object.title.markup"/>
    </xsl:when>
    <xsl:when test="not(generate-id(.) = generate-id(/*))">
    <xsl:apply-templates select="."
    mode="object.title.markup"/>
    </xsl:when>
    <xsl:otherwise> </xsl:otherwise>
    </xsl:choose>





    On Tue, Feb 10, 2015 at 7:36 PM, Janice Manwiller <janice@sqrrl.com> 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
    >



    --
    ~~~*******'''''''''''''*******~~~
    *Kasun Gajasinghe*
    Software Engineer; WSO2 Inc.; http://wso2.com,
    *linked-in: *http://lk.linkedin.com/in/gajasinghe
    *blog: **http://blog.kasunbg.org* <http://blog.kasunbg.org/>


    *twitter: **http://twitter.com/kasunbg* <http://twitter.com/kasunbg>



  • 3.  Re: [docbook-apps] WebHelp - consistent topic headings

    Posted 02-10-2015 18:56
    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

    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



  • 4.  Re: [docbook-apps] WebHelp - consistent topic headings

    Posted 02-11-2015 19:43
    Thanks for the help.

    Because we always start a new topic with each section, I was able to
    simplify this a bit.

    I just added customizations to hardcode all section headings to be h2, and
    all bridgeheads to be h3.

    Book and chapter titles remain at h1.

    Janice

    On Tue, Feb 10, 2015 at 1:55 PM, Bob Stayton <bobs@sagehill.net> wrote:

    > 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

    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
    >>
    >


    --
    Janice Manwiller
    Principal Technical Writer
    Sqrrl Data, Inc.
    www.sqrrl.com | @SqrrlData