|
Subject: [xsl] Display value AND apply templates From: "Drew McLellan" <dru@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 11 Aug 2003 04:45:29 -0700 |
I've been looking at this for too long and can no longer think clearly. Take this example:
<myxml>
<para>The notation for water is
<chem>H
<sub>2</sub>
0
</chem>
</para>
</myxml>
I'm trying to transform to XHTML. The desired output for the above would be:
<p>The notation for water is <span class="chem">H<sub>2</sub>0</span></p>
The problem I have is that if I use value-of "." I can get the value of node, but no further templates are applied. If I use apply-templates "*" I get the sub-templates but no value.
For example:
<xsl:template match="chem">
<span class="chem"><xsl:apply-template select="*" /></span>
</xsl:template>
<xsl:template match="sub">
<sub><xsl:value-of select="." /></sub>
</xsl:template>
This gets the <sub> but loses the value of the <chem>.
As I say, I've lost all clarity of mind on this, so I'm expecting it to be obvious! Any and all suggestions most welcome.
Thanks for your time.
Drew McLellan
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Problem making a transfor, Michael Kay | Thread | Re: [xsl] Display value AND apply t, Simon Kelly |
| RE: [xsl] Problem making a transfor, Rob Anderson | Date | Re: [xsl] Problem making a transfor, Simon Kelly |
| Month |