xsl-list
[Top] [All Lists]

RE: Almost identical templates

2004-07-01 06:30:31
something like this perhaps?

<xsl:template match="TOC | HEADER | MAGIC">
        <span><xsl:value-of select="name()"/></span>
</xsl:template>


-----Original Message-----
From: Pieter Reint Siegers Kort 
[mailto:pieter(_dot_)siegers(_at_)elnorte(_dot_)com]
Sent: Thursday, July 01, 2004 9:23 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Almost identical templates



"I'm sure that this can be done but my brain is not working at present."

Off Topic, I know, but this made me laugh - very original Peter! :-)

<prs/>

-----Original Message-----
From: Peter Hickman [mailto:peter(_at_)semantico(_dot_)com] 
Sent: Thursday, July 01, 2004 3:46 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Almost identical templates

I have the following template in my stylesheet:

    <xsl:template match="TOC">
        <div class="section">
            <span class="ref">TOC</span><br />
            <xsl:apply-templates select="*|text()" />
        </div>
    </xsl:template>

I also have:

    <xsl:template match="HEADER">
        <div class="section">
            <span class="ref">HEADER</span><br />
            <xsl:apply-templates select="*|text()" />
        </div>
    </xsl:template>

Infact I have quite a few of these almost identical templates, is there a
way I could do this

    <xsl:template match="*">
        <div class="section">
            <span class="ref">***MAGIC***</span><br />
            <xsl:apply-templates select="*|text()" />
        </div>
    </xsl:template>

Where ***MAGIC*** picks out the tag name that it matched on?

I'm sure that this can be done but my brain is not working at present.


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



!DSPAM:40e41042281002044319521!





<Prev in Thread] Current Thread [Next in Thread>