Re: Multiple spaces converted into one

On Monday 04 September 2006 14:41, Robin Whittle wrote:
> Hello Irene,
>
> I am new to XML and XHTML, so I wasn't aware of this:
> > Normally if you set xml:space="preserve" on the body element, all
> > inserted white spaces must be preserved.
>
>   http://www.w3.org/TR/2000/REC-xml-20001006#sec-white-space
>
> This works to a certain extent within Amaya.  I can use:
>
>   <span xml:space="preserve">aaa   bbbb</span>
>
> and the spaces are displayed, not collapsed, in both the WYSIWYG and
> source windows.  Furthermore, the file is saved in that form, with just
> ordinary spaces - and it opens fine, with the spaces preserved.
>
> I tried putting the span around the entire contents of the body of the
> "Welcome to Amaya" page, and it had the same effect on the entire
> contents of the page, as far as I can tell.
>
> <body xml:lang="en" lang="en"><span xml:space="preserve">
>
>   . . .
>
> </span></body>
>
> I found I could put spaces where I liked.  But at some point, Amaya
> removed this span of the entire body, and replaced it with with a
> similar, but separate, span for each line, or paragraph or whatever.
> This was without saving the file - just moving the focus from source to
> normal WYSIWYG mode once or twice and inserting multiple spaces in two
> or so locations.  Perhaps this is a deliberate workaround to cope with
>
> what you mentioned:
> > I guess there is a bug in today amaya version as it looks at the
> > xml:space attribute of the current element but doesn't check enclosing
> > elements if the current element doesn't have this attribute.

Yes, this bug will be fixed as soon as possible

> Saving the file, as native XHTML and opening it in Mozilla 1.7.13 or
> MSIE 6.0.2800, I find that neither browser recognises the
> xml:space="preserve" attribute.  Both render the multiple spaces as one.

When a XHTML document is served with the text/html mime type, these browsers 
manage the document as a HTML document and then ignore xml:space attributes.
As the mime type is under the control of the web server, this is an issue.

> Saving as HTML does not help.  The XML tags are still there, and of
> course neither MSIE or Mozilla take any notice of them.
>
> I tried creating a new file (XHTML transitional) with the body having
> this attribute:
>
> <body xml:space="preserve">
> <p>Blah Blah   Blah</p>
>
> but it did not have the desired effect within Amaya.  (Not for long,
> anyway - Amaya opened the file and displayed the extra spaces, but when
> I put another space in the middle of one of the words, and then moved
> the cursor to another line, the multiple spaces were collapsed.)
>
> Perhaps one approach is to change Amaya in these ways:
>
> 1 - Make it work so a single <body xml:space="preserve"> does work.
>
> 2 - Make this a user settable option, perhaps with a default of it
>     being set when a new file is created.
>
> 3 - Ensure that when the file is saved as HTML, that appropriate
>     processing is done to create non-breaking spaces, along the
>     lines suggested in my last email.
>
> This may be more trouble than handling it during the editing process as
> I previously suggested.  But perhaps it is more correct to use XHTML
> cleanly, without importing HTML-specific workarounds into the editor,
> and then to implement the non-breaking-space fudges only when saving to
> HTML.
>
> But this pure XHTML approach will only be useful when browsers properly
> recognise this distinctly different way of handling spaces in XHTML
> files, which complicates the task of writing browsers.
>
>
>   - Robin

-- 
     Irène.
-----
Irène Vatton                     INRIA Rhône-Alpes
INRIA                               ZIRST
e-mail: Irene.Vatton@inria.fr       655 avenue de l'Europe
Tel.: +33 4 76 61 53 61             Montbonnot
Fax:  +33 4 76 61 52 07             38334 Saint Ismier Cedex - France

Received on Tuesday, 5 September 2006 08:40:29 UTC