You can match any element that has a previous brother with the same name and not display anything.
XSLT Example:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="/*/*[preceding-sibling::*[name() = current()/name()]]"/> </xsl:stylesheet>
Output (using Saxon 9 HE):
<root> <a> <name>kyle</name> </a> <b> <name>stan</name> </b> </root>
source share