title: XSL 1.0 - How to use for-each over a tokenized string
body: <p>Using XSL 1.0, I found a nice tokenize function. Now I need to for-each over the resulting tokens. I am very new to XSL.</p>
  
  <p>The php equivalent of what I need:</p>
  
  <pre><code>$in = 'a,b,c,d';
  $tokens = explode (',', $in);
  foreach ($tokens as $token) {
    echo $token;
  }
  </code></pre>
  
  <p>Here's what I have so far. This line will output 'a,b,c,d'-</p>
  
  <pre><code>&lt;xsl:value-of select="@CommaSeparated" /&gt;
  </code></pre>
  
  <p>This will run that string through the tokenize function-</p>
  
  <pre><code>  &lt;xsl:call-template name="tokenize"&gt;
      &lt;xsl:with-param name="pText" select="@CommaSeparated"/&gt;
    &lt;/xsl:call-template&gt;
  </code></pre>
  
  <p>And the tokenize function. I understand what this does, just not the format of the data it spits out-</p>
  
  <pre><code>&lt;xsl:template name="tokenize"&gt;
    &lt;xsl:param name="pText"/&gt;
  
    &lt;xsl:if test="string-length($pText)"&gt;
      &lt;tag&gt;
        &lt;xsl:value-of select=
         "substring-before($pText, ',')"/&gt;
      &lt;/tag&gt;
  
      &lt;xsl:call-template name="tokenize"&gt;
        &lt;xsl:with-param name="pText" select=
         "substring-after($pText, ',')"/&gt;
      &lt;/xsl:call-template&gt;
    &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  </code></pre>