XSLT - Whitespace

Card Puncher Data Processing


When a newline is not present, whitespace is generally ignored. To include whitespace in the output in such cases, or to include other text, you can use the

Articles Related
Removing Whitespace

When you look at the structure of a DOM, there are many text nodes that contain nothing but ignorable whitespace. Most of the excess whitespace in the output comes from these nodes. Fortunately, XSL gives you a way to eliminate them.

To remove some of the excess whitespace, add the strip-space node

<xsl:stylesheet ... >

<xsl:strip-space elements="SECT"/>


That last little bit of whitespace is disposed of by adding the following to the stylesheet:

<xsl:template match="text()">
 <xsl:value-of select="normalize-space()"/>

Discover More
Card Puncher Data Processing
XSLT - Templates

an some other tag, or whitespace. HTML outputs the HTML start tags, processes any templates that apply to children of the root, and then outputs the HTML end tags.

Share this page:
Follow us:
Task Runner