This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

find 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]