title: XSLT 2.0 Solution for Merging Sibling Elements With Same Name and Attribute Value
body: <p>I am looking for a solution that will turn </p>
  
  <pre><code>&lt;p&gt;
  &lt;hi rend="bold"&gt;aa&lt;/hi&gt;
  &lt;hi rend="bold"&gt;bb&lt;/hi&gt;
  &lt;hi rend="bold"&gt;cc&lt;/hi&gt;
  Perhaps some text.
  &lt;hi rend="italic"&gt;dd&lt;/hi&gt;
  &lt;hi rend="italic"&gt;ee&lt;/hi&gt;
  Some more text.
  &lt;hi rend="italic"&gt;ff&lt;/hi&gt;
  &lt;hi rend="italic"&gt;gg&lt;/hi&gt;
  Foo.
  &lt;/p&gt;
  </code></pre>
  
  <p>into</p>
  
  <pre><code>&lt;p&gt;
  &lt;hi rend="bold"&gt;aabbcc&lt;/hi&gt;
  Perhaps some text.
  &lt;hi rend="italic"&gt;ddee&lt;/hi&gt;
  Perhaps some text.
  &lt;hi rend="italic"&gt;ffgg&lt;/hi&gt;
  Foo. 
  &lt;/p&gt;
  </code></pre>
  
  <p>but my solution should _not hardcode  elements and the names of the attribute values (italic, bold). The XSLT should really concatenate ALL sibling elements that have the same name and the same attribute value. Everything else should be left untouched. </p>
  
  <p>I have looked at the solutions that already exist out there but none of them seemed to satisfy all of my requirements.</p>
  
  <p>If anybody has a handy XSLT stylesheet for this, I'd be much obliged.</p>