title: Concat using for each loop and and keyword
body: <p>Recently I've encountered a case where in i should apply a for each loop and concat strings using 'and' keyword. Below is a part of my xml document.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;case.ref.no.group&gt;
      &lt;case.ref.no&gt;
          &lt;prefix&gt;Civil Appeal&lt;/prefix&gt;
          &lt;number&gt;W-02-887&lt;/number&gt;
          &lt;year&gt;2008&lt;/year&gt;
      &lt;/case.ref.no&gt;
      &lt;case.ref.no&gt;
          &lt;prefix&gt;Civil Appeal&lt;/prefix&gt;
          &lt;number&gt;W-02-888&lt;/number&gt;
          &lt;year&gt;2008&lt;/year&gt;
      &lt;/case.ref.no&gt;
  &lt;/case.ref.no.group&gt;
  </code></pre>
  
  <p>and i tried the below xslt on it.</p>
  
  <pre><code>&lt;xsl:template match="case.ref.no.group"&gt;
      &lt;xsl:variable name="pre"&gt;
        &lt;section class="sect2"&gt;
        &lt;xsl:text disable-output-escaping="yes"&gt;Court of Appeal&lt;/xsl:text&gt;
        &lt;/section&gt;
      &lt;/xsl:variable&gt;
      &lt;xsl:variable name="tex"&gt;
        &lt;xsl:value-of select="./case.ref.no/prefix"/&gt;
      &lt;/xsl:variable&gt;
      &lt;xsl:variable name="iter"&gt;
  
          &lt;xsl:value-of select="./case.ref.no/number"/&gt;
          &lt;xsl:if test="following::case.ref.no/number"&gt;;&lt;/xsl:if&gt;
  
      &lt;/xsl:variable&gt;
      &lt;xsl:variable name="year"&gt;
        &lt;xsl:value-of select="./case.ref.no/year"/&gt;
      &lt;/xsl:variable&gt;
      &lt;div class="para"&gt;
        &lt;xsl:value-of select="concat($pre,' – ',$tex,' Nos. ',$iter,'-',$year)"/&gt;
      &lt;/div&gt;
    &lt;/xsl:template&gt;
  </code></pre>
  
  <p>when i try to run it it is giving me the below output.</p>
  
  <p><strong>Court of Appeal – Civil Appeal Nos. W-02-887 2008</strong></p>
  
  <p>but i want it to be as below.</p>
  
  <p><strong>Court of Appeal – Civil Appeal Nos. W-02-887-2008 and W-02-888-2008</strong></p>
  
  <p>please let me know how i can achieve this. i'm doing this in xslt 1.0.</p>
  
  <p>Thanks</p>