xsl-list
[Top] [All Lists]

RE: Whitespace between nodes

2004-05-13 01:11:28

I suspect that your input document has the carriage returns 
and so they are being carried to your output document 
correctly. Since you didn't supply the source I can't be 
sure. I think one of your processors is "helpfully" removing 
the carriage returns improperly. If you show us the input and 
name the processors it will be easy to help.

MSXML by default strips whitespace text nodes while building a DOM from
source input files. Other processors don't. There have been many debates
about whether the MSXML behavior is conformant or not, and the consensus
seems to be that it is against the spirit of the rules but not against the
letter: this is a detail of the design of Microsoft's API for constructing a
DOM from a source XML file, which is a proprietary API outside the control
of any W3C specs, so they can do what they like (so long as the customers
keep paying their money). The XSLT specification explicitly says that
implementations can build a source tree as input to the transformation any
way they like.

If whitespace text nodes in your source document are not significant, you
should remove them by writing <xsl:strip-space elements="*"/> in your
stylesheet. If they are significant, you should take care when using MSXML
to set the preserveWhitespace option so they are retained.

Michael Kay




<Prev in Thread] Current Thread [Next in Thread>