Subject: RE: Embedding html within xml
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Thu, 11 Mar 2004 20:54:10 +0100
|
> -----Original Message-----
> From: John Reid
>
> I like that idea copy-of. But have not yet got it to work
>
Hi,
I guess ultimately the most elegant way to deal with it would be to provide
a few basic templates like
<xsl:template match="rule">
<li class="strong"><xsl:value-of selecy="@type" /><br/>
<span class="goldmedium"><xsl:apply-templates select="node()" /></span>
</li>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
then, this
> <ul>
> <xsl:for-each select="rules/rule">
> <li class="strong"><xsl:value-of select="@type" /><br/>
> <span class="goldmedium"><xsl:value-of select="."
> /></span></li>
> </xsl:for-each>
> </ul>
>
becomes simply
<ul><xsl:apply-templates select="rules/rule" /></ul>
and, no matter what other nodes are nested in there somewhere, they will
always be copied along in the correct order.
Hope this helps!
Cheers,
Andreas
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|