There is a simple and very powerful solution using keys.
This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:key name="kFollowing" match="*[not(self::A)]"
use="generate-id(preceding-sibling::A[1])"/>
<xsl:template match="/*">
<t>
<xsl:apply-templates select="A"/>
</t>
</xsl:template>
<xsl:template match="A">
<A>
<xsl:copy-of select=
"key('kFollowing',generate-id())"/>
</A>
</xsl:template>
</xsl:stylesheet>
when applied on the original XML document:
<t>
<A/>
<ab/>
<ac/>
<A/>
<ab/>
<ac/>
</t>
produces the wanted result:
<t>
<A>
<ab/>
<ac/>
</A>
<A>
<ab/>
<ac/>
</A>
</t>
Do note how the definition of the <xsl:key>, combined with the use of the key() function makes most easy and natural collecting all sibling elements between two neighboring <A/> elements.