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] Persian digits in DocBook XSL numbering!


Hi,
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">&#x661;</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='&#x661;'">
          <xsl:value-of select="'&#x661;'"/>
        </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">&#x661;</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.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Kia Teymourian" <kiat@cs.tu-berlin.de>
To: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, April 05, 2006 2:54 AM
Subject: [docbook-apps] Persian digits in DocBook XSL numbering!


> 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.
>
> Thanks
>
> Kia Teymourian
>
>
> ---------------------------------------------------------------------
> 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]