[XSL-LIST Mailing List Archive Home]
RE: [xsl] Pattern Question
Subject: RE: [xsl] Pattern Question|
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 28 Mar 2003 15:07:39 -0000
> This should be a relatively easy question but I just want to
> confirm what I
> am thinking. What is the difference in the following patterns? Is my
> assessment of the first two correct?
> 1. <xsl:template match="/"> =Matches Root Element
No, it matches the root node. The root node is not an element.
> 2. <xsl:template match="*|@"> =Matches all element nodes or
Almost, but you meant match="*|@*"
> 3. <xsl:template match="@*|node()"> = Not exactly sure how
> this pattern
> behaves. Appears to match all nodes or child nodes?
It matches all nodes except root nodes and namespace nodes. The @*
matches attributes; the node() (which is short for child::node())
matches nodes that are children of something, which embraces all
elements, text nodes, comments, and processing-instructions.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list