View Single Post
  #4 (permalink)  
Old May 14th, 2007, 10:54 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The line

<xsl:apply-templates select="@*"/>

applies template rules to all the attribute nodes. It's unusual to use apply-templates for attribute nodes, but it's perfectly legal, and it's useful when you want to apply generic processing. This will be matched by the second template rule with match="@*".

The other <xsl:apply-templates/> processes all child nodes (which doesn't include attributes). These will be matched by the first template rule (recursively) for elements, and by the built-in template rules for text, comment, and PI nodes. (Actually this stylesheet will delete comments and PIs, if you don't want that, add template rules to match them and copy them).

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote