This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Preserving output formatting after XSL transformation
- To: xsl-list at mulberrytech dot com
- Subject: Re: Preserving output formatting after XSL transformation
- From: Mike Brown <mike at skew dot org>
- Date: Wed, 8 Nov 2000 16:05:20 -0700 (MST)
- Reply-To: xsl-list at mulberrytech dot com
Jesse Ehrenzweig wrote:
> I'm wondering how to preserve the formatting of my transformed HTML output
> text.... instead of text appearing like so:
>
> <table>
> <tr>
> <td>
> ....
>
> I would like it to appear like this instead:
>
> <table>
> <tr>
> <td>
> ...
I think you're asking for whitespace-only text nodes in your stylesheet
tree (more specifically, the whitespace appearing between the tags for
literal result elements) to be preserved. XSLT does not consider such
space significant and will discard it; you have no control over it. So you
have two options:
1. Rely on indent="yes" in the xsl:output element. Processor dependent.
2. Rely on indent="no" and explicitly create text nodes with the
whitespace you want:
<xsl:text> </xsl:text><table>
<xsl:text> </xsl:text><tr>
<xsl:text> <xsl:text><td>
etc.
I'd choose (1). :)
- Mike
____________________________________________________________________
Mike J. Brown, software engineer at My XML/XSL resources:
webb.net in Denver, Colorado, USA http://www.skew.org/xml/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list