Subject: Re: [xsl] copy-of and apply-templates equivalence From: "rick@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 18 Sep 2020 19:08:50 -0000 |
Thank you. But if I have an identity transform template, then the results of both should be the same, correct? -----Original Message----- From: Graydon graydon@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Sent: Friday, September 18, 2020 3:02 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] copy-of and apply-templat, Graydon graydon@xxxx | Thread | Re: [xsl] copy-of and apply-templat, Graydon graydon@xxxx |
Re: [xsl] copy-of and apply-templat, Graydon graydon@xxxx | Date | Re: [xsl] copy-of and apply-templat, Graydon graydon@xxxx |
Month |