whitespace problem

Having trouble installing Oxygen? Got a bug to report? Post it all here.
nihilo
Posts: 31
Joined: Wed Jun 04, 2003 2:24 am

whitespace problem

Post 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.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post 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
Post Reply