Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XSLT Examples

XSLT Examples


xsl:template Element

A template containing the rules to apply when a specified node is matched

Example Explanation


xsl:value-of Element

Extract the value of a selected node

Example Explanation


xsl:for-each Element

Pass xsl:for-each The element selects each XML element in a specified node-set

Filter the output result of a node-set

Example Explanation


xsl:sort Element

Sort the output result of a node-set

Example Explanation


xsl:if Element

Place conditional tests on the content of an XML file

Example Explanation


xsl:choose Element

Example 1
This example adds a pink background color to the "Artist" column when the price of a CD is greater than 10

Example 2
This example adds a pink background color to the "Artist" column when the price of a CD is greater than 10, and a gray background color to the "Artist" column when the price of a CD is greater than 9 and less than or equal to 10

Example Explanation


xsl:apply-templates Element

Apply a template to an element

Example Explanation