[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: condition problem

Subject: Re: condition problem
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Wed, 6 Oct 2004 08:05:34 -0700 (PDT)
xsl for each condition
Hi Dusan,
  This problem requires eliminating duplicates, and
can be solved using Muenchian technique -

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" />
	
<xsl:key name="by-ge" match="SI" use="concat(G,E)" />
	
<xsl:template match="/">
   <xsl:for-each select="//SI[generate-id(.) =
generate-id(key('by-ge', concat(G,E))[1])]">
     <xsl:value-of select="G" /><xsl:value-of
select="E" /><xsl:text>&#xA;</xsl:text>
   </xsl:for-each>
</xsl:template>
	
</xsl:stylesheet>

Regards,
Mukul

--- Dusan Zatkovsky <zatkovsky@xxxxxxxxxxxx> wrote:

> 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



		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.