Hi,

Consider the following stylesheet....

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:str="http://exslt.org/strings";>

  <xsl:template match="/">
        <root>
          <xsl:choose>
                <xsl:when test="function-available('str:tokenize')">
                  <!-- called when run by xalan -->
                  <xsl:value-of select="str:tokenize('date math str')"/>
                </xsl:when>
                <xsl:otherwise>
                  <!-- called when run by saxon -->
                  <xsl:value-of select="tokenize('date math str')"/>
                </xsl:otherwise>
          </xsl:choose>
        </root>
  </xsl:template>
        
</xsl:stylesheet>

My specific problem is that saxon supports the use of XSLT2's tokenize
which is supported in xalan using the exslt str extension.

I need my stylesheet to work in both and my plan was to use
function-available('str:tokenize') to determine which one to use.  The
problem is that even though xalan wouldn't enter the second branch, it
detects that it can't call tokenize and throws the following
error.

SystemId Unknown; Line #15; Column #55; Could not find function: tokenize
SystemId Unknown; Line #15; Column #55; function token not found.
(Location of error unknown)java.lang.NullPointerException

(Location of error unknown)XSLT Error
(javax.xml.transform.TransformerConfigurationException):
getAssociatedStylesheets failed
Exception in thread "main" java.lang.RuntimeException:
getAssociatedStylesheets failed
        at org.apache.xalan.xslt.Process.doExit(Process.java:1155)
        at org.apache.xalan.xslt.Process.main(Process.java:1128)

Is there some way to get around this?

Cheers,
Andy

-- 
----
Andy Chambers
Formedix Ltd

Reply via email to