How can be use xsl:for-each element in XSLT

This article represent xsl:for-each element
  • 1612
The  xsl:for-each element creates a loop which repeats for every match 'select' designates the match criteria. It is used to iterate through a set of nodes or to change the current node. It is supported to IE 5.0 and FF 1.0.

Syntax of  xsl:for-each element

<xsl:for-each select="EXPRESSION">

    <!--TEMPLATE-->

</xsl:for-each>

 
It has only one attribute-
  • select

    The select attribute uses an XPath expression to select nodes to be processed.
Example of xsl:for-each element

<?xml version="1.0" encoding="ISO-888-1"?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.google.com/XSL/Transform">

    <xsl:template match="/">

        <div>

            <xsl:for-each select="Productes/Pro">

                <p>

                    <xsl:value-of select="title" />              

        </p>

      </xsl:for-each>

    </div>

  </xsl:template>

</xsl:stylesheet>


Further Readings

You may also want to read these related articles :

Ask Your Question 
 
Got a programming related question? You may want to post your question here

Programming Answers here

© 2019 DotNetHeaven. All rights reserved.