|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: is there a "template" template?
you could use a named template, and call it from your 'generic' template:
<xsl:template name='text1'>
<xsl:choose>
<xsl:when test='control'>CONTROL</xsl:when>
<xsl:when test='param1'>PARAM1</xsl:when>
...
</xsl:choose>
</xsl:template>
<xsl:template match='CONTROL|PARAM1|...'>
<xsl:text> </xsl:text>
<xsl:call-template name='text1'/>
<xsl:text> END</xsl:text>
</xsl:template>
James
-----Original Message-----
From: Aaron Fischer [mailto:fischer17@xxxxxxxx]
Sent: Monday, July 12, 1999 1:12 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Q: is there a "template" template?
I am trying to greatly simplify my XSL code.
I have a basic template transformation:
<xsl:template match="control">
<xsl:text CONTROL </xsl:text>
<xsl:apply-templates/>
<xsl:text END </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 PARAM2 </xsl:text>
<xsl:apply-templates/>
<xsl:text END </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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








