[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] transformation does happen after copy-of?
Subject: Re: [xsl] transformation does happen after copy-of? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 23 Jul 2002 13:22:51 +0100 |
Hi Andrew, > DC wrote: >>no node() does match attribute nodes. > > This is interesting - can you show an example, because I from that > would read that I could drop the @* match like this: > > <xsl:template match="node()"> > <xsl:copy> > <xsl:apply-templates select="@*|node()"/> > </xsl:copy> > </xsl:template> > > Which you can't - what am I missing? David C.'s being a little pedantic (now there's a surprise) and saying that the *node test* "node()" matches attribute nodes. He's not saying that the *pattern* "node()" matches attribute nodes. The *pattern* "node()" as in: <xsl:template match="node()"> ... </xsl:template> is actually a shorthand for the pattern "child::node()", and matches any node that is a child of another node. Attributes aren't children of any other nodes, so they don't match this pattern. However, if you use the pattern "attribute::node()" (or @node()) then that will match any node that is an attribute of another node, and will therefore match attributes. This is because the node test "node()" matches all nodes, including attributes. The same goes for expressions: the expression "node()" is a shorthand for the expression "child::node()" and will select all child nodes of the context node. The expression "attribute::node()" or "@node()" will select all attributes of the context node; since only attributes are attributes of a node, it's equivalent to do "@*", which has the benefit of being shorter, so that's what we use most of the time. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] transformation does happe, Andrew Welch | Thread | Re: [xsl] transformation does happe, David Carlisle |
[xsl] RE: RE: Re: Query re XMLSpy X, Dimitre Novatchev | Date | RE: [xsl] transformation does happe, Michael Kay |
Month |