Page 1 of 1

whitespace problem

Posted: Tue Jul 29, 2003 2:10 am
by nihilo
If, in a stylesheet, I try to create a variable for outputting a text carriage return, like so:

<xsl:variable name="newline"><xsl:text>
</xsl:text></xsl:variable>

The next time I open the document in oxygen, or pretty-print it, Oxygen incorrectly collapses this to:
<xsl:variable name="newline">
<xsl:text/>
</xsl:variable>

I believe this a bug, since a carriage return inside xsl:text should be treated as text, and not as if xsl:text element were empty. I believe the behavior should be the same even without the text element.

-n.

Posted: Tue Jul 29, 2003 9:51 am
by george
Hi,

Oxygen handles the xml:space attribute. Using xml:space="preserve" will keep the spaces. The xml:space attribute is inherited from the first parent element that defines it. If you want spaces not to be preserved use xml:space="default" to reset the preserve value.

Code: Select all


    <xsl:variable name="newline" xml:space="preserve"><xsl:text>
</xsl:text></xsl:variable>
Best Regards,
George