Javatpoint Logo
Javatpoint Logo

XSLT <xsl:sort> Element

The XSLT <xsl:sort> element is used to specify a sort criteria on the nodes. It displays the output in sorted form.

The <xml:sort> element is added inside the <xsl:for-each> element in the XSL file, to sort the output.


Parameter explanation

Index Name Description
1) select It is used for sorting key of the node.
2) lang It specifies language alphabet used to determine sort order.
3) data-type It specifies data-type of the text.
4) order It is used to specify the sorting order. By default sorting order is ascending order.
5) case-order It is used to specify sorting order of string by capitalization. Default is "upper-first".

XSLT <xsl:sort> Element Example

Let's take an example to create a table of <employee> element with its attribute "id" and its child <firstname> , <lastname> , <nickname> , and <salary> by iterating over each student sort them by last name.

Employee.xml

Employee.xsl

Output:

XSLT Xsl Sort element 1

Note: The above table is sorted by Last Name.

Next TopicXSLT <if>





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA