Global GuideLine Home HTML Tutorial JavaScript Tutorial SQL Tutorial CSS Tutorial SEO Tutorial XML Tutorial XSLT Tutorial Articles Tutorial Interview Questions and Answers Guide Jobs GuideLine Bookmark With Google Bookmark With Yahoo Bookmark With FaceBook Bookmark With Live Follow @GlobalGuideLine on Twitter Bookmark Global GuideLine
XSLT Sorting, XSLT Tutorial, Global Guideline

Bookmark Bookmark: XSLT Sorting, XSLT Tutorial
Global Guideline is UNITED STATES's favorite website


      Home                    

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"?>
  <globalGuideLine>
     <employee employee_id="ggl101">
       <FirstName>Jamima</FirstName>
       <LastName>Elisibith</LastName>
       <gender>Female</gender>
     </employee>
     <employee employee_id="ggl121">
       <FirstName>Alfa</FirstName>
       <LastName>Cute</LastName>
       <gender>Male</gender>
     </employee>
     <employee employee_id="ggl130">
       <FirstName>Kethrin</FirstName>
       <LastName>Bruster</LastName>
       <gender>Female</gender>
     </employee>
  </globalGuideLine>

XSLT for XSLT Sorting Example [xslt_Sorting_Example.xsl]

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="text"/>

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

<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"/>
  <xsl:text>
  </xsl:text>
</xsl:template>

</xsl:stylesheet>


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     
 
In order to link this page as Reference, click on below text area and pres (CTRL-C) to copy the code in clipboard or pres right click then copy the following lines after that past into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code:

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

Copyright © 2005-2006 www.globalguideline.com All rights reserved. 508 visitors are online now