View Full Version : SharePoint XSL - counting rows vs position()

06-10-2009, 03:53 PM

I'm having a problem applying a style to a sharepoint ItemStyle.xsl template. I want to apply a style to a list (limited to showing the top 3 items) but then once the 3rd item is displayed, I want to have a "view all" link to the document library.

The current template I'm working with looks a bit like this, but you'll see once I try to declare <xsl:value-of select="position()" /> it outputs "1" every time. Because the template works on @row - each item is number 1!

How do I break out of this and select the true position in the web part?

Thanks for any help :)

<xsl:template name="EMEAFiles" match="Row[@Style='EMEAFiles']" mode="itemstyle">
<div style="margin:10px 10px 0px 10px; height:57px">
<a href="{$SafeLinkUrl}" ><img src="../PublishingImages/icon_{$IconType}.jpg" alt="" height="57px" width="57px" style="float:left; border:0" /></a>
<a href="{$SafeLinkUrl}" ><h1><xsl:value-of select="@Title" /></h1></a>
<xsl:if test="string-length(@Description0) != 0">
<p><xsl:value-of select="@Description0" /></p>
<p>[.<xsl:value-of select="$IconType" />, <xsl:value-of select="$EMEAFileSize" />]</p>
<xsl:value-of select="position()" />