xsl-list
[Top] [All Lists]

Use FXSL for this (Was: Re: question on calling templates)

2002-08-30 01:14:53

--- "Rotkop, Eugene" <Eugene dot Rotkop at gs dot com> wrote:

 
Hi,

I was wondering if there is a way to store template name in the
variable and
then call template.
So, the sample XSL would be following:

<xsl:variable name="currentTemplate" select="'test'"/>
<xsl:call-template name="$currentTemplate"/>

Seems like XSLT does not allow this. Am I using the wrong syntax? Can
this
be achieved in any other way?

The reason I am asking about this is that I am trying to use multiple
templates to create
header, body and footer for a web page. Header and footer stays the
same for
all the pages. However,
body always changes. If I assign template names to header, footer and
body,
I can call them to apply these templates.
I want to be able to call diffent body templates depending on the
value
of a
variable.

Any help would be appreciated.

Thanks,
Eugene


Hi Eugene,

What you want to do is possible in another way by using a template
reference to a template (that must match the reference and need not be
named).

This approach is in the base of the whole XSLT 1.0 functional
programming library FXSL. 

A number of articles about FXSL and functional programming in XSLT 1.0
are available at:

http://fxsl.sourceforge.net

I'd recommend specifically the first and second article (in that
order), which introduce the most basic concepts of higher-order
functions and provide the implementation of the most generic design
patterns -- folds (primitive recursion) over lists, strings and trees,
maps, iteration, currying and partial application.

The FXSL library contains useful functions for:

  - calculating various math functions and their inverse (e.g.
trigonometric, hyperb.trigonometric, exponential, logarithmic,... etc)
and for solving equations of one real variable, numerical
differentiation and integration.

  - random number generator, generating numbers according to
pre-defined distribution, randomising a list.

  - various text-processing -- tokenizing, text justification, spelling
checking/correction and generation of close words.

The FXSL library has three different editions, which support MSXML,
XALAN and SAXON. It can be downloaded at:

http://sourceforge.net/projects/fxsl/


 

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • Use FXSL for this (Was: Re: question on calling templates), Dimitre Novatchev <=