Subject: Re: [xsl] Identity Transform From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx> Date: Mon, 7 Nov 2005 17:05:01 +0530 |
Both form 1 and form 2 are semantically same. | is the union operator. If A and B are two nodesets, then A | B and B | A should mean same.. Regards, Mukul On 11/7/05, Christian Roth <roth@xxxxxxxxxxxxxx> wrote: > Hi, > > this is a question for my own understanding. > > Browsing through posts on this list, I can find two forms of what's > called "identity transform": > > ** Form 1 ** > > <xsl:template match="@*|node()"> > <xsl:copy> > <xsl:apply-templates select="@*|node()"/> > </xsl:copy> > </xsl:template> > > > ** Form 2 ** > > <xsl:template match="@*|node()"> > <xsl:copy> > <xsl:apply-templates select="node()|@*"/> > </xsl:copy> > </xsl:template> > > (The difference is in the apply-templates' 'select' attribute.) > > Both seem to work when testing locally, both with Xalan and Saxon, > seemingly no warnings, omissions or errors. > > However, XSLT specifies that first, one has to add attributes to a node > before appending any children. Doesn't Form 2 first append child nodes > and then attributes, which should either result in an error or silently > discard the attributes? > > Has this something to do with document traversal order, i.e. while > building the list of selected items using "node()|@*", the attribute > nodes (satisfying the expression) are found first and are therefore > added first to the list of items to be copied, in consequence satisfying > the "attribute-before-children" requirement? > > Regards, Christian.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Identity Transform, Christian Roth | Thread | Re: [xsl] Identity Transform, David Carlisle |
[xsl] Identity Transform, Christian Roth | Date | Re: [xsl] Identity Transform, David Carlisle |
Month |