title: Xslt Nested For-Loop with break
body: <p>All,</p>
  
  <p>I'm new to XSLT and facing a typical problem. Below is the problem details</p>
  
  <p>Based on the data below, i needed to show ItemA/ANum element only when its of AName BBC and not part of ItemB/tempBNum</p>
  
  <p>So desired result for the below data should be 0214,BBC, since its part of the ItemA, also is a BBC is does not appear in ItemB.</p>
  
  <pre><code>&lt;myData&gt;
  &lt;ItemA&gt;
      &lt;ANum&gt;0213&lt;/ANum&gt;
      &lt;AName&gt;OOC&lt;/AName&gt;
  &lt;/ItemA&gt;
  &lt;ItemA&gt;
      &lt;ANum&gt;0031&lt;/ANum&gt;
      &lt;AName&gt;BBC&lt;/AName&gt;
  &lt;/ItemA&gt;
  &lt;ItemA&gt;
      &lt;ANum&gt;0214&lt;/ANum&gt;
      &lt;AName&gt;BBC&lt;/AName&gt;
  &lt;/ItemA&gt;
  &lt;ItemA&gt;
      &lt;ANum&gt;0044&lt;/ANum&gt;
      &lt;AName&gt;BBC&lt;/AName&gt;
  &lt;/ItemA&gt;
  
  &lt;ItemB&gt;
      &lt;tempBNum&gt;0031&lt;/tempBNum&gt;
  &lt;/ItemB&gt;
  &lt;ItemB&gt;
      &lt;tempBNum&gt;0044&lt;/tempBNum&gt;
  &lt;/ItemB&gt;
  &lt;/myData&gt;
  </code></pre>
  
  <p>For this end, I tried putting in a logic of having Nested For Loops, only problem being nested loop should break when ItemAObj/ANum = tempBNum, but its not breaking and producing duplicate results.</p>
  
  <pre><code>  &lt;xsl:for-each select="myData/ItemA"&gt;
      &lt;xsl:variable name="ItemAObj" select="." /&gt;
      Num = &lt;xsl:value-of select="$ItemAObj/ANum"/&gt;
      &lt;xsl:for-each select="/myData/ItemB"&gt;
      &lt;xsl:choose&gt;
          &lt;xsl:when test="$ItemAObj/ANum!=tempBNum and $ItemAObj/AName='BBC'"&gt; &lt;xsl:value-of select="tempBNum"/&gt;
          &lt;xsl:text&gt; &lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
          &lt;/xsl:choose&gt;
          &lt;/xsl:for-each&gt;
    &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>Any help on this will be greatly appreciated.</p>