XSLT And Newline Character Handling
Posted: Fri Feb 21, 2014 9:27 pm
It is well documented that I cannot create portable XSLT, since different operating systems handle new line characters differently. The XML standard states that an XML parser is required to store only a linefeed character at the end of a line (
). To ensure that my XSLT is portable, I used <xsl:text>
</xsl:text> for new lines as opposed to <xsl:text>
</xsl:text>. This all makes sense to me. When I use oxygen to test out my XSLT, the resulting output shows only linefeed characters for line ends.
I am writing Java code to perform transformations and using XSLT 1.0. I thought that I would have to perform replacements of the 
 to 
. To my surprise, I did not have to do this. The file stream output already had the proper line end characters that Windows expects.
My question is why am I seeing this difference in line end characters for the same XSLT I generated and tested using oxygen?
Thanks.
I am writing Java code to perform transformations and using XSLT 1.0. I thought that I would have to perform replacements of the 
 to 
. To my surprise, I did not have to do this. The file stream output already had the proper line end characters that Windows expects.
My question is why am I seeing this difference in line end characters for the same XSLT I generated and tested using oxygen?
Thanks.