Documentation Center

XML Whitespace

Use the global settings on the Whitespace page of your XML file type tree to define how SDL Trados Studio deals with any extra whitespace characters in the elements of an XML document.

To open the Whitespace page for your XML file type, click File > Options > File Types > [XML file type] > Whitespace.

The global whitespace settings control the whitespace configurations for:
  • XML elements that are not subject to a parser rule
  • content extracted as non-translatable from any XML element
  • whitespace found in the attributes of any element

You can also set whitespace settings specific to an XML parser rule element. Where the parser rule applies, it overrides the global setting from the XML Whitespace page.

Whitespace, preservation and normalization

Studio considers spaces, non-breaking spaces, tabs and line breaks as whitespace. Preservation means that Studio will not modify any whitespace found in the XML element. Normalization means that Studio will replace any whitespace found in the XML element with a single space.

Normalization replaces the following whitespace with a space:
  • Whitespace within text
  • Whitespace between text and any tag
  • Whitespace between inline tags
  • Whitespace between an inline tag and a structure tag

Whitespace in content

This option controls the whitespace settings for the translatable content in XML elements which are not subject to a parser rule.

For XML elements subject to a parser rule, Studio only applies this global Whitespace in content setting if the Whitespace property on the Add/Edit/Copy Rule page is set to Inherit from parent and the last specified parent is also set to Inherit from parent.

Set the Whitespace property to one of the following:
OptionDescription
Always preserve

Studio keeps the whitespace it finds and does not replace it with a single space

Normalize unless xml:space='preserve'

Studio replaces whitespace with a single space unless the element includes the attribute xml:space='preserve'

Always normalize

Studio always replace whitespace with a single space, ignoring any xml:space='preserve' attribute

Whitespace in tags

This option controls the settings for the whitespace found in non-translatable content and in element attributes.

Check the Always normalize option if you want Studio to replace any whitespace found with a single space.

Normalization does not change the whitespace between structure tags. (However, the user cannot not see this whitespace anyway.)

Related concepts