preserve-space
Syntax
preserve-space element-list;
Description
Preserve whitespace-only child text nodes for the source tree element nodes listed, but not for the child text nodes of the element node children. To preserve whitespace-only child text nodes of the element node children, specify the child nodes as separate entries in the preserve-space element list. Specifying an asterisk preserves whitespace-only child elements for all elements, which is the default behavior. A text node is considered whitespace-only if it includes only spaces, tabs, newlines, and carriage returns.
The preserve-space
statement is only
needed if the strip-space
statement has
been used with an asterisk, indicating that whitespace-only child
text nodes should be removed from all element nodes. In this case,
use the preserve-space
statement to indicate
specific element nodes that should not have their whitespace-only
child text nodes stripped.
This statement must be defined as a top-level statement in the script.
Attributes
element-list |
Space-separated list of element names for which to preserve whitespace-only child text nodes. |
SLAX Example
The following example removes all whitespace-only text
nodes from the source tree except for child elements of <user-context>
:
version 1.1; preserve-space user-context; strip-space *; match / { ... }
Release Information
Statement introduced in version 1.0 of the SLAX language.