OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

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

Subject: Re: [docbook] XSL - Getting the Chapter number

Hi John,
First, if you are using the -ns- namespaced stylesheets with DocBook 5 documents, make sure that all instances of element names in your customization layer have the docbook namespace prefix, otherwise they won't match on your elements.  So if it currently has "chapter", it should be changed to "d:chapter" with the namespace declaration at the top.
Without further review, it is hard to say why position() no longer works.  That can be a tricky function to use, as described in this recent email exchange:
The DocBook stylesheets include a number of utility templates, including those for numbering elements. They  use mode="label.markup", and simply return the number of the element. You can use something like this in a template matching on d:chapter:
<xsl:apply-templates select="." mode="label.markup"/>
See this reference for more on the utility templates:
Bob Stayton
Sagehill Enterprises
----- Original Message -----
Sent: Thursday, May 12, 2011 12:57 PM
Subject: [docbook] XSL - Getting the Chapter number

I am currently moving a 4.2 docbook file at work to use docbook 5.0 and I am nearly finished, though I have stumbled on a problem.

The problem I have is with a custom style sheet that is used at work, it made used to an old version of the docbook-xsl files that are found at the sourceforge, and when I updated the 4.2 xml file I downloaded the latest version of the docbook-xsl-ns files and started to change the custom xsl sheet to work.

The custom style sheet in question is used to translate the xml file into the fo format so that it can be converted to a pdf document.  At one point in the custom xsl sheet the original author stuck in a call to the position() function in a chapter template to get the current chapter number for a page header.

Though the use of position() does not appear to work after the update with the chapter numbers for that page header start with 2 instead of 1. 

This actually doesn't affect the other instances of the where the chapter number is used, like in the pdf's bookmarks or the table of contents, which leads me to believe that there must be some method in the docbook-xsl-ns fo files that can be used to to get the current chapter number, as opposed to ending up using "position()-1"

Any ideas?

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