cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klaus Malorny <>
Subject Whitespace, was: Number of last child
Date Thu, 01 Mar 2001 13:27:36 GMT
Erwin Burgstaller wrote:
> BTW: Is there a possibility to write <xsl:attribute> with white spaces
> inside, without getting them into the html-code?
> Erwin

You should take a look at the general whitespace handling of an XSLT
processor. Once understood, it is quite easy:

By default*, text nodes containing only whitespace are removed from the XSL
stylesheet. On the other hand, text nodes containing other characters are not
modified in any way, i.e. there is no whitespace compression (multiple spaces,
tabs, returns etc. to a single space) and no removal of spaces at the
beginning or end of the text.

  <xsl:attribute ...>
    <xsl:value-of ...>

does not produce any whitespaces in the attribute, since both text nodes
before and after the <xsl:value-of> contain only whitespace. In contrast

  <xsl:attribute ...>

will produce whitespace. To keep your stylesheet neatly indented, you could
use <xsl:text>:

  <xsl:attribute ...>

In the worst case, you could use the normalize-space () function.

Hope that helps.


* not text contained inside <xsl:text>

View raw message