1

I'm using SAXON processor for xsl file as follows:

   <?xml version="1.0" encoding="utf-8"?>
   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    version="1.0" xmlns:java="http://xml.apache.org/xslt/java"
                    exclude-result-prefixes="java">
    <xsl:output method="xml"/>
    <xsl:template name="printjavaDate">
    <xsl:variable name="date" select="java:java.util.Date.new()"/>
    <xsl:value-of select=""/>
    </xsl:template>

But this code isn't working for me.

It throws error:

javax.xml.transform.TransformerException: The URI http://xml.apache.org/xslt/java does not identify an external Java class
                at com.icl.saxon.style.StyleElement.styleError(StyleElement.java:803)

I'm not sure why is this happening. I've requirement of using XSLT 1.0 only.

Can I know what is causing this error? Hope experts here will help me out.

1
  • The only possible reason I can see for a requirement to use XSLT 1.0 only is to ensure that your code is portable across XSLT processors, and if that's the requirement, then using Xalan extension functions entirely defeats the purpose. Commented Oct 4, 2016 at 9:24

1 Answer 1

0

I guess xmlns:java="http://xml.apache.org/xslt/java" is Xalan specific, if you want to use extension functions in Saxon 6 then see http://saxon.sourceforge.net/saxon6.5.5/extensibility.html.

Here is an example that works for me with Saxon 6.5:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:date="java:java.util.Date">

    <xsl:output method="xml"/>

    <xsl:template name="printjavaDate" match="/">
        <xsl:variable name="date" select="date:new()"/>
        <xsl:value-of select="$date"/>
    </xsl:template>

</xsl:stylesheet>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.