The main question is: is it even possible to achieve that using pure XSLT/XPath
Yes, it is possible. But the output you request is not valid XML: you must have a root element.
XSLT 1.0
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/somexml">
<output>
<xsl:apply-templates select="item[1]" />
<xsl:apply-templates select="item[position() > 1][position() mod 3 = 1]" />
</output>
</xsl:template>
<xsl:template match="item[1]">
<template1><xsl:value-of select="@name"/></template1>
</xsl:template>
<xsl:template match="item">
<template2>
<xsl:value-of select="@name"/>
<xsl:if test="following-sibling::item[1]">
<xsl:text>,</xsl:text>
<xsl:value-of select="following-sibling::item[1]/@name"/>
</xsl:if>
<xsl:if test="following-sibling::item[2]">
<xsl:text>,</xsl:text>
<xsl:value-of select="following-sibling::item[2]/@name"/>
</xsl:if>
</template2>
</xsl:template>
</xsl:stylesheet>
Note also that naming your result elements "template" is rather confusing in this context.