This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: : RE: suppressing default template rules
- From: "Joerg Heinicke" <joerg dot heinicke at gmx dot de>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 29 Mar 2002 13:21:12 +0100
- Subject: Re: : RE: [xsl] suppressing default template rules
- References: <20020329051728.62085.qmail@web14607.mail.yahoo.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
> <?xml version="1.0" ?>
> <custdet>custdettag
> <employee>emptag</employee>
> <firstname>first</firstname>
> <lastname>last</lastname>
> </custdet>
> The expected output (as per the following node
> structure)_
>
> / (root node)
> +- custdet
> | +- 'custdettag'
> +- employee
> | +- 'emptag'
> +- firstname
> | +- 'first'
> +- lastname
> +- 'last'
This is correct when using <xsl:strip-space elements="*"/>. And from the
name 'strip-space' you can already see where it comes from: from the
whitespaces. They are between the end of one node and the beginning of the
next node. The complete tree of custdet:
+-- custdet
| +-- 'custdettag ' (including one linebreak)
+-- employee
+-- ' ' (whitespaces + linebreak)
+-- firstname
+-- ' '
+-- lastname
If you write the whle XML in 1 line without whitespaces, you will see the
expected output too. You also can change the <xsl:apply-templates/> in the
template matching on * change to <xsl:apply-templates
select="*|text()[normalize-space()]"/>. Or change the template matching on
text() to <xsl:template match="text()[normalize-space()]"/>.
Regards,
Joerg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list