In XPath 2.0 a function call to an unknown function is a static error whether or not the function is actually called.

One workaround is to run in 1.0 compatibility mode (set version="1.0" perhaps on the xsl:function element): in 1.0, calling a function that doesn't exist was a dynamic error. Another solution, rather better, is to use use-when:

<xsl:function name="igs:file-exists" as="xs:boolean">
  <xsl:param name="uri" as="xs:string"/>   
  <xsl:sequence use-when="not(function-available('java-uri:new'))" select="true()"/>
  <xsl:message  use-when="not(function-available('java-uri:new'))" >[ERROR] : java function is not available</xsl:message></xsl:function>

(Note: xsl:value-of constructs a text node. You don't want to do that in a function that's supposed to return a boolean.)

Michael Kay