Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a custom list and i would like to have a row number. I did use the <xsl:number/>and that worked but when i click on the next page of the list the number resets itself back to 1 again. Is there a way to have the row number continue when paging. Thanks in advance

share|improve this question

2 Answers 2

If the xml you are transforming only contains the data to be displayed on a single page, rather than the complete set, then the XSL has no way of knowing the row number in the context of the complete set. You then become responsible for calculating it.

You probably know the page size and page index as you are managing the paging. You could pass these values into the transformation as arguments.

dataset row index = (page size * page index) + page row index
share|improve this answer
    
thanks guys.I would have to come with a xsl to do that then was wandering if anyone dome similar before –  naijacoder Aug 28 '12 at 8:05

Why not try the position() function (if you look within the XSLT generated for a DataView or XSLTView you would still find it there) as it is already used for the FirstRow/LastRow combinations, as well as Conditional Formatting routines, e.g.

<xsl:if test="position() mod 2 = 1">

        <xsl:attribute>ms-alternating</xsl:attribute>

      </xsl:if>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.