XSLT Sorting, XSLT Tutorial, Global Guideline

Forum | Blog


Basic XSLT Tutorial.     
 XSLT Introduction.          
 XSLT Templates.            
 XSLT Attributes.              
 XSLT Transformation.     
 XSLT Variables.              
 XSLT Formatting.            
 XSLT Loops.                   
 XSLT Sorting.
 XSLT Conditions.             
 XSLT Multi Selection.     
 XSLT Functions.              
 XSLT Copying.                
 XSLT Combining.           
 XSLT Summary.              

XSLT Tutorial >> XSLT Sorting.

     Back             Next     

XSLT' sorting are instruction lets you sort a group of similar elements.  Identified as <xsl:sort> and attributes for this element let you to add details about how you want the sort done, e.g. you can sort using alphabetic or numeric ordering, sort on multiple keys, and reverse the sort order with use of  <xsl:sort>.

Now this XSLT Tutorial secetion of XSLT Sorting will guide how you should know quite a lot about XSLT to transform XML files HTML documents for rendering in Internet Explorer 5. This XSLT Tutorial section will guide you to use the HTML table model. We are going to show you how to sort XML data elements before showing them on browser.

Example of XSLT Sorting

XML Code for XSLT Sorting Example [XSLT_Sorting_Example.xml]

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="xslt_Sorting_Example.xsl"?>
     <employee employee_id="ggl101">
     <employee employee_id="ggl121">
     <employee employee_id="ggl130">

XSLT for XSLT Sorting Example [xslt_Sorting_Example.xsl]

<xsl:stylesheet xmlns:xsl="https://www.w3.org/1999/XSL/Transform"

<xsl:output method="text"/>

<xsl:template match="globalGuideLine">
    <xsl:sort select="FirstName"/>

<xsl:template match="employee">
  Employee ID:  <xsl:apply-templates select="@employee_id"/>
  First Name:   <xsl:apply-templates select="FirstName"/>
  Last Name:    <xsl:apply-templates select="LastName"/>
  Gender:       <xsl:apply-templates select="gender"/>


Complete Example of XSLT Sorting

XSLT Tutorial sources and outputs of XSLT sorting view it by simply clicking on file name of XSLT, XML and Out Put of XSLT Sorting Example

     Back             Next     

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright 2005 -  2021 www.globalguideline.com All rights reserved. (Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher) 586 visitors are online now