Thanks Bob, this works really well for sections with numbers like 6.2. However,
if I try it passing in 11.3.1 I get:
XPath error : Invalid expression
11.3.1
^
runtime error
Evaluating user parameter start.numbering.at failed
Is there a way to get it to work to a depth of three or four sub-sections?
- Josh
----- Original Message -----
> From: "Bob Stayton" <[email protected]>
> To: "Joshua Wulf" <[email protected]>, "DocBook Apps"
> <[email protected]>
> Sent: Friday, April 5, 2013 4:48:41 AM
> Subject: [docbook-apps] 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
> [email protected]
>
> --------------------------------------------------
> From: "Joshua Wulf" <[email protected]>
> Sent: Wednesday, April 03, 2013 10:02 PM
> To: <[email protected]>
> 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: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]