RE: [xsl] condition problem

Subject: RE: [xsl] condition problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 6 Oct 2004 16:02:41 +0100
You need to eliminate duplicates; eliminating duplicates is just a special
case of a grouping problem, so you need to use the grouping techniques
eloquently described at http://www.jenitennison.com/xslt/grouping

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

> -----Original Message-----
> From: Dusan Zatkovsky [mailto:zatkovsky@xxxxxxxxxxxx] 
> Sent: 06 October 2004 15:03
> To: xslt mailinglist
> Subject: [xsl] condition problem
> 
> Hi.
> 
> I have this document:
> 
> <data>
> 	<A>
> 		<SI>
> 			<G>1</G>
> 			<E>1</E>
> 			<value>123</value>
> 		</SI>
> 		<SI>
> 			<G>1</G>
> 			<E>2</E>
> 			<value>456</value>
> 		</SI>
> 		<SI>
> 			<G>2</G>
> 			<E>2</E>
> 			<value>678</value>
> 		</SI>
> 	</A>
> 
> 	<B>
> 		<SI>
> 			<G>2</G>
> 			<E>1</E>
> 			<value>123</value>
> 		</SI>
> 		<SI>
> 			<G>1</G>
> 			<E>2</E>
> 			<value>123</value>
> 		</SI>
> 
> 	</B>
> </data>
> 
> 
> I want to create for-each cycle, merging SIs from A and B.
> 
> When I have test for-each select="data/A/SI | data/B/SI", result is 
> (G/E):
> 1 1
> 1 2
> 2 2
> 2 1
> 1 2
> and 1 2 are twice.
> 
> How to create cycle, which result will be:
> 1 1
> 1 2
> 2 2
> 2 1
> 
> I have tried condition (data/A/SI/G=data/B/SI/G and 
> data/A/SI/E=data/B/SI/E), but it returns true, because B/SI/G=1 was 
> found in A/SI[1], A/SI[2] and B/SI/E=2 was found in A/SI[2] and 
> A/SI[3].
> 
> I want to compare exactly G+E in one SI, not over all.
> 
> Thank you.
> 
> 
> -- 
> 
> Dusan Zatkovsky

Current Thread