xsl-list
[Top] [All Lists]

Re: [xsl] Identifying unique attribute values in nested sibling elements

2011-09-29 05:45:31
I apologize, I meant to include that information - I am using XSLT 2.0.

-----Original Message----- From: Michael Kay
Sent: Thursday, September 29, 2011 3:43 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Identifying unique attribute values in nested sibling elements

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>






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--