XPath filter patterns can simplify default attributes. Instead of using some sort of pattern, an XPath pattern can match elements with a specific attribute. In the CSS class attribute example, the stylesheet can have separate templates for an example with a class attribute and one without it. An XPath filter looks like []. The test expression is evaluated with as the context node. The following example uses [] to match only examples with class attributes. The test expression can be any XPath expression. If it's a node expression like @class, the filter will match if it can select any matching node. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="example"> <table class="example"> <tr> <td> <xsl:apply-templates/> </td> </tr> </table> </xsl:template> <xsl:template match="example[@class]"> <table class="{@class}"> <tr> <td> <xsl:apply-templates/> </td> </tr> </table> </xsl:template> </xsl:stylesheet> In the example stylesheet, an <example> tag will match the second template if it has a class attribute. It will match the first template if it has no class attribute. The example XTP does not specify class, so the stylesheet will use "example" as the default class. <example> This is an example. </example> <table class="example"> <tr> <td>This is an example</td> </tr> </table> [] is an XPath filter pattern. Filter patterns match both the path and the filter expression. If the filter is a selection path, it matches if it selects any node.