I am still struggling a little with XPath.
Current XML
<?xml version="1.0" encoding="utf-8" ?>
<data>
<table_1 dropdown1="Item1"></table_1>
<listitems key1="Item1" name="" key2="Id2"/>
<listitems key1="Item1" name="Item A" key2="Id2"/>
<listitems key1="Item1" name="Item B" key2="Id2"/>
<listitems key1="Item1" name="" key2="Id4"/>
<listitems key1="Item1" name="Item A" key2="Id4"/>
<listitems key1="Item1" name="Item B" key2="Id4"/>
<listitems key1="Item2" name="" key2="Id6"/>
<listitems key1="Item2" name="Item C" key2="Id6"/>
<listitems key1="Item2" name="Item D" key2="Id6"/>
</data>
Current XSL
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<xsl:for-each select="/data/listitems[@key1=/data/table_1/@dropdown1]">
<xsl:value-of select="@name"/>
<br/>
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template match="listitems">
<xsl:value-of select="concat(@name, ' ')" />
</xsl:template>
</xsl:stylesheet>
Current Result:

Assuming you consider
<listitems>elements with the samenameattribute as duplicates, you can use XPath’spreceding-siblingaxis to ignore any elements that are duplicates:That means, you select all the items you selected, with the additional restriction that there not be any preceding
<listitems>sibling element whosenameattribute has the same value as that of the element being tested.