Bob Stayton
> Is it possible to change the DocBook XSL numbering language /
> character format, to have chapters or section numbers in
> Persian language.
>
> I should get Unicode Persian digits in my Persian
> documentation, in native digits.
>
> http://www.unicode.org/charts/PDF/U0600.pdf
>
> Char Dec. Hex Name
> 0 1632 0660 ARABIC-INDIC DIGIT ZERO
> 1 1633 0661 ARABIC-INDIC DIGIT ONE
> 2 1634 0662 ARABIC-INDIC DIGIT TWO
> 3 1635 0663 ARABIC-INDIC DIGIT THREE
> 4 1636 0664 ARABIC-INDIC DIGIT FOUR
> 5 1637 0665 ARABIC-INDIC DIGIT FIVE
> 6 1638 0666 ARABIC-INDIC DIGIT SIX
> 7 1639 0667 ARABIC-INDIC DIGIT SEVEN
> 8 1640 0668 ARABIC-INDIC DIGIT EIGHT
> 9 1641 0669 ARABIC-INDIC DIGIT NINE
>
> Should I use the xsl:number lang or format in my customizing
> layer?
> My processing system is Saxon 6.5.3, Linux, DocBook XSL 1.69.1.
In XSLT in general, you would add format="١", which is the
number 1 in Arabic-Indic numbers. That tells the XSLT processor
to use that sequence of numbers instead of the sequence starting
with "1". In the DocBook XSL stylesheets, though, you often don't need to
use xsl:number directly because there are parameters and utility
templates for setting number formats. You must use version
1.69.1 or later of the stylesheets. For example, to set the chapter number format, set this
parameter:
<xsl:param name="chapter.autolabel">١</xsl:param>
Unfortunately, this doesn't quite work because the template that
sets the xsl:number checks to see if the specified format matches
one of the predefined formats (1, A, a, I, i). This
customization adds Arabic-Indic to that list of accepted formats
(this template is from common/labels.xsl):
<xsl:template name="autolabel.format">
<xsl:param name="context" select="."/>
<xsl:param name="format"/>
<xsl:choose>
<xsl:when test="string($format) != 0">
<xsl:choose>
<xsl:when test="$format='arabic' or
$format='1'">1</xsl:when>
<xsl:when test="$format='loweralpha' or $format='a'">
<xsl:value-of select="'a'"/>
</xsl:when>
<xsl:when test="$format='lowerroman' or $format='i'">
<xsl:value-of select="'i'"/>
</xsl:when>
<xsl:when test="$format='upperalpha' or $format='A'">
<xsl:value-of select="'A'"/>
</xsl:when>
<xsl:when test="$format='upperroman' or $format='I'">
<xsl:value-of select="'I'"/>
</xsl:when>
<xsl:when test="$format='arabicindic' or
$format='١'">
<xsl:value-of select="'١'"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unexpected </xsl:text><xsl:value-of
select="local-name(.)"/><xsl:text>.autolabel value: </xsl:text>
<xsl:value-of select="$format"/><xsl:text>; using
default.</xsl:text>
</xsl:message>
<xsl:call-template name="default.autolabel.format"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:template>
This change should go into the main stylesheets, though.
If you also want to set the page numbering to Arabic-Indic, then
use these two templates:
<xsl:template name="page.number.format">١</xsl:template>
<xsl:template name="initial.page.number">auto</xsl:template>
The first one sets the page number format for all page-sequences,
and the second sets a single numbering sequence throughout the
document. In English, the front matter starts with i, and then
switches to 1 and restarts numbering. If you still want that,
then customize the original versions of these templates (located
in fo/pagesetup.xsl).
If you want to use Arabic-Indic numbering in procedures and
steps, then you will need to customize those templates and use
xsl:number with the format attribute. |