Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8285457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:28:16+00:00 2026-06-08T11:28:16+00:00

The following XSLT transformation displays an error whenever I try to use the function

  • 0

The following XSLT transformation displays an error whenever I try to use the function node-name().

Error: E[Saxon6.5.5]The URI http://www.w3.org/2005/xpath-functions does not identify an external Java class

<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">
<!--
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-->        

    <xsl:output method="text" />
    <xsl:variable name="in" select="/"/>
    <xsl:variable name="filter" select="document('elementsToBeLeftIn.xml')"/>

    <xsl:template match="/">
        <xsl:apply-templates select="*">
            <xsl:with-param name="f" select="$filter/*"/>
        </xsl:apply-templates>
    </xsl:template>

    <xsl:template match="*">
        <xsl:param name="f"/>
        <xsl:choose>
            <xsl:when test="$f/*">
                <xsl:copy-of select="fn:node-name()"/>

                <!--
                <xsl:for-each select="*[fn:node-name(.) = $f/*/fn:node-name(.)]">
                    <xsl:apply-templates select=".">
                        <xsl:with-param name="f" select="f/*[fn:node-name() = current()/fn:node-name()]"/>
                    </xsl:apply-templates>
                </xsl:for-each>
                -->
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy-of select="."/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

</xsl:stylesheet>    

Thanks David. This is what I really want to make work (it is recursive). Using name() I still get error *Unexpected tocken [<function>] in path expression*.

After you

<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">
<!--
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-->        

    <xsl:output method="text" />
    <xsl:variable name="in" select="/"/>
    <xsl:variable name="filter" select="document('elementsToBeLeftIn.xml')"/>

    <xsl:template match="/">
        <xsl:apply-templates select="*">
            <xsl:with-param name="f" select="$filter/*"/>
        </xsl:apply-templates>
    </xsl:template>

    <xsl:template match="*">
        <xsl:param name="f"/>
        <xsl:choose>
            <xsl:when test="$f/*">
                <xsl:for-each select="*[name() = $f/*/name()]">
                    <xsl:apply-templates select=".">
                        <xsl:with-param name="f" select="f/*[name() = current()/name()]"/>
                    </xsl:apply-templates>
                </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy-of select="."/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

</xsl:stylesheet>    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:28:17+00:00Added an answer on June 8, 2026 at 11:28 am

    Even in XSLT2 you never need to prefix standard functions like node-name(). But you are using saxon 6 which is XSLT1 so you must not prefix the functions or they will never be recognised. (XPath 1 standard functions are not in a namespace)

    just use select="name()"

    However I don’t think your code will work as you expect (but you didn’t say what you wanted it to do) but it will only ever apply templates to one element (the top level document element) as templates are never recursively applied.

    In the case that the filter test is true <xsl:copy-of select="name()" would put out the name of that element, with no markup (so the result will not be well formed xml).

    In the case that the filter test is false the entire document element including all its children is copied to the output and no further processing takes place.

    $f/*/name()
    

    is legal in XPath2 but not in XPath 1, where path expressions using / may only use nodes not end with a function that returns a string. Not sure exactly what you want to do so can’t offer an immediate replacement.

     current()/name()
    

    can be written as

     name(current())
    

    in XPath 1.

    But since you are using saxon java implementation why not simply use saxon 9 instead of saxon 6 and benefit from over a decade’s worth of further development in the xslt engine?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i use the following XSLT by using XMLSpy: <?xml version=1.0 encoding=UTF-16?> <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
I've the following xslt file: <?xml version=1.0 encoding=UTF-8?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <!-- USDomesticCountryList -
I'm applying an XSLT stylesheet to the following XML file: <top xmlns=http://www.foo.com/bar> <elementA />
i have the following xslt sheet: <?xml version=1.0 encoding=UTF-8 ?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version=1.0> <xsl:variable
I have a trouble getting the following result from a xml/xslt transformation: <root> <node>
I have the following XSLT variable: <xsl:variable name=superid select=/contentdata/id/> Furthermore, I have a node
I have the following: <Data xmlns:x=Namespace.com> <Node></Node> <Node2></Node2> <Node3></Node3> </Data> How using XSLT can
I am trying to remove the attribute xmlns=http://webdev2003.test.com from the following xml using xsl/xslt,
I have the following xslt template: <xsl:template name=with-newlines> <xsl:param name=text /> <fo:block linefeed-treatment=preserve white-space-collapse=false
I use the Java (6) XML-Api to apply a xslt transformation on a html-document

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.