This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Identity question
- To: "Morris, Chris" <ChrisM at SNELLINGCORP dot COM>
- Subject: Re: [xsl] Identity question
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Wed, 17 Jan 2001 18:52:36 +0000
- CC: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <2B92A3D0D399D311BA7E00A0C90F8FDD88BE8B@mailgate.snellingcorp.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Chris,
The usual question would be:
Why am I getting <Child></Child> instead of <Child />
And the usual answer would be 'it doesn't make any difference which of
these is used - they're logically equivalent - and this level of
detail about the way the output is serialised cannot be affected by
XSLT'.
*However*, what you're getting (and what I get when I try it too) is:
<Child>
</Child>
This is different from <Child /> because The Child element here has a
text node in there with a carriage return in it. If you read this in
again (with another processor - MSXML ignores whitespace-only text
nodes by default) then you wouldn't have an empty element. There's
nothing in the identity template to create this whitespace. So, this
is actually a bug in MSXML - they're fairly rare on the ground these
days, so well spotted! :)
Turns out you can get around it by adding the template:
<xsl:template match="*[not(node())]">
<xsl:copy-of select="." />
</xsl:template>
In other words, make a direct copy of any element that doesn't have
any children.
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list