[xsl] Re: Reordering a complex hierarchical structure

Subject: [xsl] Re: Reordering a complex hierarchical structure
From: Ian Wootten <I.M.Wootten@xxxxxxxxxxxxxxxx>
Date: Thu, 31 Aug 2006 09:51:10 +0100
Ok, so I've managed to get as far as a structure as (I requested) and
you have detailed, but rather than a list such as:

<service>
  <name>somename</name>
  <id>1</id>
  <metric name="andanothermetric">value3</metric>
  <metric name="andanothermetric">value6</metric>
  <metric name="anothermetric">value2</metric>
  <metric name="anothermetric">value5</metric>
  <metric name="somemetric">value1</metric>
  <metric name="somemetric">value4</metric>
</service>

I'd prefer it if I could get it so similarly named metrics are grouped together, so:

<service>
	<name>somename</name>
	<id>1</id>
	<metric name="somemetric">
		<value>value1</value>
		<value>value4</value>
	</metric>
	<metric name="anothermetric">
		<value>value2</value>
		<value>value5</value>
	</metric>
	<metric name="andanothermetric">
		<value>value3</value>
		<value>value6</value>
	</metric>
</service>

Whats returned by the for each is every occurrence of metric, for a different service, as I understand. How can I group similarly named metrics together?

Cheers,

Ian

Current Thread