title: Calling Java Function from XSLT gives "Could not compile stylesheet"
body: <p>I've gone through all the post of similar issues, but couldn't resolve my problem. I've XSLT as shown below:</p>
  
  <p>XSLT:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  
  &lt;xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:proxy="java:com.hp.gpp.pp.util.UrlUtils"
      extension-element-prefixes="proxy"&gt;
  
      &lt;xsl:output method="xml" version="1.0" indent="yes" /&gt;
  
      &lt;xsl:param name="proxy" /&gt;
      &lt;xsl:variable name="baseurl"
          select="/html/head/base/@href"/&gt;
  
      &lt;!-- copy input to output --&gt;
      &lt;xsl:template match='*|@*'&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:apply-templates select='node()|@*' /&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="*[@href]"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:attribute name="href"&gt;&lt;xsl:value-of
                  select="proxy:rewriteRelative($proxy,$baseurl,@href)" /&gt;&lt;/xsl:attribute&gt;
              &lt;xsl:apply-templates select="node()|@*[name(.)!='href']" /&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="*[@src]"&gt;
          &lt;xsl:copy&gt;
              &lt;xsl:attribute name="src"&gt;&lt;xsl:value-of
                  select="proxy:rewriteRelative($proxy,$baseurl,@src)" /&gt;&lt;/xsl:attribute&gt;
              &lt;xsl:apply-templates select="node()|@*[name(.)!='src']" /&gt;
          &lt;/xsl:copy&gt;
      &lt;/xsl:template&gt;
  
      &lt;!-- rewrite &lt;a href&gt; --&gt;
      &lt;xsl:template match="base"&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>And a Java code as:</p>
  
  <pre><code>XSLTemplateFactory templateFactory = new DefaultTemplateFactory();
              Templates templates = templateFactory.getTemplatesFromURL(XSS_FILE_NAME);
  Source xmlStrim = new StreamSource(reader);
  Result oStream = new StreamResult(res.getWriter());
  
  Transformer transformer = templates.newTransformer();
  transformer.setParameter("proxy", new UrlUtils(req, res));
  transformer.transform(xmlStrim, oStream);
  </code></pre>
  
  <p>Somehow, the code works locally but while deploying on Jboss gives:</p>
  
  <pre><code>ERROR:  'The first argument to the non-static Java function 'rewriteRelative' is not a valid object reference.'
  FATAL ERROR:  'Could not compile stylesheet'
  com.hp.gpp.pp.exception.ProxyPortletException: error.transformer : Could not compile stylesheet
  </code></pre>
  
  <p>Not able to find the issue here. Can someone help me in this?</p>
  
  <p>Thanks &amp; regards,
  Rikin</p>