Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 59

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="changes" page="intro92" subpage="extensibility92"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Extensibility</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: Extensibility"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Extensibility</h1>
      <p>A new way of implementing extension functions is available. These are known as
   <i>integrated</i> extension functions. Unlike traditional extension functions invoked
   as Java methods through reflexion, each integrated extension function is implemented as a separate class that extends the
   abstract class <code>net.sf.saxon.functions.ExtensionFunctionDefinition</code>, together with a class that extends
   <code>net.sf.saxon.functions.ExtensionFunctionCall</code>. The first class must implement a number of methods
   providing information about its argument types and result types, while the second provides the <code>call()</code> method which
   is invoked to call the function. A key advantage of this kind of extension function is that it can exercise
   compile-time behaviour, for example saving information about the static context in which it is called, or
   optimizing itself based on the expressions supplied in the function arguments. Another advantage is that you have
   complete control over the function name, for example you can choose any namespace you like.</p>
      <p>Integrated extension functions need to be registered in the Saxon Configuration. You can do this via the API, or 
   (in Saxon-PE and Saxon-EE) via
   the configuration file. This means that in Saxon Home Edition it is not possible to use integrated extension functions when 
   running from the standard command line interface.</p>
      <p>The old way of binding extension functions ("reflexive extension functions"), 
   by mapping the namespace URI of the function name to a Java class,
  is not available in Saxon Home Edition. Also, it has changed so that by default, it only recognizes namespaces using the
  recommended format <code>java:full.class.name</code>. If you need to recognize arbitrary namespaces ending in the Java class name (as
  allowed in previous releases on XSLT, but not XQuery), find the <code>JavaExtensionLibrary</code> by calling 
   <code>Configuration.getExtensionBinder("java")</code>, and on this object call <code>setStrictJavaUriFormat(false)</code>.</p>
      <p>The <code>ExtensionFunctionFactory</code> (which can be used to change the details of the calling mechanism for reflexive
   extension functions, for example to perform diagnostic tracing) is now set as a property of the 
   <code>JavaExtensionFunctionLibrary</code>
  or <code>DotNetExtensionFunctionLibrary</code>, rather than directly via the <code>Configuration</code>.</p>
      <p>Under .NET, if an extension function expects a value of type <code>XdmAtomicValue</code>, it is now possible
   for the calling XPath expression to supply a node; the node will be automatically atomized.</p>
      <p>The factory mechanism for handling XSLT extension instruction namespaces has changed. Previously it was required
   that the namespace URI should end in the Java class name of a class implementing the <code>ExtensionElementFactory</code>
   interface. It is now possible to use any namespace URI you like. The namespace you choose must be associated with
   the name of the <code>ExtensionElementFactory</code> class in the Configuration, which you can do programmatically
   by calling <code>Configuration.setExtensionElementNamespace()</code>, or from the configuration file.
   Element extensibility is not available in Saxon Home Edition, which also means that the SQL extensions are
   not available.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="extensions92.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>