[xsl] Matching not only references via keys but also unique sets of child elements

Subject: [xsl] Matching not only references via keys but also unique sets of child elements
From: "Young Matthew" <matthew.young@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Feb 2005 08:14:35 +0100
Hej,

Got referencing nodes (defined by the presense of @reference-id
attribute) and referenced nodes (defined by the presense of @id) which
together to make a complete resource definition by their combined
instances a particular child (see below) and their shared reference id.
What I want is to find unique instances of "resource definitions" and be
able to bypass duplicates (using Xpath 1.0 and XSL 1.0 without extended
functions).  In other words, the second referencing node below is a
duplicate to the one above it since they have the exact same "set"
elements (i.e. same name and value values) plus the same reference id
(i.e. "xyz").  However, the third referencing node is completely unique
to the preceding nodes.

Right now I make a string footprint of the currently processed resources
node (i.e. "xyz,c1=c1,d1=d1") and match that against other nodes with
same reference-id.  Seems kind of a brute-force solution.



<resource id="xyz">
	<set name="a1" value="a1"/>
</resource>

<resource reference-id="xyz">
	<set name="c1" value="c1"/>
	<set name="d1" value="d1"/>
</resource>

<resource reference-id="xyz">
	<set name="c1" value="c1"/>
	<set name="d1" value="d1"/>
</resource>

<resource reference-id="xyz">
	<set name="c1" value="c1"/>
</resource>

/Matthew Young

Current Thread