NullPointerException when processing *[*] xpath expression
I'm trying to pull only elements that have an element as a
child, using the *[*] xpath expression. When I use MSXML 3.0,
my results are correct. When I use ORAXSL (NT 9i version
downloaded from OTN), I get a NullPointerException. Please see
example below.
<?xml version="1.0"?>
<TABLES>
<TABLE1>
<TABLE1_ROW1>TEXT1</TABLE1_ROW1>
<TABLE1_ROW2>TEXT2</TABLE1_ROW2>
</TABLE1>
<TABLE2>
<TABLE2_ROW1>TEXT3</TABLE2_ROW1>
</TABLE2>
<TABLE3>
<TABLE3_ROW1>TEXT4</TABLE3_ROW1>
</TABLE3>
</TABLES>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" version="1.0" encoding="UTF-8"
indent="yes"/>
<xsl:key name="elements" match="*[*]" use="name()"/>
<xsl:template match="/">
<xsl:for-each select="//*[generate-id(.)=generate-id(key
('elements',name())[1])]">
<xsl:for-each select="key('elements',name())">
<xsl:if test="position()=1">
<xsl:text>drop table </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>;
</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
<xsl:text>
exit</xsl:text>
</xsl:template>
</xsl:stylesheet>
MSXML 3.0 OUTPUT:
drop table TABLES;
drop table TABLE1;
drop table TABLE2;
drop table TABLE3;
exit
ORAXSL OUTPUT:
java.lang.NullPointerException
Error occurred while processing test.xml: null
If I change the *[*] to just * then the XSLT will process.