Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
2.3
-
None
-
None
-
Operating System: Linux
Platform: Other
-
9683
Description
When passing a node reference to an extension function where the extension
function is declared using a namespace prefix, a null pointer exception occurs.
When passing the same node to the same function using a java:FQCN prefix there
is no problem. Neither is there a problem when passing a literal to the function.
In the following stylesheet, the first 5 calls to static method toUpper work;
only the 6th fails.
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java"
xmlns:ecn="xalan://nz.co.ecnetwork.xsltmap.Extensions"
version="1.0">
<!-- Interchange Sender ID -->
<xsl:param name="literalVar" select="'literal-var'"/>
<xsl:param name="nodeVar">some-value</xsl:param>
<xsl:template match="/">
<xsl:value-of
select="java:nz.co.ecnetwork.xsltmap.Extensions.toUpper('literal')"/>
<xsl:value-of
select="java:nz.co.ecnetwork.xsltmap.Extensions.toUpper($literalVar)"/>
<xsl:value-of
select="java:nz.co.ecnetwork.xsltmap.Extensions.toUpper($nodeVar)"/>
<xsl:value-of select="ecn:toUpper('literal')"/>
<xsl:value-of select="ecn:toUpper($literalVar)"/>
<xsl:value-of select="ecn:toUpper($nodeVar)"/>
</xsl:template>
</xsl:stylesheet>
extension class:
package nz.co.ecnetwork.xsltmap;
public class Extensions
{
/**
- Convert input string to upper-case : test for Xalan-J bug
*/
public static String toUpper(String str) { return str.toUpperCase(); }}