XSLT Error Reference

XPST0017

All versions XPath static error
Error message
Cannot find a matching 2-argument function named {namespace}name()

Saxon cannot resolve a function call: the function name is unknown, the number of arguments is wrong, or the function belongs to a newer XSLT/XPath version than the one you selected.

What it means

The processor found a function call it cannot match against any known function — either the name does not exist, or no version of that function accepts the number of arguments you passed (the arity).

Common causes

  1. The function belongs to a newer XSLT version. Calling tokenize(), replace(), matches() or current-group() while running as XSLT 1.0 fails — they were introduced in 2.0. Calling xml-to-json() or map/array functions under 2.0 fails — they are 3.0.
  2. Wrong number of arguments. substring-after('a') raises XPST0017 because substring-after() needs 2 arguments.
  3. Typo in the function name. string-lenght() instead of string-length().
  4. Missing namespace for user/extension functions. A function defined with <xsl:function name="my:double"> can only be called if the prefix my is bound to the same namespace URI at the call site.

How to fix it

  • Check the required version in the function reference and switch the processor version accordingly — in XSLT Playground use the version dropdown (1.0 / 2.0 / 3.0).
  • Verify the arity: the message tells you how many arguments you passed (a matching 2-argument function).
  • For user-defined functions, make sure the prefix is declared:
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:my="urn:my-functions">
  <xsl:function name="my:double">
    <xsl:param name="n"/>
    <xsl:sequence select="$n * 2"/>
  </xsl:function>
  <xsl:template match="/">
    <out><xsl:value-of select="my:double(21)"/></out>
  </xsl:template>
</xsl:stylesheet>