Re: [xsl] Losing white space when identity transform

Subject: Re: [xsl] Losing white space when identity transform
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 18 Mar 2004 09:32:33 +0000
Hi Karl,

> But am losing my white-space around the <b> elements... what is up
> with that? I know this has been discussed before. Seems like there
> is a fix for this.

The text before and after the <b> element is probably output according
to the template that you have for text nodes. If you're losing the
leading and trailing whitespace from those text nodes, my guess would
be that you have a template that uses normalize-space() to output the
value of the text nodes, as in:

<xsl:template match="text()">
  <xsl:value-of select="normalize-space()" />
</xsl:template>

If so, you need to change this template to:

<xsl:template match="text()">
  <xsl:value-of select="." />
</xsl:template>

(or just omit it altogether, since this is the same as the built-in
template for text nodes).

If you don't have a template like that, please send the part of your
stylesheet that deals with text nodes and we should be able to figure
out how to change it to handle the whitespace correctly.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread