10.2. The <xsl:strip-space> and <xsl:preserve-space> Top-Level Elements

These elements form a complementary pair of XSLT top-level elements whose purpose is to govern the handling of whitespace in the input tree and, by implication, in the output result tree. Both elements have one required attribute, the elements attribute, whose value (tokens) is a whitespace-separated list of element-type names, as shown in the element model definitions for each element below:

<!-- Category: top-level-element -->
<xsl:strip-space
  elements = tokens />
<!-- Category: top-level-element -->
<xsl:preserve-space
  elements = tokens />

The <xsl:preserve-space> top-level element retains whitespace text nodes from the input elements listed in its elements attribute. ...

Get XSLT and XPATH: A Guide to XML Transformations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.