Subject: Re: [xsl] Almost identical templates From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx> Date: Thu, 1 Jul 2004 10:07:20 +0100 |
Hi Peter, <xsl:template match="TOC|MAGIC"> <div class="section"> <span class="ref"> <xsl:value-of select = "name()"/> </span> </div> </xsl:template> You could do a * if you want to match all nodes. <xsl:template match="*"> <div class="section"> <span class="ref"> <xsl:value-of select = "name()"/> </span> </div> </xsl:template> Cheers, Vasu ----- Original Message ----- From: "Peter Hickman" <peter@xxxxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, July 01, 2004 9:46 AM 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@xxxxxxxxxxxxxxxxxxxxxx> > --+-- > >
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Almost identical template, George Cristian Bina | Thread | Re: [xsl] Almost identical template, Peter Hickman |
Re: [xsl] Almost identical template, George Cristian Bina | Date | Re: [xsl] Almost identical template, Peter Hickman |
Month |