Question

I am having trouble getting the namespace in this XSL to resolve. I am using XMLSpy, with external transformation engine of Xalan. No matter how I process this, I am getting either a "Could not find function" or "no xml-stylesheet pi found in ...."

What do I need to tweak to allow custom java classes to be used via the Namespace?

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:Utils="xalan://com.util.Utils" extension-element-prefixes="Utils" 
        xmlns:java="java" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">

     <xsl:template match="/ORDER">
            <xsl:variable name="strDivId">
                 <xsl:value-of select="Utils.getDivisionId($strSiteId,$strDivName,$strCompanyNo,$strDivNo,$strFranchNo)"/>
            </xsl:variable>
     <!-- Other Stuff Occurs -->
     </xsl:template>
Was it helpful?

Solution

<xsl:value-of select="Utils.getDivisionId(...)"/>

Extension functions are referred to by XML-style QNames - Utils is the namespace prefix so that dot should be a colon.

<xsl:value-of select="Utils:getDivisionId(...)"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top