I have just solved this myself
I use the following javascript function like this each time i output a <element> element
Code:
var prototypes = new Array();
function is_new_prototype(key) {
if (typeof prototypes[key] == "undefined") {
prototypes[key] = 1;
return 1;
}
return 0;
};
I test to see if this is the first time the element has been output
with something like the following xsl
Code:
<xsl:variable name="key" select="concat(@id, '_', @mirrored)"/>
<xsl:if test="js:is_new_element($key)">
....
</xsl:if>