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] Re: [docbook] Arbitrarily start section numbering?


Hi,
Oh, that's a data type problem. The XSLT processor is trying to interpret the value as a number. Put the value inside single quotes to convert it to a string and then it should work.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

--------------------------------------------------
From: "Joshua Wulf" <jwulf@redhat.com>
Sent: Sunday, April 07, 2013 10:27 PM
To: "Bob Stayton" <bobs@sagehill.net>
Cc: "DocBook Apps" <docbook-apps@lists.oasis-open.org>
Subject: Re: [docbook-apps] Re: [docbook] Arbitrarily start section numbering?

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" <bobs@sagehill.net>
To: "Joshua Wulf" <jwulf@redhat.com>, "DocBook Apps" <docbook-apps@lists.oasis-open.org>
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
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
>
>
>

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






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