title: Gluing together strings with delimiters in XSL
body: <p>I have the following structure where I want to fish out the most relevant data and glue it together to make a headline.</p>
  
  <pre><code>&lt;faults&gt;
    &lt;fault componentName="comp1"&gt;
      &lt;introduceWhen&gt;Time1&lt;/introduceWhen&gt;
      &lt;signals&gt;
        &lt;signal name="sig11" value="1"/&gt;
        &lt;signal name="sig22" value="1"/&gt;
      &lt;/signals&gt;
    &lt;/fault&gt;
    &lt;fault componentName="comp2"&gt;
      &lt;introduceWhen&gt;Time2&lt;/introduceWhen&gt;
      &lt;signals&gt;
        &lt;signal name="sig44" value="0"/&gt;
      &lt;/signals&gt;
    &lt;/fault&gt;
  &lt;/faults&gt;
  </code></pre>
  
  <p>What I would like it to be is <code>comp1 1 1 comp2 0</code>, but so far, the best I've managed is <code>comp1 1 1comp2 0</code>, using this:</p>
  
  <pre><code>&lt;xsl:template match="faults"&gt;
    &lt;xsl:for-each select="fault"&gt;
      &lt;xsl:variable name="compName" select="@componentName"/&gt;
      &lt;xsl:variable name="sigVals" select="string-join(signals/signal/@value, ' ')"/&gt;
      &lt;xsl:value-of select="concat(@compName, ' ', $sigVals)"/&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>The solution I have doesn't feel very elegant, so if you have alternate approaches, I would very much like to see them. I also have full control over the XML, so if there are any good solutions that changes the structure of the XML, that too would be of interest.</p>