Name

<xsl:strip-space>

Defines the source-document elements for which nonsignificant whitespace should be removed.

Category

Top-level element.

Required Attribute

elements

Contains a space-separated list of element names or node tests for which nonsignificant whitespace should be removed. Nonsignificant whitespace typically means text nodes that contain nothing but whitespace; whitespace that appears in and around text is always preserved. The elements attribute can also contain the value *, which means whitespace should be removed from all elements not specified in an <xsl:preserve-space> element. The value elements="auth:*" is also legal; this specifies all elements in the auth namespace.

[2.0] In XSLT 2.0, the elements attribute can also use wildcards for the namespace prefix. For example, the value *:title refers to all <title> elements, regardless of their namespaces.

Note

The XML spec defines the seldom used attribute xml:space. The xml:space attribute can have the values preserve or default. If xml:space="preserve" applies to a given element in the XML source, all whitespace is preserved, regardless of any <xsl:preserve-space> or <xsl:strip-space> elements.

Optional Attributes

None.

Content

None. <xsl:strip-space> is an empty element.

Appears in

<xsl:strip-space> is a top-level element and can only appear as a child of <xsl:stylesheet>.

Defined in

[1.0] XSLT section 3.4, “Whitespace Stripping.”

[2.0] XSLT section 4.4, “Stripping Whitespace from a Source Tree.”

Example

We’ll illustrate the <xsl:strip-space> ...

Get XSLT, 2nd Edition 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.