xsl-list
[Top] [All Lists]

Re: [xsl] How can I select only unique combinations of attribute value?

2006-11-17 05:52:22
On 11/17/06, Robert Eaton <reaton(_at_)thunderhead(_dot_)com> wrote:
I am trying to create some output based on the combination of several
different attribute values. But the same combination of value could
occur multiple times within the input document and I only want the
output to appear once for each unique combination of attribute values.
I have tried the code below, at this stage it just outputs the values
while I was trying to get it working. I thought using preceding would
look at the preceding node within the set being used in the for each,
and that has been sorted, but this didn't seem to be the case.
I am going about this in completely the wrong way? How should I compare
a node within an iteration of a for-each with the same value for the
previous node? Or is there a different/more efficient way to filter the
results down to only unique value?

This appears to be a grouping problem, so for XSLT 1.0 use "Muenchian
grouping", in XSLT 2.0 use this inbuilt <xsl:for-each-group> (search
for whichever applies)

If you need help with either of these, post back a sample input XML
and an expected result

cheers
andrew

--~------------------------------------------------------------------
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>
--~--