EXSLT Common - object-type() error

Eric <[email protected]> Tue, 24 Jul 2012 18:34:39 -0400
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <CAJkHgvCd7M020t6R-x=inorHrsC26bKbRqJpFnCaqUWb9C2oZA@mail.gmail.com>
Hi,

I think I just found a bug in XalanJ's implementation of the object-type
function from EXSLT Common.

From the EXSLT documentation and Xalan's Javadoc: "The possible object types
are: 'string', 'number', 'boolean', 'node-set', 'RTF', or 'external'." The
problem is that it will return 'unknown' instead of 'external'.

You can easily reproduce the error with the following stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
		xmlns:except="java.lang.Exception"
		xmlns:exsl="http://exslt.org/common"
		xmlns:str="java.lang.String"
		exclude-result-prefixes="except  exsl  str">

	<xsl:output indent="yes" method="text"/>

	<xsl:template match="/">
		<xsl:value-of select="exsl:object-type(/..)"/><xsl:text>
</xsl:text>
		<xsl:value-of select="exsl:object-type(str:new())"/><xsl:text>
</xsl:text>
		<xsl:value-of select="exsl:object-type(except:new())"/>
	</xsl:template>
</xsl:stylesheet>

Which should return (it works ok in Saxon for example):
node-set
string
external

But it returns:
node-set
string
unknown

The problem seems to be in ExsltCommon.java and was introduced in June 2002 by
dleslie (see revision 336508 in SVN).

I found no reference anywhere for that problem so I thought it would be useful
for other people if I documented it here.

Regards,

Eric