Advanced xsl:for-each "Pull" Example

This example builds on the basics described in the simple xsl:for-each example.

In addition to selecting and displaying only selected parts of each frequency table in HTML format, this example

  • doesn't rely on any localized text;
  • always shows both variable names and labels;
  • always shows both values and value labels;
  • rounds decimal values to integers.

The XSLT stylesheet used in this example is customized_frequency_tables.xsl.

Note: This stylesheet is not designed to work with frequency tables generated with layered split-file processing.

The simple example contained a single XSLT <template> element. This stylesheet contains multiple templates:

  • A main template that selects the table elements from the OXML
  • A template that defines the display of variable names and labels
  • A template that defines the display of values and value labels
  • A template that defines the display of cell values as rounded integers

The following sections explain the different templates used in the stylesheet.