I am trying to filter through my XML using XSLT. I have a list of programming standards, and I am trying to figure out how to display all the languages that have that specific standard in a table data cell. So far, I have got it displaying all languages in each cell. My logic is off. Ideas?
XML
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="standards_XSL.xsl"?>
<programming>
<languages>
<language id="1">
<name>C</name>
<purpose>
<intendedUse id="1" />
<intendedUse id="2" />
<intendedUse id="3" />
<intendedUse id="4" />
</purpose>
<features>
<feature id="1" />
<feature id="4" />
</features>
<standards>
<standard id="1" />
<standard id="2" />
</standards>
</language>
<language id="2">
<name>C++</name>
<purpose>
<intendedUse id="1" />
<intendedUse id="2" />
</purpose>
<features>
<feature id="1" />
<feature id="2" />
<feature id="3" />
<feature id="4" />
<feature id="5" />
</features>
<standards>
<standard id="2" />
</standards>
</language>
<language id="3">
<name>C#</name>
<purpose>
<intendedUse id="1" />
<intendedUse id="5" />
<intendedUse id="6" />
<intendedUse id="7" />
<intendedUse id="3" />
<intendedUse id="8" />
<intendedUse id="9" />
</purpose>
<features>
<feature id="1" />
<feature id="2" />
<feature id="3" />
<feature id="4" />
<feature id="5" />
<feature id="6" />
<feature id="7" />
</features>
<standards>
<standard id="3" />
<standard id="2" />
</standards>
</language>
<language id="4">
<name>Java</name>
<purpose>
<intendedUse id="1" />
<intendedUse id="6" />
<intendedUse id="7" />
<intendedUse id="3" />
<intendedUse id="8" />
<intendedUse id="9" />
</purpose>
<features>
<feature id="1" />
<feature id="2" />
<feature id="5" />
<feature id="6" />
</features>
<standards>
<standard id="4" />
</standards>
</language>
<language id="5">
<name>JavaScript</name>
<purpose>
<intendedUse id="7" />
<intendedUse id="8" />
<intendedUse id="7" />
</purpose>
<features>
<feature id="1" />
<feature id="2" />
<feature id="3" />
<feature id="6" />
</features>
<standards>
<standard id="3" />
</standards>
</language>
<language id="6">
<name>PHP</name>
<purpose>
<intendedUse id="8" />
<intendedUse id="9" />
</purpose>
<features>
<feature id="1" />
<feature id="2" />
<feature id="4" />
<feature id="6" />
</features>
<standards>
<standard id="5" />
</standards>
</language>
<language id="7">
<name>Python</name>
<purpose>
<intendedUse id="1" />
<intendedUse id="3" />
<intendedUse id="9" />
<intendedUse id="10" />
<intendedUse id="11" />
<intendedUse id="12" />
</purpose>
<features>
<feature id="1" />
<feature id="2" />
<feature id="3" />
<feature id="6" />
</features>
<standards>
<standard id="5" />
</standards>
</language>
<language id="8">
<name>Basic</name>
<purpose>
<intendedUse id="1" />
<intendedUse id="13" />
</purpose>
<features>
<feature id="1" />
<feature id="4" />
</features>
<standards>
<standard id="1" />
<standard id="2" />
</standards>
</language>
<language id="9">
<name>ADA</name>
<purpose>
<intendedUse id="1" />
<intendedUse id="2" />
<intendedUse id="14" />
<intendedUse id="15" />
</purpose>
<features>
<feature id="1" />
<feature id="2" />
<feature id="4" />
<feature id="5" />
</features>
<standards>
<standard id="1" />
<standard id="2" />
<standard id="6" />
</standards>
</language>
<language id="10">
<name>ActionScript 3.0</name>
<purpose>
<intendedUse id="1" />
<intendedUse id="7" />
<intendedUse id="9" />
</purpose>
<features>
<feature id="1" />
<feature id="2" />
<feature id="7" />
</features>
<standards>
<standard id="3" />
</standards>
</language>
</languages>
<purpose>
<intendedUse id="1"> Application</intendedUse>
<intendedUse id="2"> System </intendedUse>
<intendedUse id="3"> General Purpose </intendedUse>
<intendedUse id="4"> Low-Level Operations </intendedUse>
<intendedUse id="5"> RAD </intendedUse>
<intendedUse id="6"> Business </intendedUse>
<intendedUse id="7"> Client-Side </intendedUse>
<intendedUse id="8"> Server-Side </intendedUse>
<intendedUse id="9"> Web </intendedUse>
<intendedUse id="10"> Scripting </intendedUse>
<intendedUse id="11"> AI </intendedUse>
<intendedUse id="12"> Scientific Computing </intendedUse>
<intendedUse id="13">Education</intendedUse>
<intendedUse id="14">Embedded</intendedUse>
<intendedUse id="15">RealTime</intendedUse>
</purpose>
<features>
<feature id="1">Imperative </feature>
<feature id="2">Object-Oriented</feature>
<feature id="3">Functional</feature>
<feature id="4">Procedural</feature>
<feature id="5">Generic</feature>
<feature id="6">Reflective</feature>
<feature id="7">Event-Driven</feature>
</features>
<standards>
<standard id="1">ANSI</standard>
<standard id="2">ISO</standard>
<standard id="3">ECMA</standard>
<standard id="4">DE FACTO</standard>
<standard id="5">NO</standard>
<standard id="6">GOST</standard>
</standards>
</programming>
UPDATE XSLT
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="language-by-standard" match="language" use="standards/standard/@id" />
<xsl:param name="selectedStandard">ECMA</xsl:param>
<xsl:template match="/" >
<html>
<body>
<table border="1">
<tr>
<th>Standards</th>
<th>Language</th>
</tr>
<xsl:for-each select="programming/standards[standard=$selectedStandard]">
<tr>
<td>
<xsl:value-of select="$selectedStandard"/>
</td>
<td>
<xsl:for-each select="key('language-by-standard', /programming/standards/standard/@id)" >
<xsl:value-of select="name" />
<br />
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

