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

Re: Identifying unique attribute values in nested sibl

Subject: Re: Identifying unique attribute values in nested sibling elements
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 29 Sep 2011 11:43:42 +0100
Re:  Identifying unique attribute values in nested sibl
The answer to your question (and any other question involving elimination of duplicates) will depend greatly on whether you are using XSLT 1.0 or XSLT 2.0.

Michael Kay
Saxonica

On 29/09/2011 11:31, Mark wrote:
In processing XML similar to the fragment below, I have identified that within its <Set> element, five <Stamp> elements are of interest (because they all contain <Formats se-tenant="1">). The other possible <Stamp> elements that do not have this feature are of no interest. My problem occurs in <xsl:template match="Stamp">:

While I am in the context of the *unique* <Stamp> element that has identical values for the pofis-number and se-tenent attributes -- in this instance, the fragment's first <Stamp> element -- how can I gather all of the <Value> elements from the subsequent <Stamp> elements of interest while ignoring:
(1) <Value> elements identical to those already found, and
(2) <Value> elements in <Stamp> elements of no interest?


For the given XML fragment, I want to find these four <Value> elements and ignore the duplicated <Value> element:
Unique:
kc-value="14"
kc-value="18"
kc-value="18" h-value="50"
kc-value="0" l-value="A"


Duplicate:
kc-value="14"

Thanks,
Mark
-----------------------------
<Set>
<!--possibly other unrelated <Stamp> elements here-->
<Stamp>
<CatNumbers  pofis-number="1"/>
<Value kc-value="14"/>
<Formats se-tenant="1"/>
</Stamp>
<!--possibly other unrelated <Stamp> elements here-->
<Stamp>
<CatNumbers pofis-number="2"/>
<Value kc-value="18"/>
<Formats se-tenant="1"/>
</Stamp>
..... <!--possibly other unrelated stamp elements-->
<Stamp>
<CatNumbers pofis-number="3"/>
<Value kc-value="18" h-value="50"/>
<Formats se-tenant="1"/>
</Stamp>
<!--possibly other unrelated <Stamp> elements here-->
<Stamp>
<CatNumbers pofis-number="4"/>
<Value kc-value="14" />
<Formats se-tenant="1"/>
</Stamp>
<!--possibly other unrelated <Stamp> elements here-->
<Stamp>
<CatNumbers pofis-number="5"/>
<Value kc-value="0" l-value="A" />
<Formats se-tenant="1"/>
</Stamp>
</Set>

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.