Actually, 
 is a carriage-return character. The new-line character is 
. Check out section 2.11 of the XML Recommendation to see what is happening.
I added the following code to the createDocumentFromString method
and now I only have 
 where the 
 used to be but the results are the same. Xalan is losing the fact that newlines are specified. How can I get Xalan to respect the 
 ?