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

find unique codes

Subject: find unique codes
From: Xiaocun Xu <xiaocunxu@xxxxxxxxx>
Date: Mon, 20 Aug 2001 19:17:29 -0700 (PDT)
unique codes
Hi,

  I have the need to find unique attribute codes
across two different types of elements:
ExtendedAttributeDefinition and ExtendedAttribute. 
Following is an example, the input has two
ExtendedAttributeDefinition elements with code Color
and Size, as well as two ExtendedAttribute elements
with code Color and New.  What I need in output is the
two ExtendedAttributeDefinition elements with code
Color and Size, as well as the ExtendedAttribute
element with code New.  The duplicated
ExtendedAttribute element with code Color is
eliminated.
  Attached are the input XML and desired output XML,
with work in progress XSL.  I can get all unique
ExtendedAttribute codes across all lineitems via key,
how can I compare this list with the
ExtendedAttributeDefinition codes and take only the
unique ExtendedAttribute codes?

Much thanks for any suggestions,
Xiaocun

Input XML:
<RFQDomainAttributeDefinition Domain="line_item">
	<ExtendedAttributeDefinition
ExtendedAttributeDefinitionCode="Color"/>	
<ExtendedAttributeDefinition
ExtendedAttributeDefinitionCode="Size"/>
</RFQDomainAttributeDefinition>
<Requisition>
<LineItem LineItemName="item1">
<ExtendedAttribute ExtendedAttributeCode="Color"/>
<ExtendedAttribute ExtendedAttributeCode="New"/>
</LineItem>

Desired Output XML:
<ExtendedAttributeDefinition
ExtendedAttributeDefinitionCode="Color"/>
<ExtendedAttributeDefinition
ExtendedAttributeDefinitionCode="Size"/>
<ExtendedAttribute ExtendedAttributeCode="New"/>

work in progress XSL:
<xsl:key name="extended-attrs-lineitem-index"
match="LineItem/ExtendedAttribute"
use="@ExtendedAttributeCode"/>

<xsl:variable name="extended-attrs-def-lineitem"
select="RFQDomainAttributeDefinition[@Domain =
'line_item']/ExtendedAttributeDefinition"/>

<xsl:variable name="extended-attrs-lineitem"
select="Requisition/LineItem/ExtendedAttribute[generate-id()
= generate-id(key('extended-attrs-lineitem-index',
@ExtendedAttributeCode))]"/>


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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


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.