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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a variable in xsl 1

Status
Not open for further replies.

yahoo182

Programmer
Jul 5, 2005
70
CA
Hi there,
I am trying to loop through my xml file and create a variable "count"
The code I have is
Code:
<xsl:for-each select="hotel/images/image">
<a href="javascript:void(0);" onClick="slideshow('slideshow.php?id=4110&count=count')" target="_blank">
<img src="{ThumbnailURL}" border="0"/>
</a>
</xsl:for-each>

and basically what I need to do is to assign count to an incrementing number from 0 to whaever the loop ends at.

Any help is much appriciated.

Thanks,

 
Whilst you could do this, it would probably be easier to use the position of each image in the node-set:
Code:
<xsl:for-each select="hotel/images/image">
<a href="javascript:void(0);" onClick="slideshow('slideshow.php?id=4110&count={position()}')" target="_blank">
<img src="{ThumbnailURL}" border="0"/>
</a>
</xsl:for-each>

Jon

"Asteroids do not concern me, Admiral. I want that ship, not excuses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top