xsl-list
[Top] [All Lists]

[xsl] Help with grouping elements

2009-01-13 18:47:07
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>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>