Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XSLT and Element

XSLT xsl:preserve-space and xsl:strip-space Element


XSLT Element Reference Manual Complete XSLT Element Reference Manual


Definition and Usage

xsl:preserve-space The element is used to define elements that preserve whitespace.

xsl:strip-space The element is used to define elements that strip whitespace.

**Note:** Preserving whitespace is the default setting, so it is only necessary to use the xsl:strip-space element when using the xsl:preserve-space .

Note:xsl:preserve-space element and xsl:strip-space Both elements are top-level elements.


Syntax

property

property Value Description
elements list-of-element-names

Required. A space-separated list of elements that specifies which elements preserve/strip whitespace.

Note:The list can contain "" and "prefix:", so that you can include all elements or all elements from a specific namespace.

Example 1

In this example, we preserve whitespace nodes for the title and artist elements, and strip whitespace nodes from the country, company, price, and year elements:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">







XSLT Element Reference Manual Complete XSLT Element Reference Manual