[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: copy-of and apply-templates equivalence

Subject: Re: copy-of and apply-templates equivalence
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Sep 2020 19:01:32 -0000
Re:  copy-of and apply-templates equivalence
On Fri, Sep 18, 2020 at 06:54:32PM -0000, rick@xxxxxxxxxxxxxx scripsit:
> Providing I have an identity transform template, are these two basically
> equivalent?

Nope.

> <xsl:copy-of select="doc($file)/*/*" />

Creates a node that's a complete -- "deep" -- copy of the element node
returned by the XPath in the select.  Nothing else happens; no templates
will match on the contents of the elements returned by the XPath in the
select attribute.

> <xsl:apply-templates select="doc($file)/*/*"/>

Applies templates -- uses the template matching process to see if there
are any matching templates for -- the element nodes returned by the
XPath in the select attribute.  With an identity transform happening,
this will apply templates (in the default mode) to all the descendant
nodes of the element nodes returned by the XPath in the select.

If you want to match any of those descendant nodes with other templates,
you can do that with apply-templates and you can't do that with copy-of.

-- 
Graydon Saunders  | graydonish@xxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor  ("That passed, so may this.")

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.