Creating a custom XSLT function

I try to create a custom XSLT function, but every time I get this error:

'The first argument to the non-static Java function' compareCI 'is not a valid object reference.'

  <xsl:stylesheet version="2.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:foo="http://whatever">

  <xsl:function name="foo:compareCI">
    <xsl:param name="string1"/>
    <xsl:param name="string2"/>
    <xsl:value-of select="compare(upper-case($string1),upper-case($string2))"/>
  </xsl:function>

  <xsl:template match="/">
      <xsl:value-of select="foo:compareCI('red','blue')"/>
  </xsl:template>

</xsl:stylesheet> 

I hope one of you can help me. Thanks in advance.

+5
source share
1 answer

, Xalan, XSLT 1.0 xsl:. , () Xalan xsl: XSLT 1.0, , = "2.0", , ( " " ); , foo: compareCI(), , Java.

XSLT 2.0, Saxon.

+6

All Articles