title: How to extract the content of two equal XML-fields with XSLT?
body: <p>I have the following fields in XML:</p>
  
  <pre><code>&lt;datafield tag="004R"&gt;&lt;subfield code="0"&gt;10900/69470&lt;/subfield&gt;&lt;/datafield&gt;
  
  &lt;datafield tag="004R"&gt;&lt;subfield code="0"&gt;10419/140630&lt;/subfield&gt;&lt;/datafield&gt;
  </code></pre>
  
  <p>So  the Tags are the same "004R" and also the subfiledcode "0", but the value is different.</p>
  
  <p>I try to extract both fields with my XSLT, but I get only the first repeated twice. That's my XSLT:
  First I define the variable</p>
  
  <pre><code>&lt;xsl:variable name="handle004R" 
                          select="recordData/record/datafield[@tag='004R']/subfield[@code='0']" /&gt;
  </code></pre>
  
  <p>and then try to extract all the values:</p>
  
  <pre><code> &lt;xsl:choose&gt;
                          &lt;xsl:when test="string($handle004R)"&gt;
                              &lt;xsl:for-each select="$handle004R"&gt;
                                  &lt;identifier xmlns="http://purl.org/dc/elements/1.1/"&gt;
                                      &lt;xsl:value-of select="$handle004R" /&gt;
                                  &lt;/identifier&gt;
                              &lt;/xsl:for-each&gt;
                          &lt;/xsl:when&gt;
                          &lt;xsl:otherwise /&gt;
                      &lt;/xsl:choose&gt;
  </code></pre>
  
  <p>The output is: </p>
  
  <pre><code>&lt;identifier xmlns="http://purl.org/dc/elements/1.1/"&gt;10900/69470&lt;/identifier&gt;
  &lt;identifier xmlns="http://purl.org/dc/elements/1.1/"&gt;10900/69470&lt;/identifier&gt;
  </code></pre>
  
  <p>But it should be: </p>
  
  <pre><code>&lt;identifier xmlns="http://purl.org/dc/elements/1.1/"&gt;10900/69470&lt;/identifier&gt;
  &lt;identifier xmlns="http://purl.org/dc/elements/1.1/"&gt;10419/140630&lt;/identifier&gt;
  </code></pre>