> <func:function name="function:translateBrandCode">

In XSLT 2.0, use <xsl:function>. The <func:function> syntax is an EXSLT addition to XSLT 1.0 implemented by some XSLT 1.0 processors, but it was superseded by the xsl:function syntax in XSLT 2.0.

Michael Kay
Saxonica

On 17/08/2010 16:01, Suleman Butt wrote:
Hi Folks,
            I am trying to call a function in my xsl script:


<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:datetime="http://exslt.org/dates-and-times" xmlns:ota="http://www.opentravel.org/OTA/2003/05" xmlns:system="java:java.lang.System" xmlns:parse="java:java.text.ParsePosition" xmlns:dyn="http://exslt.org/dynamic" xmlns:func="http://exslt.org/functions" xmlns:function="http://function.com" xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="xsl datetime ota  dyn func function exslt system parse">

<xsl:import href="common.xsl"/>

                 <TOCode>
<xsl:value-of select="function:translateBrandCode(@BrandCode)"/>
</TOCode>

...

common.xsl

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:datetime="http://exslt.org/dates-and-times" xmlns:ota="http://www.opentravel.org/OTA/2003/05" xmlns:java="java" xmlns:dyn="http://exslt.org/dynamic" xmlns:func="http://exslt.org/functions" xmlns:function="http://function.com" exclude-result-prefixes="xsl datetime ota java dyn func function">

..

<func:function name="function:translateBrandCode">
<xsl:param name="value"/>
<xsl:choose>
<xsl:when test="$value = 'KUON' ">
<func:result>KUON</func:result>
</xsl:when>
<xsl:otherwise>
<func:result>
<xsl:value-of select="$value"/>
</func:result>
</xsl:otherwise>
</xsl:choose>
</func:function>


but getting the error:

XPST0017: XPath syntax error at char 39 on line 141 in {...translateBrandCode(@BrandCo...}:
    Cannot find a matching 1-argument function named {http://function.com}translateBrandCode()


The above works in xalan xslt 1.0
--
Regards Suleman
------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help