This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Layout of text output.
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] Layout of text output.
- From: "Rob Lugt" <roblugt at elcel dot com>
- Date: Wed, 27 Jun 2001 09:53:35 +0100
- References: <200106270732.JAA06534@ri.silicomp.fr>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Romain Guider wrote:
>
> Basically, I want the layout of the output to only
> depend upon what I put in the xsl templates. However, I observe that the
> form of the output is sensitive to the way the source is indented which
is
> quite unfortunate to me !
> Of course, the line "<xsl:output method="text" indent="no"/>" has no
effect!
>
Romain,
You are getting this effect due to the fact that the whitespaces between
your elements are being treated as text nodes. There is a built-in template
rule for text and attribute nodes which copies them directly to the output.
The recommended (and easy) way to prevent this is to add the following
top-level element to your stylesheet:-
<xsl:strip-space elements="*"/>
As an aside, if you are interested in investigating this further, you could
try replacing the built-in template for text nodes:
<xsl:template match="text()">
<!-- do nothing with text nodes -->
</xsl:template>
This isn't the recommended way of achieving your desired result. For a
start it removes all text nodes, not just whitespace-only nodes. But it
gives you an idea of what is going on under the covers.
Regards
~Rob
--
Rob Lugt
ElCel Technology
http://www.elcel.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list