·  XSLT – Elements – <xsl:for-each>

 

- Info :

  - Goes through all elements defined with select attribute.

 

- Example:

 

    test.xml

    <?xml version="1.0"?>

    <?xml-stylesheet type="text/xsl" href="test.xsl"?>

    

    <people>

    

      <students>

        <name>Jack</name>

        <name>Jill</name>

      </students>

    

    </people>

    

    test.xsl

    <?xml version="1.0" ?>

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

    

      <xsl:template match="students">

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

          <xsl:value-of select="."/> <br/>

        </xsl:for-each>

      </xsl:template>

      

    </xsl:stylesheet>

        

    result

    Jack
    Jill