Advanced formatting options

The Format attribute provides a very flexible approach to formatting numbers. First, it is possible to make all numbers the same width by padding shorter numbers with leading zeros. This attribute contains the number of digits to be presented, with the zero digit used for all but the last, which must be a one (as in '0001'):

<xsl:template match="item">
  <P>
    <xsl:number format="01"/>. <apply-templates/>
  </P>
</xsl:template>
   <P>01. first item</P>
   <P>02. second item</P>
   <P>03. third item</P>
   ...
   <P>09. ninth item</P>
   <P>10. tenth item</P>

Punctuation is often used within values to create groups of digits for legibility. But the actual mark used and the number of digits in each group may vary. Two attributes are available to specify the mark to use and the number of digits to place in each group. These are the Grouping Separator and the Grouping Size attributes. For example, in English documents, typical values for these attributes would be ',' and '3' respectively:

<number ... grouping-separator="," grouping-size="3" />


   <P>1. one</P>
   <P>2. two</P>
   <P>3. three</P>
   ...
   <P>999. nine hundred and ninety nine</P>
   <P>1,000. one thousand</P>
   ...
   <P>1,000,000. one million</P>

The Lang attribute allows a language to be identified, so that an appropriate sequence of characters can be used to label each item. When this attribute is not used, some other method must be used to determine the language to use. This may be the 'xsl:lang' attribute, when it is present in the source document.

It is widely known, and illustrated above, that in English there are two common ways in which alphabetic characters can be used to create an ordered list. These are the 'abcde' and 'i ii iii iv v' methods. Some other languages also have two options, but both options begin with the same letter. This means that putting the initial character in the Format attribute is not sufficient to identify which method to use. The Letter Value attribute is therefore used to identify the method. It has two possible values: 'alphabetic' or 'traditional'. There is no default or preferred value, and so when this attribute is not present an XSLT processor may not behave as predicted.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset