Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT

Status
Not open for further replies.

JontyMC

Programmer
Nov 26, 2001
1,276
GB
whats the difference between using:

Code:
<xsl:template match="/">
  <xsl:apply-templates select="//Test" />
</xsl:template>

<xsl:template match="Test">
  <p><xsl:value-of select="." /></p>
</xsl:template>

and

Code:
<xsl:template match="/">
  <xsl:for-each select="//Test">
    <p><xsl:value-of select="." /></p>
  </xsl:for-each>
</xsl:template>

?

Whats the point in the <xsl:for-each> tag? It seems like its not needed.
 
In general, you can use them for different purposes:
<xsl:for-each select="Test"> is used to parse only the descendant nodes of your context, <xsl:template match="Test"> is used to parse any <Test>-node the same way.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top