<xsl:template match="udata" mode="book_list">
  <div class="portfolio-row rows_3">
    <b>Книги автора:</b>
  </div>
  <xsl:call-template name="for">
    <xsl:with-param name="n" select="60"/>
  </xsl:call-template>
</xsl:template>
<xsl:template name="for">
  <xsl:param name="i" select="0"/>
  <xsl:param name="n"/>
  <xsl:if test="$i &lt; $n">
    <div class="portfolio-row rows_3">
      <xsl:apply-templates select="page[position() = $i*3 + 1]" mode="book_list"/>
      <xsl:apply-templates select="page[position() = $i*3 + 2]" mode="book_list"/>
      <xsl:apply-templates select="page[position() = $i*3 + 3]" mode="book_list"/>
    </div>
    <xsl:call-template name="for">
      <xsl:with-param name="i" select="$i + 1"/>
      <xsl:with-param name="n" select="$n"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>