[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: is there a "template" template?

Subject: RE: is there a "template" template?
From: "Wilson, James.W" <James.W.Wilson@xxxxxxxxxxxxx>
Date: Mon, 12 Jul 1999 12:49:50 -0500
xsl 10
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>&#10;&#10;</xsl:text>
    <xsl:call-template name='text1'/>
    <xsl:text>&#10;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 &#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


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.