You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Gary L Peskin <ga...@firstech.com> on 2000/12/27 00:23:11 UTC

Re: About extension in Xalan 2.0D05.

Guoliang Cao wrote:
> I'm calling a extension function like this:
> 
>               <xsl:copy-of
> select="ext-security:getAccessInfo('auth1','a','b')/*"/>
> 
> It is totally ok with xalan 2.0D01.  But reports error message if using
> xalan 2.0D05.   I've checked the classpath and the parameter type. They
> are correct. What problem can this be?  Thanks for your help.

Guoliang --

The most likely cause for this is that com.abc.XSLTExtension is not on
your CLASSPATH.  Can you double check this and see if this is the
problem?

In the meantime, I'll try to recreate the situation here and see if I
can reproduce the problem.

> Moreover, in xalan 2.0D01  I can skip the param definition in a template
> and use it directly, but now Xalan will report an error when it finds an
> un-defined variable/param.
> <xsl:apply-templates select="a">
>   <xsl:with-param name="param_b" select="b"/>
> </xsl:apply-templates>
> 
> <xsl:template select="a">
> <b><xsl:value-of select="$param_b"/></b>
> ...
> </xsl:template>
> 
> ERROR:
> VariableReference given for variable out of context or without
> definition!  Name = param_b

I think that this behavior is correct and that the .D01 behavior was in
error.  Try adding a

  <xsl:param name="param_b">

just after the xsl:template.  This should allow you to "receive" the
passed parameter.  The XSLT Recommendation section 11.6 states "It is
not an error to pass a parameter x to a template that does not have an
xsl:param element for x; the parameter is simply ignored."  I think
that's what Xalan is doing.

Gary