XSLT xsl:apply-templates Element
Complete XSLT Element Reference Manual
Definition and Usage
xsl:apply-templates element applies templates to the current element or to its child nodes.
If we add a select attribute to the xsl:apply-templates element, it will only process child elements that match the value of that attribute. We can use the select attribute to specify the order in which child nodes are processed.
Syntax
property
| property | Value | Description |
|---|---|---|
| select | expression | Optional. Specifies the nodes to process. An asterisk selects the entire node set. If this attribute is omitted, all child nodes of the current node are selected. |
| mode | name | Optional. If multiple processing methods are defined for the same element, mode can be used to distinguish them. |
Example 1
Surround every title element in the document with an h1 element:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Example 2
Surround all title elements that are children of message in the document with h1 elements:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Example 3
Surround all child nodes of message whose mode attribute is set to "big" in the document with h1 elements:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Complete XSLT Element Reference Manual