title: Is there a way to build an xsl stylesheet that filters given xml with multiple identical node names and obtain the result described below
body: <p>Given this xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;root&gt;
      &lt;results&gt;
          &lt;activityDescription&gt;reservation&lt;/activityDescription&gt;
      &lt;/results&gt;
      &lt;results&gt;
          &lt;studentSet&gt;year1&lt;/studentSet&gt;
          &lt;studentSet&gt;year2&lt;/studentSet&gt;
          &lt;studentSet&gt;year3&lt;/studentSet&gt;
          &lt;studentSet&gt;year4&lt;/studentSet&gt;
          &lt;activityDescription&gt;Math&lt;/activityDescription&gt;
      &lt;/results&gt;
      &lt;results&gt;
          &lt;studentSet&gt;1g&lt;/studentSet&gt;
          &lt;studentSet&gt;2h&lt;/studentSet&gt;
          &lt;studentSet&gt;3j&lt;/studentSet&gt;
          &lt;studentSet&gt;4k&lt;/studentSet&gt;
          &lt;activityDescription&gt;Science&lt;/activityDescription&gt;
      &lt;/results&gt;
      &lt;results&gt;
          &lt;studentSet&gt;year 2&lt;/studentSet&gt;
          &lt;activityDescription&gt;XSL/XML&lt;/activityDescription&gt;
      &lt;/results&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>and this XSLT code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:param name="year" select="1"/&gt;
  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
    &lt;body&gt;
      &lt;h2&gt;Schedules&lt;/h2&gt;
      &lt;table border="1"&gt;
        &lt;tr&gt;
          &lt;th&gt;Activity&lt;/th&gt;
          &lt;th&gt;Year&lt;/th&gt;
        &lt;/tr&gt;
        &lt;xsl:for-each select="//results[contains(studentSet,$year)]"&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;xsl:value-of select="activityDescription" /&gt;&lt;/td&gt;
          &lt;td&gt;&lt;xsl:value-of select="studentSet" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;/xsl:for-each&gt;
      &lt;/table&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>The results show two rows (math, science) for param $year = 1, but none for $year = 4, because the contains() function only looks at the first . How could I achieve this?</p>