xml:space=preserve is disregarded in inline elements

See the example here: http://xopusfiddle.net/2i1UK/2/

Both the <code> and <fragment> elements include the xml:space="preserve" attribute and are referenced in the XSL:

<xsl:preserve-space elements="code fragment">

Notwithstanding this, you can insert multiple spaces in code <fragment> elements and they will be accepted, but you cannot insert multiple spaces in an inline <code> element.

When the document is loaded into the editor, multiple spaces are stripped out of code elements but preserved in fragment elements.

2 Replies Latest Replies: 8 Jan 2019 7:48 AM by Fredrik Geers
  • You need to make sure that the browser will also render the preserved spaces. For the fragment element in your example that is taken care of because it becomes a pre element in the xslt. The code element is just a span, so normal html output logic applies, which causes additional spaces to be removed in the rendering. You can prevent that using white-space: pre in the case.
    See the updated fiddle: xopusfiddle.net/.../

Related