This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Newbie question: copying almost all nodes in XSLT


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]