Nat Pryce wrote:
> Hi.  In XHTML documents I am working on, some elements are styled with
> white-space: pre in the linked CSS style sheets.  However XXE seems to
> normalise whitespace.  While I can input the whitespace I want and it
> appears to be there when I'm editing, 

This is the intended behavior. Editors that behave differently may be 
more consistent, but are quite uncomfortable to use.



> XXE is actually removing the whitespace when it saves the document.  

This is the intended behavior. See below.



> This is very confusing (it took me hours to track down that the problem was 
> not in my stylesheets
> and XHTML processing tool-chain).

Sorry for the trouble.



> 
> Is there a way to turn off this behaviour?

In principle, there is no need to turn off this behavior. For an 
authoring tool such as XXE (as opposed to a programmer's editor), this 
behavior is exactly what an author needs. If this wasn't the case, a 
author would be tempted to ``style'' parts of its document by inserting 
whitespace, which, according to the XML standard, cannot really work.

Whitespace is automatically preserved for subtrees having an 
xml:space="preserve" attribute. The XHTML 1.0 DTD specifies 
xml:space="preserve" for the following elements: pre, script, style. 
Other than this, XXE is free to do whatever it wants with whitespace.

When you have no control over the DTD or schema you use, you can 
customize the  behaviour of XXE by using the "preserveSpace" 
configuration element. See 
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/preserveSpace.html

DocBook 5 example:
---
<preserveSpace elements="db:programlisting db:literallayout db:screen
                          db:synopsis db:funcsynopsisinfo
                          db:classsynopsisinfo db:address db:modifier"/>
---

How to customize an existing configuration is explained here:
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/customizing.html

Alternatively, you can simply use Ctrl-SPACE to insert non-breaking 
space characters (i.e. &nbsp;) at caret position.






Reply via email to