[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Grouping and conditional info questions


Subject: [xsl] Grouping and conditional info questions
From: Ying Qin <yqin@xxxxxxxxxx>
Date: Fri, 24 Aug 2001 16:15:19 -0700

Hi,

Given an XML feed as follows,

...
<item>
	<id>1</id>
	<name>aaa</name>
	...
</item>
<item>
	<id>2</id>
	<name>ccc</name>
	...
</item>
<item>
	<id>1</id>
	<name>bbb</name>
	...
</item>
<item>
	<id>2</id>
	<name>ddd</name>
	...
</item>

How can I group the item elements by their id?  Also, can I add a group
title for each group (not every item)?  Expected result is,

<group>
  <title>Group A</title>
  <item>
	<id>1</id>
	<name>aaa</name>
	...
  </item>
  <item>
	<id>1</id>
	<name>bbb</name>
	...
  </item>
</group>
<group>
  <title>Group B</title>
  <item>
	<id>2</id>
	<name>ccc</name>
	...
  </item>
  <item>
	<id>2</id>
	<name>ddd</name>
	...
  </item>
</group>

Thanks,
Ying.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml