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

Re: transformation does happen after copy-of?

Subject: Re: transformation does happen after copy-of?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 23 Jul 2002 13:22:51 +0100
geza soos
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

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.