[xsl] Combination of normalize-space() and apply-templates

Subject: [xsl] Combination of normalize-space() and apply-templates
From: Andreas Grytz <agrytz@xxxxxxxxxxxxx>
Date: Thu, 26 Feb 2004 11:06:45 +0100
Hi,

I am using xsltroc (from libxslt 1.1.0). When I m trying to normalize
the space in certain elements, I got stuck since I couldn't figure out,
how to apply normalize-space() and apply templates for elements within a
node. Example:

<document>
 <para>Some text, that is
 wrapped several times, but
 should be one line in the
 output document. And which
 has -- to make it tricky --
 some Elements <emp>within</emp>
 which should also be processed.
 </para>
<document>

If I write a template like this:

<xsl:template match="document">
 <xsl:apply-templates select="normalize-space(para)" />
</xsl:template>

It doesn't work. But if I do it this way:

<xsl:template match="document">
 <xsl:apply-templates select="para" />
</xsl:template>

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

It worked, but the inline element won't get processed.

Is it impossible, to do both things in one step?

Andreas
-- 
Andreas Grytz		| http://www.linuxnewmedia.de
Stefan-George-Ring 24	| Tel:	+49 (0) 89 993411-0
D-81929 München		| Fax:	+49 (0) 89 993411-99

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


Current Thread