title: XSLT 1.0 to iterate over several XML elements with comma delimited values
body: <p>I have an XML document structured as follows</p>
  
  <pre><code>&lt;items&gt;
   &lt;item&gt;
    &lt;name&gt;item1&lt;/name&gt;
    &lt;attributes&gt;a,b,c,d&lt;/attributes&gt;
   &lt;/item&gt;
   &lt;item&gt;
    &lt;name&gt;item2&lt;/name&gt;
    &lt;attributes&gt;c,d,e&lt;/attributes&gt;
   &lt;/item&gt;
  &lt;/items&gt;
  </code></pre>
  
  <p>For each unique attribute value (delimited by commas) I need to list all item names associated with that value like so:</p>
  
  <pre><code>a : item1
  b : item1
  c : item1, item2
  d : item1, item2
  e : item2
  </code></pre>
  
  <p>My initial plan was to use a template to parse the attributes into Attribute nodes, surrounding each with appropriate tags, and then separating out the unique values with an XPATH expression like</p>
  
  <pre><code>Attribute[not(.=following::Attribute)]
  </code></pre>
  
  <p>but since the result of the template isn't a node-set that ever goes through an XML parser, I can't traverse it.  I also tried exslt's node-set() function only to realize it does not allow me to traverse the individual Attribute nodes either.  </p>
  
  <p>At this point I'm at a loss for a simple way to do this and would really appreciate any help or ideas on how to proceed.  Thanks!</p>