Null Attributes Break xsl:key?

Subject: Null Attributes Break xsl:key?
From: Bill Entwistle <ent@xxxxxxxxx>
Date: Mon, 05 Jun 2000 18:40:44 -0500
Are null attribute values legal in XML?  As in, for example:

	<some-element some-attribute=""/>

If so, then the following looks like a Xalan bug.  I would love
to find out otherwise, or be given a workaround for this problem.
I discovered that if you have a null attribute in your XML, then
the xsl:key instruction fails to create any keys after the
element with the null attribute.  For example, if I process the
following XML:

	<group>
		<person>
			<id code="1672"/>
			<bonus amount=""/>
		</person>
		<person>
			<id code="2035"/>
			<bonus amount=""/>
		</person>
	</group>

with the following script:

	<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
		version="1.0">

	<xsl:key name="Codes" match="person" use="id/@code"/>

	<xsl:template match="/">
		<xsl:copy-of select="key('Codes','1672')"/>
		<xsl:copy-of select="key('Codes','2035')"/>
	</xsl:template>

	</xsl:stylesheet>

then it outputs the first node set, but fails to output the second.
If I stick anything into the attribute fields to make them non-null,
then the script works as expected and outputs both node sets.

I tried to contact Apache about this, but they apparently don't allow
mere users to access their bug reporting website and they don't
publish their phone number.

Thanks for any help,

Bill



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


Current Thread