This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Grouping by element


Hi there,

I trying to group nodes depending on any of the values it contains. These
values are elements, I supppose it would be easier using attributes, but I
haven't it very clear. Could anybody help me?

Thank you.

I have a XML similar to this:
<Projects>
	<Project>
		<language>1</language>
		<name>a</name>
	</Project>
	<Project>
		<language>2</language>
		<name>b</name>
	</Project>
	<Project>
		<language>3</language>
		<name>c</name>
	</Project>
	<Project>
		<language>1</language>
		<name>d</name>
	</Project>
	<Project>
		<language>2</language>
		<name>e</name>
	</Project>
	<Project>
		<language>1</language>
		<name>f</name>
	</Project>
	<Project>
		<language>3</language>
		<name>g</name>
	</Project>
</Projects>

I would like to group this info based in <language> in two formats:

1.- to know all the projects for each language:
<Projects>
	<language id=1>
		<Project>
			<name>a</name>
		</Project>
		<Project>
			<name>d</name>
		</Project>
		<Project>
			<name>f</name>
		</Project>
	</language>
	<language id=2>
		<Project>
			<name>b</name>
		</Project>
		<Project>
			<name>e</name>
		</Project>
	</language>
	<language id=3>
		<Project>
			<name>c</name>
		</Project>
		<Project>
			<name>g</name>
		</Project>
	</language>
</Projects>

2.- to know all the languages within any project:
<Projects>
	<language>1</language>
	<language>2</language>
	<language>3</language>
</Projects>

Thanks in advance,
	DavidD

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]