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

Suppressing multiple outcome

Subject: Suppressing multiple outcome
From: "Andreas Putscher" <AndreasPutscher@xxxxxx>
Date: Thu, 23 Nov 2006 15:17:11 +0100
parvw
Hello,

I am facing the following problem


I have an invoice:

<?xml version="1.0"?>
<INVOICE>
<ORDERHEADER>
</ORDERHEADER>
<ORDERPOSITIONS>
<ITEM>
	<MATNR>123</MATNR>
	<DETAIL>
		<PARVW>WE</PARVW> 
		<STREET>oxford street</STREET> 
	</DETAIL>
	<DETAIL>
		<PARVW>Z5</PARVW> 
		<STREET>another street</STREET> 
	</DETAIL>
</ITEM>
<ITEM>
	<MATNR>456</MATNR>
	<DETAIL>
		<PARVW>WE</PARVW> 
		<STREET>oxford street</STREET> 
	</DETAIL>
	<DETAIL>
		<PARVW>Z5</PARVW> 
		<STREET>another street</STREET> 
	</DETAIL>
</ITEM>
</ORDERPOSITIONS>
</INVOICE>


-> The invoice has 2 positions <ITEM>. Each position has a <DETAIL>-Tag, which has the same contents FOR ALL items.
What i would like to do is to get the content of Tag <STREET>, if the <PARVW>-Tag contains "WE" -> in this case this ist the value "oxford street".

in the destinaion xml, "oxford street" sould be in the header segment.
The destination XML should look like:

<?xml version="1.0"?>
<INVOICE>
<ORDERHEADER>
<STREET>oxford street</STREET>
</ORDERHEADER>
<ORDERPOSITIONS>
<ITEM>
	<MATNR>123</MATNR>
</ITEM>
<ITEM>
	<MATNR>456</MATNR>
</ITEM>
</ORDERPOSITIONS>
</INVOICE>


I habe generated the following code with Altova MapForce:

<ORDERHEADER>
<xsl:for-each select="ITEM/DETAIL">
		<xsl:variable name="myVar" select="."/>
		<xsl:for-each select="$myVar/PARVW">
			<xsl:variable name="myVar3" select="$myVar/PARVW = 'WE'"/>
			<xsl:if test="string($myVar3)='true'">
				<STREET>
					<xsl:value-of select="$myVar/STREET"/>
				</STREET>
			</xsl:if>				
		</xsl:for-each>
</xsl:for-each>		
</ORDERHEADER>

Unfortunately the outcome is the following (I get the Tag <STREET> twice, whereas I would like to get it only ONCE):
<ORDERHEADER>
	<STREET>oxford street</STREET>
	<STREET>oxford street</STREET>
</ORDERHEADER>

Does anybody know, what I can do so that the destination.xml contains ONLY ONE <STREET>-tag?
I hope I did make my problem clear.

Thanks in advance,
Andreas

-- 
"Ein Herz f|r Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschvn: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!

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.