|
Home >Online Product Documentation >Table of Contents >Specifying XSLT Patterns and Expressions Specifying XSLT Patterns and ExpressionsIn a stylesheet's xsl:template, xsl:apply-templates, xsl:for-each, and xsl:value-of instructions, you specify patterns or expressions as the values for the match or select attributes. These patterns are XPath expressions. You specify patterns or expressions to
l Define which nodes a template rule matches.
l Select lists of source nodes to process.
l Extract source node contents to generate result nodes.
Depending on the context, an XSLT pattern or expression can mean one of the following:
l Does this template match the current node?
l Given the current node, select all matching source nodes.
l Given the current node, select the first matching source node.
l Given the current node, do any source nodes match?
Patterns or expressions can match or select any type of node. The XSLT processor can match a pattern to a node based on the existence of the node, the name of the node, or the value of the node. You can combine patterns and expressions with Boolean operators. For detailed information about patterns and expressions, see Writing XPath Expressions. Examples of Patterns and ExpressionsFollowing are examples of patterns and expressions you can specify in stylesheet instructions:
Matches any price element that is a child of a book element.
Matches any award element that is a descendant of a book element.
Matches any book element that has a child that is a price element.
Matches any book element that has a price attribute.
Matches any book element that has a child that is a price element whose value is 14.
Matches any book element that has a price attribute whose value is 14.
Selects all book elements that are children of the current element.
Selects all price elements that are children of book elements that are children of the current element.
Selects all book elements in the source document.
Selects all book elements that are descendants of the current element.
|