You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Paul Brady <pa...@macalla.com> on 2002/12/04 14:54:37 UTC

RE: Passing params to an extension element

Thank you Simon. That worked! I too originally thought that this was
reasonable behaviour and that it should be up to the extension element to
evaluate variables & template params. And yes, it would be nice to put
things like this in the faq section on xml.apache.org/xalanj.

-----Original Message-----
From: Simon Kitching [mailto:simon@ecnetwork.co.nz] 
Sent: 28 November 2002 21:11
To: 'xalan-j-users@xml.apache.org'
Subject: RE: Passing params to an extension element

Hi Morris/Paul,

As far as I am aware, there is no Xalan bug here.

I don't think Xalan ever promises to evaluate attributes on an extension
tag before invoking the extension.

They get passed literally to the extension, and the extension can then
evaluate them if it wishes to do so (see my earlier email).

Currently, the attribute-value-template stuff is only ever evaluated
when the containing element is not in the xsl: namespace, ie is a tag
destined for output to the user. This behaviour seems reasonable to me.

Maybe there could be an FAQ entry showing how to evaluate an expression
when inside an extension [something like the code I included in previous
email on this topic]? I went through the same puzzlement as Paul before
coming up with this solution...

Regards,

Simon

On Fri, 2002-11-29 at 06:19, mkwan@ca.ibm.com wrote:
> Hi Paul
> 
> Please open a bug in the Bugzilla database
> (http://nagoya.apache.org/bugzilla).  I will look at it when I have time.
> 
> Thanks for reporting the problem.
> 
> Morris Kwan
> XSLT Development
> IBM Toronto Lab
> Tel: (905)413-3729
> Email: mkwan@ca.ibm.com
> 
> 
> 
>

>                       Paul Brady

>                       <paul.brady@macal        To:       Morris
Kwan/Toronto/IBM@IBMCA                                             
>                       la.com>                  cc:
"'xalan-j-users@xml.apache.org'" <xa...@xml.apache.org>           
>                                                Subject:  RE: Passing
params to an extension element                                
>                       11/28/2002 12:08

>                       PM

>

>

> 
> 
> 
> Thanks for your reply Morris. Yes, I tried that approach before, but I
> still
> get the same result. The value of the parameter is not substituted. I get
> "{$docletTemplate}". Is there a way to evaluate this from within my
> extension?
> 
> Paul.
> 
> -----Original Message-----
> From: mkwan@ca.ibm.com [mailto:mkwan@ca.ibm.com]
> Sent: 28 November 2002 16:25
> To: Paul Brady
> Cc: 'xalan-j-users@xml.apache.org'
> Subject: RE: Passing params to an extension element
> 
> Hi, Paul
> 
> I think you need to use AVT (attribute value template) in a literal result
> element. Please change  <dynamicTemplate:dynamicCallTemplate name
> ="$docletTemplate"> to <dynamicTemplate:dynamicCallTemplate name="
> {$docletTemplate}">.
> 
> Morris Kwan
> XSLT Development
> IBM Toronto Lab
> Tel: (905)413-3729
> Email: mkwan@ca.ibm.com
> 
> 
> 
> 
> 
>                       Paul Brady
> 
>                       <paul.brady@macal        To:       Morris
> Kwan/Toronto/IBM@IBMCA
>                       la.com>                  cc:
> "'xalan-j-users@xml.apache.org'" <xa...@xml.apache.org>
>                                                Subject:  RE: Passing
params
> to an extension element
>                       11/28/2002 10:48
> 
>                       AM
> 
> 
> 
> 
> 
> 
> 
> 
> I get the same result when using v2.4.1.
> The following piece of code works when evaluating local variables, but not
> for parameters. Is there a similar way to evaluate paramteters?
> 
> XPathContext xctxt = context.getTransformer().getXPathContext();
> XPath myxpath = new XPath("$VarName", elem, xctxt.getNamespaceContext(),
> 0);
> XObject xobj = myxpath.execute(xctxt, context.getContextNode(), elem);
> String strVarVal = xobj.str();
> 
> Thanks,
> 
> Paul
> 
> -----Original Message-----
> From: mkwan@ca.ibm.com [mailto:mkwan@ca.ibm.com]
> Sent: 27 November 2002 17:59
> To: Paul Brady
> Cc: 'xalan-j-users@xml.apache.org'
> Subject: Re: Passing params to an extension element
> 
> We fixed a lot of extension problems in Xalan 2.4.1. Please try with this
> latest release to see if it fixes your problem.
> 
> Morris Kwan
> XSLT Development
> IBM Toronto Lab
> Tel: (905)413-3729
> Email: mkwan@ca.ibm.com
> 
> 
> 
> 
> 
>                       Paul Brady
> 
>                       <paul.brady@macal        To:
> "'xalan-j-users@xml.apache.org'" <xa...@xml.apache.org>
>                       la.com>                  cc:
> 
>                                                Subject:  Passing params to
> an extension element
>                       11/27/2002 12:30
> 
>                       PM
> 
> 
> 
> 
> 
> 
> 
> 
> I'm trying to pass an <xsl:param> into an extension element using Xalan
> 2.3.1.
> 
> If I do something like:
>     <xsl:template name="DocletContentBody">
>         <xsl:param name="docletTemplate"/>
> 
>         <dynamicTemplate:dynamicCallTemplate name="$docletTemplate">
>             <xsl:call-template name="doesntMatter">
>             </xsl:call-template>
>         </dynamicTemplate:dynamicCallTemplate>
>     </xsl:template>
> 
> where dynamicTemplate is my extension element, the value of the name
> attribute evaluates to "$docletTemplate" rather than the value of the
> parameter.
> 
> Any ideas?
> 
> Paul.
> 
> 
> 
> 
> 
> 
> 
> 
-- 
Simon Kitching <si...@ecnetwork.co.nz>