Re: [xsl] Default rule for passing matched elements thru unchanged?

Subject: Re: [xsl] Default rule for passing matched elements thru unchanged?
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 26 Feb 2002 22:57:44 -0700 (MST)
Brad Cox wrote:
> I'm baffled by how to build an xslt stylesheet that recognizes 
> specified elements while passing those not specified through 
> unchanged.

All you need to do is learn to use xsl:copy.

The identity transformation (a recursive copy of the source tree to the result
tree) is in the XSLT spec itself. Section 7.5, "Copying"

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

Add to this your templates to do special things with your special nodes, and
make sure they end with an xsl:apply-templates so that the children get
processed.

   - Mike
____________________________________________________________________________
  mike j. brown, fourthought.com  |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/

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


Current Thread