XSL sorting method for output elements

Source: Internet
Author: User
Tags xsl
There are two methods:

1. use the order-by attribute
ie5 & IE6 are applicable: You can use XSL: For-each and XSL: the Order-by attribute of the apply-templates elements controls the processing sequence of the elements processed by the XSL processor. XSL: for-each select =" // book " order-by =" + name " >
XSL: For-each >
XSL: For-each select =" // book " order-by =" + name;-author>

Where, the + element is in ascending order, and the-element is in descending order. If you want to arrange multiple elements in sequence, use the; number in the middle.

2. Use the XSL: Sort Element
Internet Explorer 6 is more powerful than Internet Explorer 6. XSL: Sort also needs to be used with the XSL: For-each and XSL: Apply-templates elements, but it is no longer used as the attributes of these two elements, it appears as a child element of the two elements.

It has several important attributes:
Data-type: If the value is number, the data is sorted by number format. If the value is text, the data is sorted by text format.
Case-order: indicates whether the upper case or lower case is in front of the upper case. It can be set to upper-first or lower-first.
Lang: it can be set to a nmtoken value to indicate sorting by this language.
Order: it can be set to ascending or descending, indicating to sort in ascending or descending order.

< XSL: For-each Select = "// Book" >
< XSL: Sort Select = "Name" Data-type = "Text" />

</ XSL: For-each >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.