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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--