This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: find unique codes
- To: xsl-list <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] find unique codes
- From: Xiaocun Xu <xiaocunxu at yahoo dot com>
- Date: Tue, 21 Aug 2001 15:58:15 -0700 (PDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi,
I am still struggling with this problem. I was
thinking, is there a way to use declare one xsl:key
across two different types of elements,
ExtendedAttributeDefinition/@ExtendedAttributeDefinitionCode
and ExtendedAttribute/@ExtendedAttributeCode?
Thanks,
Xiaocun
--- Xiaocun Xu <xiaocunxu@yahoo.com> wrote:
> 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
>
__________________________________________________
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