Love this site? Hate it? Leave us some comments.
*/

Other Views

corner
*/

How to Sort XML by Multiple Elements Using XSLT

How to sort XML by multiple elements using XSLT?

By adding more <xsl:sort> will sort the output by the first and then by the second element specified. Identical elements are sorted in the order they appear in an XML document.

<xsl:sort select="title" />
<xsl:sort select="publisher" />


Output:

Title
An Introduction to NURBS: With Historical Perspective
Curves and Surfaces for CAGD: A Practical Guide
NURBS: From Projective Geometry to Practical Use
OpenGL Programming Guide Fourth Edition


Publisher
Academic Press
Academic Press
A K Peters
Addison-Wesley

Back to XML FAQ
corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.
Resource Listings