Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Automation Scripting User Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

preserve-space

date_range 13-Jan-21

Syntax

content_copy zoom_out_map
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>:

content_copy zoom_out_map
version 1.1;

preserve-space user-context;
strip-space *;

match / {
...
}

Release Information

Statement introduced in version 1.0 of the SLAX language.

footer-navigation