Когда нужно сгруппировать несколько элементов в отдельный тэг, элементы lines/item (catalog)

<xsl:template match="udata[@module = 'catalog'][@method = 'getObjectsList']">
<div>
<xsl:apply-templates select="lines/item[position() = 1]|lines/item[position() mod 3 = 1]"/>
</div>
</xsl:template>
<xsl:template match="udata[@module = 'catalog'  and  @method = 'getObjectsList']//item">
<div class="row">
<xsl:apply-templates select=".|following-sibling::item[position() &lt; 3]" mode="str"/>
</div>
</xsl:template>
<xsl:template match="item" mode="str">
<a href="{@link}"><xsl:value-of select="document(concat('upage://', @id))//property[@name = 'h1']/value" disable-output-escaping="yes" /></a>
</xsl:template>

В случае items/item (menu)

<xsl:template match="udata[@module = 'content'][@method = 'menu']" mode="quad-menu" >
 <div>
<xsl:apply-templates select="items/item[position() = 1]|items/item[position() mod 3 = 1]" mode="quad-menu"/>
</div>
</xsl:template>
<xsl:template match="udata[@module = 'content' and @method = 'menu']//item" mode="quad-menu" >
<div class="row">
<xsl:apply-templates select=".|following-sibling::item[position() &lt; 3]" mode="str"/>
</div>
</xsl:template>
<xsl:template match="item" mode="str">
<a href="{@link}"><xsl:value-of select="document(concat('upage://', @id))//property[@name = 'h1']/value" disable-output-escaping="yes" /></a>
</xsl:template>

В результате получим

<div>
<div class="row">
<a href="http://">item1</a>
<a href="http://">item2</a>
<a href="http://">item3</a>
</div>
<div class="row">
<a href="http://">item4</a>
</div>
</div>