RE: Whitespace,xml:space,xsl:strip-space

Subject: RE: Whitespace,xml:space,xsl:strip-space
From: Jeni Tennison <Jeni.Tennison@xxxxxxxxxxxxxxxx>
Date: Fri, 23 Jun 2000 18:20:31 +0100
Mike Kay wrote:
>> 3. the xml:space attribute has no effect on leading or 
>> trailing whitespace, eg.
>> <schedule>
>> <scheduleNumber xml:space="default">    123456789</scheduleNumber>
>> </schedule>

Erm, I dunno about this, but I may be interpreting Paul's "has no effect"
in a different way from Mike.  The XML Spec says:

  "The value "default" signals that applications' default white-space 
   processing modes are acceptable for this element; the value "preserve" 
   indicates the intent that applications preserve all the white space."

That makes me think that it is up to the application to decide what to do
with leading and trailing whitespace, so it *can* have an effect, depending
on the application.  An application *could* treat the above example as if
the value of scheduleNumber were '123456789' or ' 123456789 ' if it wanted.

So for example browsers that are given a paragraph like:

  <p xml:space="default">
    here is my paragraph
    indented and split over
    many lines

can (and indeed do) display it in the same way as:

  <p>here is my paragraph indented and split over many lines</p>

Whereas if it was:

  <p xml:space="preserve">
    here is my paragraph
    indented and split over
    many lines

then they 'are intended to' display the extra whitespace and line breaks.

But browsers are one thing and XSLT processors are another: I think that
most/all XSLT processors preserve leading/trailing/middling whitespace
whether they're told to or not, such that Paul's example is correct, as
Mike says.



Dr Jeni Tennison
Epistemics Ltd, Strelley Hall, Nottingham, NG8 6PE
Telephone 0115 9061301 ? Fax 0115 9061304 ? Email

 XSL-List info and archive:

Current Thread