How to eliminate duplicate nodes bases on values of multiple attributes?

Posted by JayRaj on Stack Overflow See other posts from Stack Overflow or by JayRaj
Published on 2011-01-06T09:04:55Z Indexed on 2011/01/06 20:53 UTC
Read the original article Hit count: 288

Filed under:
|

Hello All,

How can I eliminate duplicate nodes based on values of multiple (more than 1) attributes? Also the attribute names are passed as parameters to the stylesheet. Now I am aware of the Muenchian method of grouping that uses a <xsl:key> element. But I came to know that XSLT 1.0 does not allow paramters/variables in <xsl:key>.

Is there another method(s) to achieve duplicate nodes removal? It is fine if it not as efficient as the Munechian method.

Update from previus question:

XML:

<data id = "root">
  <record id="1" operator1='xxx' operator2='yyy' operator3='zzz'/>
  <record id="2" operator1='abc' operator2='yyy' operator3='zzz'/>
  <record id="3" operator1='abc' operator2='yyy' operator3='zzz'/>
  <record id="4" operator1='xxx' operator2='yyy' operator3='zzz'/>
  <record id="5" operator1='xxx' operator2='lkj' operator3='tyu'/>
  <record id="6" operator1='xxx' operator2='yyy' operator3='zzz'/>
  <record id="7" operator1='abc' operator2='yyy' operator3='zzz'/>
  <record id="8" operator1='abc' operator2='yyy' operator3='zzz'/>
  <record id="9" operator1='xxx' operator2='yyy' operator3='zzz'/>
  <record id="10" operator1='rrr' operator2='yyy' operator3='zzz'/>
</data>

© Stack Overflow or respective owner

Related posts about xslt

Related posts about xslt-1.0