Subject: Recursive Templates From: Michael Stillwell <mjs@xxxxxxxxx> Date: Mon, 2 Aug 1999 03:12:41 +1000 (EST) |
I've just started using XSL and am wondering how to achieve the transformation such as the following. I want to transform <section>Introduction</section> into (say) <caps><strong>Introduction</strong></caps> My first attempt used templates like <xsl:template match="emph" name="emph"> <strong> <xsl:apply-templates/> </strong> </xsl:template> <xsl:template match="section"> <caps> <emph> <xsl:apply-templates/> </emph> </caps> </xsl:template> Unfortunately, the <emph> ... </emph> tags produced but the "section" template are not transformed into <strong> ... </strong> tags. I more or less understand why this is, but the best set of templates I have found that do what I want are <xsl:template match="emph" name="emph"> <strong> <xsl:copy-of select="$content"/> </strong> </xsl:template> <xsl:template match="section"> <caps> <xsl:call-template name="emph"> <xsl:with-param name="content"> <xsl:apply-templates/> </xsl:with-param> </xsl:call-template> </caps> </xsl:template> I cannot help but think there is a better way. Michael -- :::: mjs@xxxxxxxxx ::::::::::::::::::::::::::::: http://beebo.org :::: :::: mjs@xxxxxxxxx ::::::::::::::::::::::::::::: http://beebo.org :::: :::: mjs@xxxxxxxxx ::::::::::::::::::::::::::::: http://beebo.org :::: XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Administrivia -changed, XSL-List Owner | Thread | Re: Recursive Templates, David Carlisle |
Administrivia -changed, XSL-List Owner | Date | fop ... getting it to run, Eric Smith |
Month |