title: For each in FOP xml
body: <p>I'm generating a PDF through Apache FOP, and since now things are going pretty well.</p>
  
  <p>Now I need to loop through a list and display every element in it and to achieve this I'm using the command <code>&lt;xsl:for-each select="myObject/myList"&gt;</code>, but when FOP begin to parse the XML I get this error:</p>
  
  <pre><code>2015-09-30 12:04:39,772 [http-nio-8080-exec-4] WARN  org.apache.fop.apps.FOUserAgent - Unknown formatting object "{http://www.w3.org/1999/XSL/Transform}for-each" encountered (a child of fo:root}. (See position 9:45)
  java.lang.ClassCastException: org.apache.fop.fo.UnknownXMLObj cannot be cast to org.apache.fop.fo.pagination.Root
      at org.apache.fop.fo.pagination.AbstractPageSequence.getRoot(AbstractPageSequence.java:145)
      at org.apache.fop.fo.pagination.PageSequence.startOfNode(PageSequence.java:111)
      at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:337)
      at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:179)
      at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)
  [...]
  </code></pre>
  
  <p>This is the structure of my XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;fo:layout-master-set&gt;
          &lt;fo:simple-page-master master-name="A4-portrait"
              page-height="29.7cm" page-width="21.0cm" margin="1.5cm"&gt;
              &lt;fo:region-body /&gt;
          &lt;/fo:simple-page-master&gt;
      &lt;/fo:layout-master-set&gt;
      &lt;xsl:for-each select="myObject/myList"&gt;
          &lt;fo:page-sequence master-reference="A4-portrait"&gt;
              &lt;fo:flow flow-name="xsl-region-body" font-size="9"&gt;
                  ## SOME STUFF ARE WRITTEN HERE ##
              &lt;/fo:flow&gt;
          &lt;/fo:page-sequence&gt;
      &lt;/xsl:for-each&gt;
  &lt;/fo:root&gt;
  </code></pre>
  
  <p>I understood that a problem could be the fact that FOP only wants <code>fo:</code> elements. And if this is correct, how can I loop over my list?</p>