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]
Other format: [Raw text]

Re: Default rule for passing matched elements thru unchanged?


Brad,

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()"/>
   </xsl:copy>
</xsl:template>

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.

Cheers,
Wendell

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@mulberrytech.com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
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:  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]