[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Identity question

Subject: Re: Identity question
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 17 Jan 2001 18:52:36 +0000
identity question
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.