This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Grouping using a Child Node....
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Sat, 22 Jun 2002 09:44:17 +0100
- Subject: RE: [xsl] Grouping using a Child Node....
- Reply-to: xsl-list at lists dot mulberrytech dot com
This is a standard grouping problem and you can use either of the
standard grouping techniques (preceding-sibling or Muenchian grouping).
<xsl:for-each select="item[not(type=preceding-sibling::type)]">
<p><xsl:value-of select="type"/></p>
<xsl:for-each select="../item[type=current()/type]">
...
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of
> Prince Ohilip
> Sent: 22 June 2002 07:04
> To: XSL-List@lists.mulberrytech.com
> Subject: [xsl] Grouping using a Child Node....
>
>
> Hi,
> I have a Requirement in which i have to do grouping of Parent
> Nodes based on a child node value
>
> For Eg:
> If i have an XML like
> <items>
> <item>
> <type>A</type>
> <name>one</name>
> <value>100</value>
> </item>
> <item>
> <type>A</type>
> <name>three</name>
> <value>300</value>
> </item>
>
> <item>
> <type>B</type>
> <name>four</name>
> <value>100</value>
> </item>
>
> <item>
> <type>B</type>
> <name>five</name>
> <value>300</value>
> </item>
> <item>
> <type>A</type>
> <name>six</name>
> <value>100</value>
> </item>
> </items>
>
> I want to create a XSL for Generating an HTML Table grouped by
> Type
>
> Table will be like
>
> ItemName Value
> Type -A
> one 100
> Three 300
> Six 100
>
> Type - B
> four 100
> five 300
>
>
> Thanks
>
> _________________________________________________________
> There is always a better job for you at Monsterindia.com.
> Go now http://monsterindia.com/rediffin/
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list