Q: is there a "template" template?

Subject: Q: is there a "template" template?
From: Aaron Fischer <fischer17@xxxxxxxx>
Date: Mon, 12 Jul 1999 10:12:09 -0700

I am trying to greatly simplify my XSL code. 

I have a basic template transformation:

<xsl:template match="control">
<
xsl:text &#10; &#10;CONTROL&#10; &#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text &#10;END&#10; &#10;</xsl:text>
</xsl:template>

I need to apply this kind of template to literally hundreds of different cells;  i.e. I have other cells which require the same kind of template, except replace "control" with "[something else]".

At the moment I have a huge XSL file full of these little templates -- with all of them doing the same thing under a different name.

Is there a way I can write a "template" template, and have my code internally generate
the actual templates during compilation?  i.e I would have something like:

the "template" template:  PARAM1 - match specification
    PARAM2 - output text

<xsl:template match="PARAM1">
<
xsl:text &#10; &#10;PARAM2&#10; &#10;</xsl:text>
<xsl:apply-templates/>
<xsl:text &#10;END&#10; &#10;</xsl:text>
</xsl:template>

make-template( "control", "CONTROL")
make-template( "output", "OUTPUT")
make-template( "blah", "whatever")

etc...

Basically, I'm looking for a template in the true sense of the word, as in the C++ way.

All help appreciated,

Aaron

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