|
Subject: Re: [xsl] Passing parameters to an indirectly called template after matching. From: Kannan <riderchap@xxxxxxxxx> Date: Thu, 17 Apr 2008 08:12:49 -0400 |
Thank you Michael and Abel. I got it working with 2.0. I think I will
start using XSLT 2.0.
The infinite loop solved when I gave a default value for the
parameter, very novice to XSLT to know why, but its working now.
-Kannan
On Thu, Apr 17, 2008 at 7:54 AM, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
> Kannan wrote:
>
> > Can I pass parameters like this.
> >
> > Calling_Point => A_Named_Template, do apply-templates => {One or more
> > matching Templates } => A_Named_Template.
> >
> > I tried to do this by passing parameters along with apply-templates,
> > and then passing it again from all matched templates to a named
> > template where I finally need it, it ended up in infinite loop. When I
> > just taken out the parameter passing and used global variables it
> > worked fine.
> >
>
> That you turned into an infinite loop has to do with a bug in your
> programming logic, not the passing itself. And probably you mean that the
> recursion went too deeply nested (but this may feel like a "loop"). In XSLT
> 1.0, the method of programming is certainly viable. But as soon as a new
> step is required between one and another template, you must remember to pass
> on the parameters again (which can become a maintenance nightmare)
>
> What you are after is what Michael Kay suggested: the XSLT 2.0 feature of
> tunneling parameters which can be defined once and will be passed on until
> it matches a template that defines these parameters (where you must also
> specify that they are tunneled).
>
> If you have to stick to XSLT 1.0, using global parameters may be the
> easiest way to go. If you want to modularize or "hide" the variables, you
> can use an imported stylesheet which defines its own "global" parameters
> (variables).
>
> Cheers,
> -- Abel Braaksma
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Passing parameters to an , Abel Braaksma | Thread | Re: [xsl] Passing parameters to an , Abel Braaksma |
| Re: [xsl] Passing parameters to an , Abel Braaksma | Date | Re: [xsl] Passing parameters to an , Abel Braaksma |
| Month |