$align-char-default, $align-char-pad, $align-char-width

$align-char-default, $align-char-pad, $align-char-width — Support “char” alignment on CALS table cells.

Defined in:
param.xsl (3)
Used in:
param.xsl, modules/tablecals.xsl


  |$align-char-default as xs:string := '.'
  |$align-char-pad := ' '
  |$align-char-width := 2


CALS tables support “char” alignment on columns. The most common use case for character alignment is to align a column of numbers on a decimal point even when the number of characters to right or left of the decimal point varies.

Three parameters apply to character alignment:


Specifies the default alignment character.


Specifies the default padding character, usually an en space.


Specifies the number of characters that follow the alignment character.

  1. The HTML table model doesn’t really support character alignment. This feature pads each entry on the right as necessary to put the alignment character in the same place. Naturally, this will only produce the desired result if a monospace font is used in the cell.
  2. If the alignment character appears more than once in the cell, the cells are aligned around the last occurrence. The notion of “last” and padding on the right or the left should be sensitive to the writing direction, but it isn’t currently.
  3. Character alignment is ignored if a cell contains markup.

Example 1, “An example of char alignment” shows an example of character alignment on the “,” character.

   |<informaltable frame="all">
   |   <tgroup cols="2" colsep="1" rowsep="1">
   |      <colspec colnum="2" align="char" char=","/>
   |      <tbody>
   |         <row>
   |            <entry>Row A</entry>
   |            <entry>10000,01</entry>
   |         </row>
   |         <row>
   |            <entry>Row B</entry>
   |            <entry>10</entry>
   |         </row>
   |         <row>
   |            <entry>Row C</entry>
   |            <entry>-3,14</entry>
   |         </row>
   |      </tbody>
   |   </tgroup>
Example 1An example of char alignment
Row A10000,01
Row B10   
Row C-3,14
Example 2Tabular rendering

The alignment character can be specified on a per-column, per-table basis with the char attribute on colspec.

The alignment width and padding character can be specified on a per-column, per-table basis with a db processing instruction.

If the settings apply to the whole table, the processing instruction can be a child of tgroup, preceding any other elements. If you want to specify different values for different columns, the processing instruction must immediately follow the colspec for the column.

The align-char-width pseudo-attribute controls the number of characters following the alignment character. The align-char-pad pseudo-attribute controls the character used for padding.

A value that does not contain the alignment character is assumed to be followed immediately by the alignment character. (In other words, if you’re aligning on “.”, “10” is considered to be “10.”.) If the pad character is a space*, then the pad character will be used to pad the value. If the pad character isn’t a space, the value will be padded with the alignment character followed by pad characters as necessary.

Technically, is in the class of Unicode characters considered to be spaces, one that matches \p{Zs}.