|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Recursive Templates
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
|
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








