[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Fwd: Built-in *@ vs. node()
Hi Janning, > In my XML Book "In a nutshell" it says: > "node() matches all nodes regardless of type: attribute, > namespace..." It's true that the *node test* node() matches all nodes regardless of type. However, a node test never exists alone -- it's always used alongside an *axis*, for example: child::node() attribute::node() The pattern "node()" is a shorthand for: child::node() which matches all nodes *that are children of some other node*. Attributes are not children of any node, therefore this pattern doesn't match attributes. If you want to match attributes, you have to use the attribute axis, e.g.: attribute::node() or: attribute::* or their shorthands: @node() @* So the identity template is usually written: <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> i.e. match all nodes-that-are-children and all attributes, copy them, and go on to process their attributes or children, if they have any. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|