[Previous] [Contents] [Next]


Whitespace


If it is important to you to keep the whitespace inside an xsl:text element, set the xml:space attribute value to preserve:

    <xsl:text xml:space="preserve">
       The spaces        in     this   t e x t
       will n o  t be       removed.
    </xsl:text>

If, on the other hand, you know there is whitespace inside an element that is simply "noise" you can remove it automatically by declaring xml:space="strip".

At a higher level, to affect all the elements of a particular type, you can also include separate instructions in the XSL style sheet:

     <xsl:strip-space element="para">
     <xsl:preserve-space element="code">

[Previous] [Contents] [Next]