[xsl] Preserve Whitespace with Mixed Content (Text and Tags)

Subject: [xsl] Preserve Whitespace with Mixed Content (Text and Tags)
From: James.Whitehead-1@xxxxxxxxxxxx
Date: Thu, 12 May 2005 17:55:43 -0400
Hello,
Message-Id: <iss.609c.4283d0df.801be.1@xxxxxxxxxxxxxxxxxx>

I am generating html from an xml document, and would like to preserve white space inside tags that contain both text and other tags, such within these THD tags:
<THD>               <HL1>Load</HL1>            <HL1>Height</HL1></THD>

Ideally, I would like to end up with:
<pre>               Load                 Height</pre>
or, better:
<pre>               <b>Load</b>                 <b>Height</b></pre>

I have tried many xsl variations using using <xsl:preserve-space... and <pre> tags, but am unable to come up with a way to preserve the spaces (and line feeds) with this mixed content.  I always seem to end up with something like either:
<pre>Load Height</pre>
or:
<pre>LoadHeight</pre>

I have no trouble preserving white space if the inner tags are removed, such as here:
<THD>               Load                 Height</THD>
The <HL1> tags are not the only tags that might appear inside the <THD> tags -- a large number of other nested tags might show up as well. I do not have any control over the original source xml document. 

Can anyone please point me in the right direction?  I have searched Dave Pawson's FAQ, the XSL-List archives, and other some oft-cited web references, and if the answer is in one of these, I haven't seen it.  

Thank you for any information you can provide.

Regards,

Jim

Current Thread