xsl-list
[Top] [All Lists]

RE: Restructure via grouping

2005-02-09 06:40:55
This isn't grouping, it's ungrouping.

<xsl:template match="root">
<doc>
  <fragments>
    <xsl:copy-of select=".//fragment"> 
  </fragments>
</doc>
</xsl:template>

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Robert Soesemann [mailto:rsoesemann(_at_)sapient(_dot_)com] 
Sent: 09 February 2005 12:49
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Restructure via grouping

How can I do the following restructuring? Do I need to use grouping?

Inside and outside of my <doc> node there are <fragment> nodes. I want
to collect them all and place them insde a new <fragments> tag. 

So for this input:

<root>
      <doc>
              <fragment pos="1"/>
              <fragment pos="2"/>
              <fragment pos="3"/>
      </doc>
      <fragment pos="4"/>
      <fragment pos="5"/>
</root>

I would need the following output:
<root>
      <doc>
              <fragments>
                      <fragment pos="1"/>
                      <fragment pos="2"/>
                      <fragment pos="3"/>
                      <fragment pos="4"/>
                      <fragment pos="5"/>
              </fragments>            
      </doc>
</root>

I played around with generate-key() a little bit, but could 
not make it.
Can you help.

Thanks in advance.

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>