1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Built-in-extension-functions

From saxon

(Difference between revisions)
Jump to: navigation, search
(Troubleshooting: Update for Saxon 9.2)
(Troubleshooting)
 
Line 11: Line 11:
*** If you are using the Oxygen Eclipse plugin, you must make sure that your saxon jars are also located at $eclipse_home/$oxygen_plugin_home/plugin/lib. If you are using standalone Oxygen, you need to place the jars in the analagous directory. You must also make sure that the jar file is listed in the file $oxygen/plugin.xml. These steps will ensure that Oxygen has access to the Saxon jars. However, when actually running an application under Eclipse, the actual transformation will not use these jar files-- they are only used for validation and workspace scenario transformations. In order to configure your workspace to use a specific Saxon version you must first place the saxon jar files in your classpath (usually by placing the files into your WEB-INF directory, and then right-clicking on these files to add them to the buildpath), and then you must add the following JVM parameter: "-Djavax.xml.transform.TransformerFactory=com.saxonica.SchemaAwareTransformerFactory" for Saxon-SA or "-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl" for Saxon-B or Saxon-HE. The class name for Saxon-PE is com.saxonica.config.ProfessionalTransformerFactory, and for Saxon-EE com.saxonica.config.EnterpriseTransformerFactory. This can be set under the JVM settings dialog. If you want to use Saxon to perform XPATH queries, you must also set "-Djavax.xml.transform.TransformerFactory=com.saxonica.SchemaAwareTransformerFactory".
*** If you are using the Oxygen Eclipse plugin, you must make sure that your saxon jars are also located at $eclipse_home/$oxygen_plugin_home/plugin/lib. If you are using standalone Oxygen, you need to place the jars in the analagous directory. You must also make sure that the jar file is listed in the file $oxygen/plugin.xml. These steps will ensure that Oxygen has access to the Saxon jars. However, when actually running an application under Eclipse, the actual transformation will not use these jar files-- they are only used for validation and workspace scenario transformations. In order to configure your workspace to use a specific Saxon version you must first place the saxon jar files in your classpath (usually by placing the files into your WEB-INF directory, and then right-clicking on these files to add them to the buildpath), and then you must add the following JVM parameter: "-Djavax.xml.transform.TransformerFactory=com.saxonica.SchemaAwareTransformerFactory" for Saxon-SA or "-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl" for Saxon-B or Saxon-HE. The class name for Saxon-PE is com.saxonica.config.ProfessionalTransformerFactory, and for Saxon-EE com.saxonica.config.EnterpriseTransformerFactory. This can be set under the JVM settings dialog. If you want to use Saxon to perform XPATH queries, you must also set "-Djavax.xml.transform.TransformerFactory=com.saxonica.SchemaAwareTransformerFactory".
*** Make sure that the saxon jars in this directory contain the version you need (different versions of saxon support different function sets, and for example, saxon:sort() is not supported by the saxon jars that ship with Oxygen 8.1- you need Oxygen 8.2).
*** Make sure that the saxon jars in this directory contain the version you need (different versions of saxon support different function sets, and for example, saxon:sort() is not supported by the saxon jars that ship with Oxygen 8.1- you need Oxygen 8.2).
 +
** Are you sure you are running Saxon? If you use JAXP interfaces, it's very easy to load Xalan when you intended to load Saxon. Check which processor you are using by outputting the value of <code>system-property('xsl:vendor')</code> in a comment or in xsl:message output; or make sure Saxon is loaded by instantiating the Saxon TransformerFactory directly (<code>new net.sf.saxon.TransformerFactoryImpl()</code>) instead of relying on the JAXP classpath search, which is expensive as well as being error-prone.

Current revision as of 09:39, 11 August 2010

Saxon built-in extension functions

Documentation: see http://www.saxonica.com/documentation/extensions/functions.html

Troubleshooting

Why can't I access the saxon functions?

  • There are several reasons you may not be able to access your saxon functions.
    • From Saxon 9.2 onwards, these extension functions are not supported in the open source home edition (Saxon-HE). You need Saxon-PE or Saxon-EE.
    • You need to declare the saxon namespace "http://saxon.sf.net/". It must be specified precisely, including the trailing slash, or the names will not be recognized. You may then reference functions in your stylesheet in this way "saxon:evaluate($test)".
    • You do not need to declare saxon in the extension-element-prefixes attribute in order to call an extension function. This is needed only to call extension instructions, such as saxon:assign
    • If a function such as saxon:evaluate() is working, but not saxon:sort(), then either your extension configuration is broken or your extension configuration is set to use version of saxon that does not support the given function.
      • If you are using the Oxygen Eclipse plugin, you must make sure that your saxon jars are also located at $eclipse_home/$oxygen_plugin_home/plugin/lib. If you are using standalone Oxygen, you need to place the jars in the analagous directory. You must also make sure that the jar file is listed in the file $oxygen/plugin.xml. These steps will ensure that Oxygen has access to the Saxon jars. However, when actually running an application under Eclipse, the actual transformation will not use these jar files-- they are only used for validation and workspace scenario transformations. In order to configure your workspace to use a specific Saxon version you must first place the saxon jar files in your classpath (usually by placing the files into your WEB-INF directory, and then right-clicking on these files to add them to the buildpath), and then you must add the following JVM parameter: "-Djavax.xml.transform.TransformerFactory=com.saxonica.SchemaAwareTransformerFactory" for Saxon-SA or "-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl" for Saxon-B or Saxon-HE. The class name for Saxon-PE is com.saxonica.config.ProfessionalTransformerFactory, and for Saxon-EE com.saxonica.config.EnterpriseTransformerFactory. This can be set under the JVM settings dialog. If you want to use Saxon to perform XPATH queries, you must also set "-Djavax.xml.transform.TransformerFactory=com.saxonica.SchemaAwareTransformerFactory".
      • Make sure that the saxon jars in this directory contain the version you need (different versions of saxon support different function sets, and for example, saxon:sort() is not supported by the saxon jars that ship with Oxygen 8.1- you need Oxygen 8.2).
    • Are you sure you are running Saxon? If you use JAXP interfaces, it's very easy to load Xalan when you intended to load Saxon. Check which processor you are using by outputting the value of system-property('xsl:vendor') in a comment or in xsl:message output; or make sure Saxon is loaded by instantiating the Saxon TransformerFactory directly (new net.sf.saxon.TransformerFactoryImpl()) instead of relying on the JAXP classpath search, which is expensive as well as being error-prone.
Personal tools