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] Arbitrarily start section numbering?


[moving this over to the docbook-apps mailing list where stylesheet issues are discussed]

Yes, this can be done with a small customization:

<xsl:param name="start.numbering.at" select="0"/>

<xsl:template match="section" mode="label.markup">
 <xsl:choose>
   <xsl:when test="$start.numbering.at != 0 and not(ancestor::section)">
     <xsl:value-of select="$start.numbering.at"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:apply-imports/>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

The 'label.markup' mode is used to generate a number for an element. In this case, it only applies to top level sections. Or you could test to see if it is the root element by using not(ancestor::*). Nested sections are numbered from there because each level of section number is generated by first computing the ancestor numbers, so the first subsection would be 6.2.1.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

--------------------------------------------------
From: "Joshua Wulf" <jwulf@redhat.com>
Sent: Wednesday, April 03, 2013 10:02 PM
To: <docbook@lists.oasis-open.org>
Subject: [docbook] Arbitrarily start section numbering?

Can I give an argument to xsltproc to have the docbook style sheets transform my section with an arbitrary section number, rather than starting at "1"?

I'd like to be able to do this, in essence:

xsltproc --output myrenderedsection.html \
 --stringparam start.numbering.at 6.2 \
 html/docbook.xsl section.xml

- Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-help@lists.oasis-open.org





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