<xml> <add link='a' value='c' /> <add link='a' value='b' /> <add link='a' value='c' /> </xml> <xsl:for-each select="xml/add[@link='a'][not(following::add/@value=@value)]"> <link rel="stylesheet" href="{@value}" type="text/css" /> </xsl:for-each>
<xml> <add link='a' value='c' /> <add link='a' value='b' /> <add link='a' value='c' /> </xml> <xsl:for-each select="xml/add[@link='a'][not(following::add/@value=@value)]"> <link rel="stylesheet" href="{@value}" type="text/css" /> </xsl:for-each>