This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: correction:How to do a subscript from <sup>-34</sup>
- From: "Thomas B. Passin" <tpassin at mitretek dot org>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 7 May 2002 16:19:39 -0400
- Subject: Re: [xsl] correction:How to do a subscript from <sup>-34</sup>
- References: <58F1731F.2C0DBB54.C6D0F0B0@netscape.net>
- Reply-to: xsl-list at lists dot mulberrytech dot com
<pandianoliver@netscape.net>]
How can I go through my xml file and replace the following with subscript:
<sup>-34</sup>
[Tom P]
Assuming that you want to change that to
<sub>-34</sub>
you can use
<xsl:template match='sup'>
<sub><xsl:value-of select='.'/></sub>
</xsl:template>
To make sure this template gets called, you will want to have some variation
of <xsl:apply-templates> in the stylesheet.
If there could also be child elements within the "sup" element, you could
use
<xsl:template match='sup'>
<sub><xsl:apply-templates/></sub>
</xsl:template>
For sub- and super-scripts, probably not needed.
Cheers,
Tom P
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list