XSLT Loop, XSLT Tutorial, Global Guideline

Bookmark Bookmark: XSLT Loop, XSLT Tutorial
Forum | Blog


      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 Loop.


     Back             Next     



XSLT is a declarative language it doesn't allow updating variables. For this reason there are no constructs to create iterative loops, which are well-known from vital programming languages such as C++ or Java. Even <xsl:for-each> is not really a loop construct in XSLT. To solve iterative problems you have to transform them into recursive problems - no problem if you're familiar with that hum.

Example of XSLT Loops

XML Code for XSLT Loops Example [XSLT_Loops_Example.xml]

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="xslt_For_Each_Loop.xsl"?>
  <globalGuideLine>
     <employee>
       <FirstName>Angela</FirstName>
       <LastName>Julie</LastName>
     </employee>
     <employee>
       <FirstName>Alfa</FirstName>
       <LastName>Cute</LastName>
     </employee>
  </globalGuideLine>

XSLT for XSLT For Each Loop Example [XSLT_For_Each_Loop.xsl]

<?xml version="1.0" encoding="ISO-8859-1"?>
<html xsl:version="1.0" xmlns:xsl="https://www.w3.org/1999/XSL/Transform" 
  xmlns="https://www.w3.org/1999/xhtml">
  <head>
    <title>XSLT Loops at Global Guide Line XSLT Tutorial</title>
  </head>
<body>
  <xsl:for-each select="globalGuideLine/employee">
    <b><xsl:value-of select="FirstName"/> 
    <xsl:value-of select="LastName"/></b> is working at Global Guide Line<br/>
  </xsl:for-each>
</body>
</html>

Complete Sources for Example of XSLT For Each Loop

XSLT Tutorial section of sources and outputs for XSLT loops view it by simply clicking on file name of XSLT, XML and Out Put of XSLT For Each Loop
 

     Back             Next     
 

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

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