This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Preserving output formatting after XSL transformation


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]