I am trying to use the java string function with XSLT 1.0. Specifically the the java String replace function.
But it fails with the null pointer exception. Here's what I tried:
1)--Declare namespace and call the java String class 
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:jString="http://www.oracle.com/XSL/Transform/java/java.lang.String"> 
 2)--Created a template to search for tag inputs that have an ampersand: 
 <xsl:template name="string-replace-all"> 
    <xsl:param name="text" /> 
    <xsl:choose> 
       <xsl:when test="contains($text, '&')"> 
          <xsl:variable name="str1" select="jString:new($text)"/> 
             <xsl:value-of select="jString:replace($str1,'&','&')" /> 
       <xsl:otherwise> 
          <xsl:value-of select="$text" /> 
      </xsl:otherwise> 
    </xsl:choose> 
 </xsl:template> 
 3)--Call the template in the specific tags 
 <Nm> 
    <xsl:variable name="suppNm"> 
       <xsl:call-template name="string-replace-all"> 
          <xsl:with-param name="text" select="Payee/Name" /> 
       </xsl:call-template> 
    </xsl:variable> 
    <xsl:value-of select="$suppNm" /> 
 </Nm> 
However I keep getting a null pointer exception: Caused by: oracle.xdo.parser.v2.XPathException: Extension function error: Error invoking 'replace':'java.lang.NullPointerException'
Can anyone guide me as to how to make this work?
Thanks
 
    