Docbook XSL Stylesheets

1. Acronym processing
2. Persian digits in DocBook XSL numbering
3. Admonition Graphics missing.

1.

Acronym processing

Mike Smith



> 3. I would have guessed that it would have been better to output something 
> like this in HTML:

> <acronym title="eXtended Markup Language">XML</acronym>

We added a change back in September (after the 1.69.1 release) that causes the HTML stylesheets to output HTML <acronym> instead of <span class="acronym">

> Questions:
> 1. Isn't the  <acronym> element to allow for HTML acronyms element?
> 2. If so, how do you specify the "title" attribute?

You can mark up the "spelled out" content for an acronym or abbrev using the Alt attribute, like this:

  <acronym>Emacs<alt>Emacs Makes A Computer Slow</alt></acronym>

That will cause the following to be generated in HTML output.

  <acronym class="acronym" 
title="Emacs Makes A Computer Slow">Emacs</acronym>

Note that the Alt element is valid as a child of Acronym and Abbrev only in DocBook NG/5. If you want to use it in DocBook 4 instances, and want to have those instances validated correctly, you need to put the following into the internal DTD subset for each of the document instances in which it is used.

  <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
            "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
  [
  <!ENTITY % local.word.char.mix "|alt">
  ]
  >

Or create a DTD customization layer that does the same thing. Of course replace "article" with the actual name of the root element of the doc instance, and replace "4.4" with whatever DocBook 4 version you are actually using.

2.

Persian digits in DocBook XSL numbering

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="&#x661;", 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.

3.

Admonition Graphics missing.

Barton Wright

When using the FO stylesheets, the admon.graphics.path is relative to the location of your XML source files. That is, the XSLT processor wants to know where the files are at build time, so that it can embed them in the .fo file it is generating.

By contrast, when using the HTML or XHTML styelsheets, the admon.graphics.path is relative to where your HTML files are generated (that is, to the directory named in the --output parameter of xsltproc). In this case, the XSLT processor wants to know the path to the files at run time, from where the HTML files will load them on demand from a browser. The XSLT processor embeds this runtime path in the HTML files.

Your "generated.graphics.path" two-step solution is not really necessary. You should be able to use:

   <xsl:param name="admon.graphics.path" select="'../admon/'" />