[xsl] Help with grouping elements

Subject: [xsl] Help with grouping elements
From: Gustavo Luiz Duarte <gustavold@xxxxxxxxx>
Date: Tue, 13 Jan 2009 21:46:39 -0200
Hi,

I have an input xml like:
<root>
  <a-1></a-1>
  ...
  <a-n></a-n>
  <b-1></b-1>
  ...
  <b-1></b-n>
</root>

I'd like to put the tags a-* into a new element <a></a>. How can I do it?
These tagnames are fictitious, I cannot use regexp to address them,
but there are few elements in the b-* group.

I'm using libxslt on linux. XLST version 1.0, but could use 2.0.

I tried the below with the identity transform, but didn't work.

     <xsl:template match="root">
                <xsl:element name="root">
                        <xsl:apply-templates select="b-1" />
                          ...
                        <xsl:apply-templates select="b-n" />

                        <a>
                                <xsl:apply-templates />
                        </a>
                </xsl:element>
        </xsl:template>

Current Thread