Given a source doc like so:
<A>
<B>
<C>item1</C>
</B>
<B>
<C>item2</C>
</B>
<B>
<C>item3</C>
</B>
</A>
What XSLT can I use to product something like this:
<A>
<B>
<C>item1</C>
<C>item2</C>
<C>item3</C>
</B>
</A>
I have tried a sheet with...
<xsl:template match="B">
<xsl:choose>
<xsl:when test="count(preceding-sibling::B)=0">
<B>
<xsl:apply-templates select="./C"/>
<xsl:apply-templates select="following-sibling::B"/>
</B>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="./C"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
but I am getting...
<A>
<B>
<C>item1</C>
<C>item2</C>
<C>item3</C>
</B>
<C>item2</C>
<C>item3</C>
</A>
A second question: I have a hard time debugging XSLT. hints?