Old Site

This site is archived. I now update and maintain my blog here.

Updated: The Umbraco XSLT for loop

Thanks to Chriztian Steinmeier aka @greystate I'm happy to post an update to yesterdays XSLT hack blog post that allows you to do paging in Umbraco without recusrsive templates.

This is a pure XSLT solution.

Oh and by the way - yesterdays blog was a bit of fun and a joke. So please, no more snide emails OK?

<xsl:for-each select="$childNodes[position() &lt;= $numberOfPages]">
        <a href="{pageUrl}?page={position()}">
          <xsl:value-of select="position()"/>

      <xsl:for-each select="$childNodes[position() &gt;= $startIndex and position() &lt;= $endIndex]">
        <xsl:variable name="counter" select="position() + (($pageNumber -1) * $itemsPerPage)"/>
        <xsl:variable name="node" select="$childNodes[$counter]"/>
          <xsl:value-of select="$counter"/>.
          <a href="{umbraco.library:NiceUrl($node/@id)}">
            <xsl:value-of select="$node/@nodeName"/>
Leave a comment