title: fo:for-each is not a valid child of fo:table-row
body: <p>I'm using Apache FOP 2.1 for generating PDF documents inside a simple java application.</p>
  
  <p>When it comes to generate a table with dynamic rows then it always ends in an error:
  <code>(Position des Fehlers unbekannt)org.apache.fop.fo.ValidationException: "fo:for-each" is not a valid child of "fo:table-row"! (Keine Kontextinformationen verfügbar)</code></p>
  
  <p>My xml input looks like:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0"?&gt;
  &lt;invoicedata&gt;
    &lt;invoice&gt;
      &lt;positions&gt;
        &lt;position&gt;
          &lt;posOrder&gt;1&lt;/posOrder&gt;
          &lt;quantity&gt;2&lt;/quantity&gt;
        &lt;/position&gt;
        &lt;position&gt;
          &lt;posOrder&gt;2&lt;/posOrder&gt;
          &lt;quantity&gt;1&lt;/quantity&gt;
        &lt;/position&gt;
      &lt;/positions&gt;
    &lt;/invoice&gt;
  &lt;/invoicedata&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>My xsl fo template looks like:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
    exclude-result-prefixes="fo"&gt;
    &lt;xsl:template match="invoicedata"&gt;
      &lt;fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt;
        &lt;fo:layout-master-set&gt;
          &lt;fo:simple-page-master master-name="A4" page-height="297mm" page-width="210mm"
            margin-top="0.5cm" margin-bottom="0.5cm" margin-left="2cm" margin-right="2cm"&gt;
            &lt;fo:region-body region-name="xsl-region-body" margin-bottom="3.5cm" margin-top="5cm" /&gt;
          &lt;/fo:simple-page-master&gt;
        &lt;/fo:layout-master-set&gt;
  
        &lt;fo:page-sequence master-reference="A4"&gt;
          &lt;fo:flow flow-name="xsl-region-body" font-size="10pt"&gt;
            &lt;xsl:if test="invoice/positions"&gt;
              &lt;fo:block&gt;
                &lt;fo:table table-layout="fixed" width="100%" border-style="solid" border-width="1pt"                &gt;
                  &lt;fo:table-column column-width="7%" border-style="solid" border-width="1pt" /&gt;
                  &lt;fo:table-column column-width="8%" border-style="solid" border-width="1pt" /&gt;
                  &lt;fo:table-header background-color="gray"&gt;
                    &lt;fo:table-row&gt;
                      &lt;fo:table-cell border-style="solid" border-width="1pt" &gt;
                        &lt;fo:block text-align="center"&gt;Pos.&lt;/fo:block&gt;
                      &lt;/fo:table-cell&gt;
                      &lt;fo:table-cell border-style="solid" border-width="1pt" &gt;
                        &lt;fo:block text-align="center"&gt;Menge&lt;/fo:block&gt;
                      &lt;/fo:table-cell&gt;
                    &lt;/fo:table-row&gt;
                  &lt;/fo:table-header&gt;
                  &lt;fo:table-body&gt;
                    &lt;fo:table-row&gt;
                      &lt;fo:for-each select="invoice/positions"&gt;
                      &lt;fo:table-cell &gt;
                        &lt;fo:block text-align="right"&gt;
                          &lt;xsl:value-of select="posOrder" /&gt;
                        &lt;/fo:block&gt;
                      &lt;/fo:table-cell&gt;
                      &lt;fo:table-cell &gt;
                        &lt;fo:block text-align="right"&gt;
                          &lt;xsl:value-of select="quantity" /&gt;
                        &lt;/fo:block&gt;
                      &lt;/fo:table-cell&gt;
                      &lt;/fo:for-each&gt;
                    &lt;/fo:table-row&gt;
                  &lt;/fo:table-body&gt;
                &lt;/fo:table&gt;
              &lt;/fo:block&gt;
            &lt;/xsl:if&gt;
          &lt;/fo:flow&gt;
        &lt;/fo:page-sequence&gt;
      &lt;/fo:root&gt;
    &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So, atm I have no clue how to configure the for-each element to generate a table with dynamic rows.</p>