$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.
Synopsis
|$align-char-default as xs:string := '.'
|$align-char-pad := ' '
|$align-char-width := 2
Description
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:
-
$align-char-default
Specifies the default alignment character.
-
$align-char-pad
Specifies the default padding character, usually an en space.
-
$align-char-width
Specifies the number of characters that follow the alignment character.
- 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.
- 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.
- 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>
|</informaltable>
Row A | 10000,01 |
Row B | 10 |
Row C | -3,14 |
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.