RE: [xsl] how to: Conditionally call nested XSLs based on parameters or variables passed to it at a higher level?

Subject: RE: [xsl] how to: Conditionally call nested XSLs based on parameters or variables passed to it at a higher level?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 12 Sep 2003 17:04:05 -0400

If I understand you rightly, I think you might, in addition to exploring the options already described, consider whether, instead of passing parameters through your templates (which can be quite cumbersome to maintain, as you may be discovering), instead associate "parameter" values (they won't be xsl parameters) with higher-level wrapper nodes (sections or whatever) through some kind of "function" -- which would take the form, either of an XPath expression you can use at need when in your lower-level templates (such as <xsl:if test="ancestor::section/@type='chapter'">) or a lookup table you can consult, or a named template you can call, or a combination of these.

This is just because some problems that seem to call for passing templates down through the tree, to provide "state" to templates at lower levels, can sometimes be solved equally well by providing that state by other means (such as XPath queries and/or dynamic local variable assignments, both of which XSLT is very good at).

Am I making any sense?


At 12:17 PM 9/12/2003, you wrote:

Please have a look at this.

Here I have implemented with the help of a number of significant people,
a parameter passing model that goes into nested templates ( basically
templates that are called by others, i.e. where X calls Y but Y can
never call X. It's kind of Y nested inside X.

I am trying to do the same for the entire document stylesheets I have so
that I do not have to hard code the stuff.

Of course, Dimitre in effect I want to achieve the functional
programming paradigm while maintaining XSL 1.0 specs ( the ones current
supported by the System.Xml.Xsl transform ) ( I do know that Saxon
supports XSLT 2.0 with Functions but I cannot use those things.)

Also, the FXSL project. Are they a set of XSL based extension libraries
or will I actually need to install "extension" code with my XSLT

I would like to remain "pure" xsl 1.0 as much as possible. So, any
comments or ideas based on the (above URL) and improving that would be
great. Any other "pure XSL" ideas would be nice.

I have printed out that whitepaper of yours that talks about
" One particularly elegant way to deal with parameters scoping is by
using partial application -- described in the second reference above.

___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_ "Thus I make my own use of the telegraph, without consulting the directors, like the sparrows, which I perceive use it extensively for a perch." -- Thoreau

XSL-List info and archive:

Current Thread