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 Conditions, XSLT Tutorial, Global Guideline

Bookmark Bookmark: XSLT Conditions, 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 Conditions.


     Back             Next     



XSLT Conditions provide us to control our work flow.  Suppose in an organization number of employees are working and every one knows each other by face or name either employee is he or she.  It mean to say that somebody we have to call as Mr. or Miss in case of gender. Every programming language have functionality to control flow with if else statement;  So here in XSLT we also have a structure to follow for the defining the Conditions in XSLT.

Here we can get into with real example.

Example of XSLT Conditions

XML Code for XSLT Conditions Example [XSLT_Conditions_Example.xml]

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="xslt_Sorting_Example.xsl"?>
  <globalGuideLine>
     <employee>
       <FirstName>Jamima</FirstName>
       <LastName>Elisibith</LastName>
       <gender>f</gender>
     </employee>
     <employee>
       <FirstName>Alfa</FirstName>
       <LastName>Cute</LastName>
       <gender>m</gender>
     </employee>
     <employee>
       <FirstName>Kethrin</FirstName>
       <LastName>Bruster</LastName>
       <gender>f</gender>
     </employee>
  </globalGuideLine>

XSLT for XSLT Conditions Example [xslt_Conditions_Example.xsl]

<?xml version="1.0" encoding="ISO-8859-1"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns="http://www.w3.org/1999/xhtml">
  <body style="font-family:Arial,helvetica,sans-serif;font-size:12pt;
        background-color:#EEEEEE">
    <xsl:for-each select="globalGuideLine/employee">
    <xsl:sort select="FirstName"/>
      <div style="background-color: #cccccc;color:000000;padding:0px">
        <span style="font-weight:bold;color:#000000">
        <xsl:value-of select="FirstName"/> <xsl:value-of select="LastName"/></span>
      </div>

      <div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
        <span style="font-style:none">
	   <xsl:if test="gender='m'">
		<font color="red"><b>Mr. </b></font> 
                <xsl:value-of select="FirstName"/> 
                is working at Global Guide Line
	   </xsl:if>
	   <xsl:if test="gender='f'">
		<font color="red"><b>Miss </b></font>
                <xsl:value-of select="FirstName"/> 
                is working at Global Guide Line		
	   </xsl:if>
        </span>
      </div>
    </xsl:for-each>
  </body>

</html>

Complete Example of XSLT Conditions

XSLT Tutorial sources of XSLT Condition, view it by simply clicking on file name of XSLT, XML and Out Put of XSLT Conditions 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. 507 visitors are online now