title: Calling Java from XSL (SAXON)
body: <p>I'm trying to use the Saxon processor from java. I'm using the the <strong>saxon9ee.jar</strong> inside saxonee9-3-0-11j.zip (just downloaded, no license - is that needed so it'll work?)</p>
  
  <p>Their <strong><em>*</em>*</strong> resources can be found here:
  <a href="http://www.saxonica.com/documentation/extensibility/functions/instance-methods.xml" rel="nofollow">http://www.saxonica.com/documentation/extensibility/functions/instance-methods.xml</a></p>
  
  <p><a href="http://www.saxonica.com/documentation/extensibility/functions/staticmethods.xml" rel="nofollow">http://www.saxonica.com/documentation/extensibility/functions/staticmethods.xml</a></p>
  
  <p>My xsl:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0"&gt;
  
      &lt;xsl:template match="/"&gt;  
          &lt;xsl:value-of select="dateUtils:getCurrentFullDate()" 
                xmlns:dateUtils="java:com.macfaq.math.SimpleSaxon"/&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>My java file:</p>
  
  <pre><code>package com.macfaq.math;
  public class SimpleSaxon {
  public static final String YMDTHMS = "yyyyMMdd'T'hhmmss";
      public static String getCurrentFullDate() {
          return (new SimpleDateFormat(YMDTHMS).format(new Date()));
      }
  
  }
  </code></pre>
  
  <p>My input XML file: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;date format="yyyyMMdd'T'hhmmss" year="2000" month="4" day="27"/&gt;
  </code></pre>
  
  <p>My main java file:</p>
  
  <pre><code>public class SaxonTransf {
  
  public static void main(String[] args) {
  
      System.setProperty("javax.xml.transform.TransformerFactory",
              "net.sf.saxon.TransformerFactoryImpl");
      String foo_xml = "in.xml"; // input xml
      String foo_xsl = "transf.xsl"; // input xsl
  
      TransformerFactory tfactory = TransformerFactory.newInstance();
      Transformer transformer = tfactory.newTransformer(new StreamSource(
              new File(foo_xsl)));
      transformer.transform(new StreamSource(new File(foo_xml)), 
          new StreamResult(System.out));
  
  }
  </code></pre>
  
  <p>Error:
  XTDE1425: Cannot find a matching 0-argument function named
    {java:com.macfaq.math.SimpleSaxon}getCurrentFullDate(). The namespace URI and local name
    are recognized, but the number of arguments is wrong in built-in template rule.</p>
  
  <p>Has anyone had any luck with calling custom java functions from XSL while using this wonderful processor? </p>