xsl-list
[Top] [All Lists]

RE: Pattern Question

2003-03-28 08:07:39

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 
attributes.

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.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>