cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: How to output white space from xslt?
Date Tue, 09 Mar 2004 22:38:14 GMT
On 09.03.2004 23:26, Thomas Zehetbauer wrote:

> I thought that xsl:text as well as CDATA elements should preserve white
> space contained within, however I had to find that only white space from
> xsl:value-of makes it to the output.
> 
> <p><xsl:value-of select="'A'"/><![CDATA[ ]]><xsl:value-of select="'B'"/>
> <xsl:value-of select="'C'"/><xsl:text> </xsl:text><xsl:value-of
select="'D'"/>
> <xsl:value-of select="'E'"/><xsl:value-of select="' '"/><xsl:value-of
select="'F'"/>
> <xsl:value-of select="'G'"/> <xsl:value-of select="'H'"/></p>
> 
> <p>ABCDE FGH</p>
> 
> Is this the expected and intended behaviour?

Indeed in stylesheets whitespace characters are reduced as much as 
possible - but only for whitespace-only text nodes, so for 'AB' and 'GH' 
  the behaviour is expected. 'EF' is working for you, so remains 'CD' - 
this I can not explain, it should work. I would expect 'C D' out of the 
above. And as I very often use this <xsl:text> </xsl:text> when I need 
whitespaces I can only say that it works in general.

For more information see http://www.w3.org/TR/xslt#strip.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message