<items>
<item id="1" src="/1.jpg" />
<item id="2" src="/2.jpg" />
<item id="3" src="/3.jpg" />
<item id="4" src="/4.jpg" />
<item id="5" src="/5.jpg" />
</items>
...
<ul>
<xsl:apply-templates select="items/item" />
</ul>
...
<xsl:template match="item">
<li>
<img src="@src" />
</li>
</xsl:template>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/items">
<ul>
<xsl:apply-templates select="item[position() mod 2 = 1]" />
</ul>
</xsl:template>
<xsl:template match="item">
<li>
<img src="{@src}"/>
<img src="{following::item/@src}"/>
</li>
</xsl:template>
</xsl:stylesheet>
<ul>
<li>
<img src="/1.jpg"/>
<img src="/2.jpg"/>
</li>
<li>
<img src="/3.jpg"/>
<img src="/4.jpg"/>
</li>
<li>
<img src="/5.jpg"/>
<img src=""/>
</li>
</ul>