HTML numbering

When transforming XML documents into HTML documents, it may not be necessary to use XSLT features at all. The simplest way to number items automatically is to use the OL (Ordered List) and LI (List Item) elements. In this scenario, the stylesheet does not actually number the items but leaves this task to the browser that will interpret the HTML tags. Take the simple example of a list of procedural steps:

<procedure>
  <step>walk to the door</step>
  <step>insert the key in the lock</step>
  <step>turn the key</step>
  <step>turn the handle</step>
  <step>push</step>
</procedure>

The following templates would suffice:

<xsl:template match="procedure">
  <OL><xsl:apply-templates/></OL>
</xsl:template>

<xsl:template match="step">
  <LI><xsl:apply-templates/></LI>
</xsl:template>

Advantage can be taken of HTML features for varying the style of the list by adding appropriate attributes to the OL and LI elements (see Chapter 18 for details).

When converting to HTML format, the stylesheet author has the choice of whether to use HTML list elements, or the XSLT numbering features described below.

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

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