Re: spaces with SAXON

Subject: Re: spaces with SAXON
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Fri, 6 Aug 1999 14:28:52 -0400 (EST)
At 6 Aug 1999 17:19 +0000, Zsolt Czinkos wrote:
 > I'm using a servlet compiled by SAXON to serve HTML pages.
 > The problem is that:
 > 
 > 1. when i use this with a stylesheet:
 > ...
 > <person>
 > <name>John Smith</name>
 > , <age>23</age>
 > </person>
 > ...
 > 
 > it produces: "John Smith , 23" instead of "John Smith, 23"
...
 > So, SAXON converts a newline to space. Is it a bug?

It is likely that SAXON is producing a newline, which your browser is
displaying as a space.

You are expecting that the newline will be stripped out, but it
shouldn't be.  Section 3.4 of the current WD says, among other things,
that a text node is preserved (i.e. not stripped) if it contains at
least one non-whitespace character.  The text node containing a
newline, a comma character and a space character qualifies as
containing a non-whitespace character, so it isn't stripped.

You could, perhaps, make a template rule that matches on text nodes
and removes a leading newline, but I'd consider fixing the data.

You could try normalize(), but that would also drop the trailing space
character.  You could also try using translate() to strip out just the
newline.

Regards,


Tony Graham
======================================================================
Tony Graham                            mailto:tgraham@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9632
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread