axf:number-transform

(Auszug aus "XSL-FO ― Die Referenz" von Manuel Montero Pineda & Steffen Herkert, 2016, dpunkt.verlag)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Category Text Transformation

Converts the number sequence in the character string. [no-LT]

Value:none | kansuji | kansuji-if-vertical | <list-style-type> | <string>
Initial:none
Applies to:all block-level and inline-level formatting objects
Inherited:yes
Percentages:N/A

Values have the following meanings.

noneDo nothing.
kansujiConverts the contained number sequence into Japanese numerals. The details of the Japanese numeral format can be specified by axf:kansuji-style, axf:kansuji-letter and axf:kansuji-grouping-letter.
kansuji-if-verticalOnly with the vertical writing, such as writing-mode="tb-rl", axf:number-transform="kansuji" is applied. Nothing is changed when it's not the vertical writing.
<list-style-type>Among the list-style-type defined by CSS, the number related types which can be specified are <algorithmic>, <numeric>, <alphabetic>, <symbolic>, <non-repeating>. Convertible digit numbers may differ depending on list-style-type. Too long number sequence cannot be converted.
<string>When a character string is specified, the behavior is same as when the character string is specified by format.

A number sequence (number) here indicates character strings of the following forms.

number ::= digits digits ::= [0-9]+

When it is simultaneously specified with text-transform or axf:text-replace, axf:number-transform is evaluated previously.

XSL-FO sample:

<fo:root xml:lang="ja" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:cpfo="http://www.compart.net/xmlns/cpfo" xmlns:svg="http://www.w3.org/2000/svg" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">

Antenna House, Inc.

カウンタスタイルの設定例

axf:counter-style により独自のカウンタスタイルを定義できます。name でカウンタスタイルの名前、system でカウンタシステムの種類、symbols でカウンタシンボルを指定します。name で指定した名前は list-style-type や axf:number-transform などで利用可能です。axf:counter-style 拡張要素は、fo:declarations の直下に配置できます。また、

Predefined Counter Styles

および

7. Complex Predefined Counter Styles

で定義されているスタイルを利用できます。詳細はオンラインマニュアルの「

axf:counter-style

」をご参照ください。カウンタスタイルの設定は AH Formatter V6.3 から利用いただけます。

このサンプルでは、一部を除き

"One:1, Two:2, Three:3, Four:4, Five:5, Six:6"

の文字列中の数字が変換されるように axf:number-transform の指定と axf:counter-style で定義した name を設定します。変換される数字は赤字にしています。また、ページ番号 fo:page-number の形式が、(1)、(2) ... になるよう fo:page-sequence の format へも axf:counter-style で定義した name を設定しています。

system="cyclic" symbols="a b c"

文字列内の数字列が a, b, c, a, b, c ... と繰り返すよう変換されます。

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

system="numeric" symbols="a b c"

最初のシンボル a を 0 とみなすため、b から始まります。

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

system="alphabetic" symbols="a b c"

文字列内の数字列が a, b, c, aa, ab, ac, ba, bb, bc, ... の順で変換されます。

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

system="symbolic" symbols="a b c"

文字列内の数字列が a, b, c, aa, bb, cc, aaa, bbb, ccc, ... の順で変換されます。

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

system="additive" additive-symbols="5 v,1 i"

文字列内の数字列が 1 を i、5 を v として変換されます。

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

system="fixed" symbols="a b c"

文字列内の数字列を a, b, c まで変換、以後は数字列のまま表示します。

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

system="extends decimal" pad="2 '0'"

pad で短い桁に対するパディングを指定します。 2桁まで 01, 02, 03, ... の順で表示します。

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

system="fixed" symbols="a b c" range="1 3" fallback="cjk-decimal"

range でスタイル適用範囲を指定、fallback で適用範囲外のフォールバックスタイルを指定します。 1~3 の間は a, b, c のスタイルが適用されます。以降は Predefined Counter Styles 定義の cjk-decimal が適用され表示されます。

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

system="extends decimal" negative="[ ]"

negative で負の値に対する前置後置文字列を指定します。 負の値に前置'['、後置']' が適用され表示されます。

Negative two:

-2

, Negative one:

-1

, Zero:

0

, One:

1

, Two:

2

, Three:

3

Predefined Counter Styles、7. Complex Predefined Counter Styles

定義済み Predefined Counter Styles および 7. Complex Predefined Counter Styles のスタイルを指定した例です。

circled-decimal

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

filled-circled-decimal

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

fullwidth-upper-alpha

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

lower-greek

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

japanese-informal

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

japanese-formal

One:

1

, Two:

2

, Three:

3

, Four:

4

, Five:

5

, Six:

6

Download der Beispiele

Output:

page 2

Tipp der data2type-Redaktion:
Zum Thema XSL-FO bieten wir auch folgende Schulungen zur Vertiefung und professionellen Fortbildung an: