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

Subject: Re: [xsl] Default rule for passing matched elements thru unchanged?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 27 Feb 2002 11:56:37 -0500

To do this you want to adapt the identity stylesheet, which overrides XSLT's default templates with templates that copy the nodes, instead of just passing through them and copying their text content.

You can find the identity stylesheet in the XSLT spec (section 7.5) or in any number of places including the XSL FAQ, the list archives etc.

Heck, here it is:

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

Your templates for 'show' etc. will override this one, but anything that you haven't matched with your own template, will simply be copied through by this one. (For elucidation of any of its mysteries, do a search for "XSLT identity transformation".)

BTW, are you the Brad Cox who wrote that awesome book about the economics of distributed objects? Cool. I lent my copy to someone and never got it back.


At 11:56 PM 2/26/2002, you wrote:
I'm baffled by how to build an xslt stylesheet that recognizes specified elements while passing those not specified through unchanged. The application intends to add programming capabilities to ordinary xhtml documents; e.g. show, if, foreach, etc, where these might appear anywhere, such as within xhtml elements. I'd rather not enumerate every imaginable xhtml element name; I don't have the complete list.

Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

XSL-List info and archive:

Current Thread