title: xpath-functions does not identify an external Java class
body: <p>The following XSLT transformation displays an error whenever I try to use the function node-name().</p>
  
  <blockquote>
    <p><em>Error: E[Saxon6.5.5]The URI <a href="http://www.w3.org/2005/xpath-functions" rel="nofollow">http://www.w3.org/2005/xpath-functions</a> does not identify an external Java class</em></p>
  </blockquote>
  
  <pre><code>&lt;xsl:stylesheet version="1.1" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:fn="http://www.w3.org/2005/xpath-functions"&gt;
  &lt;!--
  &lt;xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  --&gt;        
  
      &lt;xsl:output method="text" /&gt;
      &lt;xsl:variable name="in" select="/"/&gt;
      &lt;xsl:variable name="filter" select="document('elementsToBeLeftIn.xml')"/&gt;
  
      &lt;xsl:template match="/"&gt;
          &lt;xsl:apply-templates select="*"&gt;
              &lt;xsl:with-param name="f" select="$filter/*"/&gt;
          &lt;/xsl:apply-templates&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="*"&gt;
          &lt;xsl:param name="f"/&gt;
          &lt;xsl:choose&gt;
              &lt;xsl:when test="$f/*"&gt;
                  &lt;xsl:copy-of select="fn:node-name()"/&gt;
  
                  &lt;!--
                  &lt;xsl:for-each select="*[fn:node-name(.) = $f/*/fn:node-name(.)]"&gt;
                      &lt;xsl:apply-templates select="."&gt;
                          &lt;xsl:with-param name="f" select="f/*[fn:node-name() = current()/fn:node-name()]"/&gt;
                      &lt;/xsl:apply-templates&gt;
                  &lt;/xsl:for-each&gt;
                  --&gt;
              &lt;/xsl:when&gt;
              &lt;xsl:otherwise&gt;
                  &lt;xsl:copy-of select="."/&gt;
              &lt;/xsl:otherwise&gt;
          &lt;/xsl:choose&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;    
  </code></pre>
  
  <p>Thanks David. <strong>This is what I really want to make work</strong> (it is recursive). Using <code>name()</code> I still get error <code>*Unexpected tocken [&lt;function&gt;] in path expression*</code>. </p>
  
  <p>After you</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.1" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:fn="http://www.w3.org/2005/xpath-functions"&gt;
  &lt;!--
  &lt;xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  --&gt;        
  
      &lt;xsl:output method="text" /&gt;
      &lt;xsl:variable name="in" select="/"/&gt;
      &lt;xsl:variable name="filter" select="document('elementsToBeLeftIn.xml')"/&gt;
  
      &lt;xsl:template match="/"&gt;
          &lt;xsl:apply-templates select="*"&gt;
              &lt;xsl:with-param name="f" select="$filter/*"/&gt;
          &lt;/xsl:apply-templates&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="*"&gt;
          &lt;xsl:param name="f"/&gt;
          &lt;xsl:choose&gt;
              &lt;xsl:when test="$f/*"&gt;
                  &lt;xsl:for-each select="*[name() = $f/*/name()]"&gt;
                      &lt;xsl:apply-templates select="."&gt;
                          &lt;xsl:with-param name="f" select="f/*[name() = current()/name()]"/&gt;
                      &lt;/xsl:apply-templates&gt;
                  &lt;/xsl:for-each&gt;
              &lt;/xsl:when&gt;
              &lt;xsl:otherwise&gt;
                  &lt;xsl:copy-of select="."/&gt;
              &lt;/xsl:otherwise&gt;
          &lt;/xsl:choose&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;    
  </code></pre>