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

Subject: [xsl] How can I select only unique combinations of attribute value?
From: "Robert Eaton" <reaton@xxxxxxxxxxxxxxx>
Date: Fri, 17 Nov 2006 12:28:50 -0000
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?

<xsl:template match="/">
	<xsl:call-template name="getListStyleNames"/>

<xsl:template name="getListStyleNames">
	<xsl:for-each select="descendant::listitem">
		<xsl:sort select="concat(../@style,@bodystyle,@style)"/>

		<xsl:if test="not(concat(../@style,@bodystyle,@style) =

		<!-- To test just output them for the moment. -->
			<xsl:element name="style">
			<xsl:element name="previousStyle">



Current Thread