Re: Newbie question: copying almost all nodes in XSLT

Subject: Re: Newbie question: copying almost all nodes in XSLT
From: "Nikolai Grigoriev" <grig@xxxxxxx>
Date: Sun, 12 Mar 2000 16:03:23 +0300
Niklas Agevik wrote:

> After the first transformation i want it to just replace the count element
> but keep the rest of the page intact so that the result is like this:
>
> <root>
>   <p id="1">
>     This page has been visited <xsp:expr>count</xsp:expr> times!
>   </p>
> </root>

Try to redefine the default rule to perform an identity transformation,
and then specify a specific rule with a higher priority to handle count
elements:

<!-- Default transformation - identity -->
<xsl:template match="*|@*|comment()|text()">
  <xsl:copy>
    <xsl:apply-templates select="*|@*|comment()|text()"/>
  </xsl:copy>
</xsl:template>

<!-- Count -->
<xsl:template match="count" priority="1">
  <xsp:expr>count</xsp:expr>
</xsl:template>

Regards,
Nikolai


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread