Subject: Problems with normlize() and whitespace stripping
From: "Richard Lander" <rlander@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 19 Jun 1999 14:23:24 -0400
|
Hello,
I am having quite a bit of trouble stripping the extra whitespace out of my
PARA elements, without also losing sub-elements.
I started with:
<xsl:template select="PARA">
<xsl:copy>
<xsl:value-of select='normalize()'/>
</xsl:copy>
</xsl:template>
It nicely normalizes the text into long strings but strips away my
sub-elements.
I also tried:
<xsl:template match='PARA'>
<xsl:copy>
<xsl:value-of select='normalize()'>
<xsl:apply-templates select='*|@*|comment()|pi()|text()'/>
</xsl:value-of>
</xsl:copy>
</xsl:template>
No difference.
I've also tried a bunch of other things which yield no better but worse
results. I can separate the text() from the * and *@ but not normalize them
and keep them together. Is there a way?
I've gotten the idea that normalize() cannot be a member of the an
xsl:apply-templates but only an xsl:value-of. Is that so?
BTW: The only other rules in the stylesheet are:
<xsl:template match='/'>
<xsl:comment>This file is automatically generated. Do not
edit!</xsl:comment>
<xsl:pi name='xml'>version="1.0" standalone="no"</xsl:pi>
<xsl:text>
</xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match='*|@*|comment()|pi()|text()'>
<xsl:copy>
<xsl:apply-templates select='*|@*|comment()|pi()|text()'/>
</xsl:copy>
</xsl:template>
Thanks,
Richard.
Richard Lander
relander at uwaterloo.ca
http://pdbeam.uwaterloo.ca/~rlander/
Professional XML Authoring
http://www.on-line-learning.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|