title: XSLT Calling mydefined function from another xslt
body: <p>In the code below, I want to define a function in one xsl file and include it in another xsl and then call it. I am trying to return a boolean. I just started with XSLT. Working code or sample will be appreciated.</p>
  
  <p>The code below throws an error:</p>
  
  <blockquote>
    <p>ERROR:  'The first argument to the non-static Java function
    'notMissingAndNull' is not a valid object reference.' FATAL ERROR: 
    'The first argument to the non-static Java function
    'notMissingAndNull' is not a valid object reference.'</p>
  </blockquote>
  
  <p>First XSLT: CommonFunctions.xsl</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet 
      version="2.0" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:func="func:func"
      &gt;
  
  
       &lt;xsl:function name="func:notMissingAndNull" as="xs:boolean"&gt;
          &lt;xsl:param name="missing" as="xs:string"/&gt;
          &lt;xsl:param name="after" as="xs:string"/&gt; 
          &lt;xsl:if test="$missing.length&gt;0 and $after.length&gt;0"&gt;
              &lt;xsl:value-of select="true" /&gt;
          &lt;/xsl:if&gt;
      &lt;/xsl:function&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Another XSLT: Functions getting called</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:func="func:func"
      &gt;
      &lt;xsl:import href="CommonFunctions.xsl"/&gt;
      &lt;xsl:output method="xml" encoding="UTF-8" indent="no"/&gt;
      &lt;xsl:template match="/"&gt;
                      &lt;xsl:if
                          test="@name = 'AC_NAME'"&gt;
                          &lt;AccountName xpath="Account/{{accountId}}/AccountName"
                              mapRules=""&gt;
                              &lt;xsl:value-of select="func:notMissingAndNull('missing','after')" /&gt;
                          &lt;/AccountName&gt;
                      &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>