org.apache.fop.apps.FOPException: root must be root element
        at org.apache.fop.fo.pagination.Root.(Root.java:52)

I get this exception only very, very intermittently when I'm rendering to
PDF a document with many images.  Can anyone help?

I'm running embedded.  Embedded code:

myDriver = new Driver();

        //  Tell the FOP Driver what logger to use.
        //  This must be done in the order it is here.
        Log4JLogger log4j = new Log4JLogger(dora);
        MessageHandler.setScreenLogger(log4j);
        myDriver.setLogger(log4j);

        //  What other kinds can be rendered?
        //  AWT, MIF, PCL, PDF, PRINT, PS, SVG, TXT, XML
        myDriver.setRenderer(Driver.RENDER_PDF);

...

Configuration.put("baseDir", baseDir);
            InputSource is = new InputSource(fo);
            myDriver.setInputSource(is);
            myDriver.setOutputStream(pdf);
            myDriver.run();


Here is the xsl that is transformed to fo:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;"> <!-- NO-BREAK SPACE -->]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:svg="http://www.w3.org/2000/svg";>
  <xsl:include href="substitute.xsl"/>
  <xsl:output indent="no" method="xml" encoding="UTF-8"/>
  <xsl:preserve-space elements="Subsection"/>
  <xsl:param name="servlet"/>
  <xsl:param name="currentDate"/>
  <xsl:template match="Report">
    <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE fo:root
[&lt;!ENTITY nbsp "&#160;"&gt;]&gt;</xsl:text>
    <xsl:variable name="status" select="ReportData/State"/>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:fox="http://xml.apache.org/fop/extensions";
xmlns:svg="http://www.w3.org/2000/svg";>
      <!-- defines page layout -->
      <fo:layout-master-set>
        <fo:simple-page-master
            master-name="normal"
            page-height="11in" page-width="8.5in"
            margin-top="0.5in"
            margin-bottom="0.5in"
            margin-left="1in"
            margin-right="1in">
          <fo:region-body margin-top="2.5in" margin-bottom="1.2in">
            <xsl:if test="$status = 'draft'">
              <xsl:attribute name="background-image">
                <xsl:text>draft.jpg</xsl:text>
              </xsl:attribute>
            </xsl:if>
          </fo:region-body>
          <fo:region-before extent="2.8in"/>
          <fo:region-after extent="1.0in"/>
        </fo:simple-page-master>

        <fo:page-sequence-master master-name="simpleDoc" >
          <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference master-reference="normal"
/>
          </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>
      </fo:layout-master-set>
      <!-- end: defines page -->

      <!-- actual layout -->
      <fo:page-sequence
          master-reference="simpleDoc"
          language="en"
          country="GB"
          hyphenate="true"
          hyphenation-push-character-count="2"
          hyphenation-remain-character-count="2">
        <xsl:apply-templates select="ReportData">
          <xsl:with-param name="status" select="$status"/>
        </xsl:apply-templates>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>

  <xsl:template match="ReportData">
    <xsl:param name="status"/>
    <!-- Header block -->
    <fo:static-content flow-name="xsl-region-before">
      <xsl:apply-templates select="Institution"/>
      <fo:block
          font-size="14pt"
          font-family="sans-serif"
          font-weight="bold"
          line-height="15pt"
          text-align="center">
        <xsl:value-of select="../Type"/>
      </fo:block>
      <fo:block
          font-size="10pt"
          font-family="sans-serif"
          line-height="15pt"
          space-after.optimum="3pt"
          text-align="center">
        Page <fo:page-number/> of <fo:page-number-citation
ref-id="endofdoc"/>
      </fo:block>
      <xsl:apply-templates select="Patient"/>
    </fo:static-content>
    <fo:static-content flow-name="xsl-region-after">
      <fo:block
          font-size="8pt"
          font-family="sans-serif"
          font-weight="bold"
          text-align="left">
        <xsl:value-of select="Footer"/>
      </fo:block>
      <fo:block
          font-size="8pt"
          font-family="sans-serif"
          font-weight="bold"
          text-align="center">
        <xsl:value-of select="$currentDate"/>
      </fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
      <fo:block>
        <xsl:apply-templates select="Procedure"/>
        <xsl:apply-templates select="SurgicalTeam"/>
        <xsl:apply-templates select="Sections">
          <xsl:with-param name="status" select="$status"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="Images"/>
        <!-- table start -->
        <fo:table inline-progression-dimension.optimum="5pt"
space-before.optimum="30pt" table-layout="fixed">
          <fo:table-column/>
          <fo:table-body>
            <fo:table-row keep-together="always" keep-with-next="always">
              <fo:table-cell>
                <fo:list-block>
                  <xsl:apply-templates select="Signature"/>
                </fo:list-block>
              </fo:table-cell>
            </fo:table-row>
            <fo:table-row>
              <fo:table-cell>
                <xsl:apply-templates select="CC"/>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </fo:block>
      <!-- Simply here for page numbering -->
      <fo:block id="endofdoc"/>
    </fo:flow>
  </xsl:template>

  <xsl:template match="Institution">
    <xsl:choose>
      <xsl:when test="string-length(Logo/@url) > 0">
        <fo:table inline-progression-dimension.optimum="5pt"
text-align="left" table-layout="fixed">
          <fo:table-column/>
          <fo:table-column/>
          <fo:table-body>
            <fo:table-row keep-together="always">
              <fo:table-cell>
                <xsl:apply-templates select="Logo"/>
              </fo:table-cell>
              <fo:table-cell>
                <xsl:apply-templates select="Name"/>
                <xsl:apply-templates select="Address"/>
                <xsl:apply-templates select="Phone"/>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="Name"/>
        <xsl:apply-templates select="Address"/>
        <xsl:apply-templates select="Phone"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="Patient">
    <xsl:variable name="patFirstName" select="./Name/FirstName"/>
    <xsl:variable name="patLastName" select="./Name/LastName"/>
    <xsl:variable name="patMRN" select="./MRN"/>
    <xsl:variable name="patDOB" select="./DOB"/>
    <xsl:variable name="patSex" select="./Sex"/>
    <fo:table inline-progression-dimension.optimum="5pt" text-align="left"
table-layout="fixed">
      <fo:table-column column-number="1"
column-width="proportional-column-width(20)"/>
      <fo:table-column column-number="2"
column-width="proportional-column-width(80)"/>
      <fo:table-body>
        <xsl:if test="$patLastName">
          <fo:table-row keep-together="always" keep-with-next="always">
            <fo:table-cell>
              <fo:block
                  font-size="12pt"
                  font-family="sans-serif"
                  space-before.optimum="5pt">
                <xsl:text>Patient Name:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:block
                  font-size="12pt"
                  font-family="sans-serif"
                  space-before.optimum="5pt"
                  text-align="left">
                <xsl:if test="string-length($patLastName) > 0 and
string-length($patFirstName) > 0">
                  <xsl:value-of select="$patLastName"/>, <xsl:value-of
select="$patFirstName"/>
                </xsl:if>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
        <xsl:if test="$patMRN">
          <fo:table-row keep-together="always" keep-with-next="always">
            <fo:table-cell>
              <fo:block
                  font-size="12pt"
                  font-family="sans-serif">
                <xsl:text>Patient ID:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:block
                  font-size="12pt"
                  font-family="sans-serif"
                  text-align="left">
                <xsl:value-of select="$patMRN"/>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
        <xsl:if test="$patDOB">
          <fo:table-row keep-together="always" keep-with-next="always">
            <fo:table-cell>
              <fo:block
                  font-size="12pt"
                  font-family="sans-serif">
                <xsl:text>Patient DOB:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:block
                  font-size="12pt"
                  font-family="sans-serif"
                  text-align="left">
                <xsl:value-of select="$patDOB"/>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
        <xsl:if test="$patSex">
          <fo:table-row keep-together="always" keep-with-next="always">
            <fo:table-cell>
              <fo:block
                  font-size="12pt"
                  font-family="sans-serif">
                <xsl:text>Patient Sex:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:block
                  font-size="12pt"
                  font-family="sans-serif"
                  text-align="left">
                <xsl:value-of select="$patSex"/>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
      </fo:table-body>
    </fo:table>
  </xsl:template>
  <!--
  <xsl:template match="Patient">
    <xsl:variable name="patFirstName" select="./Name/FirstName"/>
    <xsl:variable name="patLastName" select="./Name/LastName"/>
    <xsl:variable name="patMRN" select="./MRN"/>
    <xsl:variable name="patDOB" select="./DOB"/>
    <xsl:variable name="patSex" select="./Sex"/>
    <fo:table inline-progression-dimension.optimum="5pt" text-align="left"
table-layout="fixed">
      <fo:table-column column-number="1"
column-width="proportional-column-width(70)"/>
      <fo:table-column column-number="2"
column-width="proportional-column-width(30)"/>
      <fo:table-body>
        <fo:table-row keep-together="always" keep-with-next="always">
          <fo:table-cell>
            <fo:table inline-progression-dimension.optimum="5pt"
text-align="left" table-layout="fixed">
              <fo:table-column column-number="1"
column-width="proportional-column-width(30)"/>
              <fo:table-column column-number="2"
column-width="proportional-column-width(70)"/>
              <fo:table-body>
                <xsl:if test="$patLastName">
                  <fo:table-row keep-together="always"
keep-with-next="always">
                    <fo:table-cell>
                      <fo:block
                          font-size="12pt"
                          font-family="sans-serif"
                          space-before.optimum="5pt">
                        <xsl:text>Patient Name:</xsl:text>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                      <fo:block
                          font-size="12pt"
                          font-family="sans-serif"
                          space-before.optimum="5pt"
                          text-align="left">
                        <xsl:if test="string-length($patLastName) > 0 and
string-length($patFirstName) > 0">
                          <xsl:value-of select="$patLastName"/>,
<xsl:value-of select="$patFirstName"/>
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </xsl:if>
                <xsl:if test="$patMRN">
                  <fo:table-row keep-together="always"
keep-with-next="always">
                    <fo:table-cell>
                      <fo:block
                          font-size="12pt"
                          font-family="sans-serif">
                        <xsl:text>Patient ID:</xsl:text>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                      <fo:block
                          font-size="12pt"
                          font-family="sans-serif"
                          text-align="left">
                        <xsl:value-of select="$patMRN"/>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </xsl:if>
              </fo:table-body>
            </fo:table>
          </fo:table-cell>
          <fo:table-cell>
            <fo:table inline-progression-dimension.optimum="5pt"
text-align="left" table-layout="fixed">
              <fo:table-column column-number="1"
column-width="proportional-column-width(40)"/>
              <fo:table-column column-number="2"
column-width="proportional-column-width(60)"/>
              <fo:table-body>
                <xsl:if test="$patDOB">
                  <fo:table-row keep-together="always"
keep-with-next="always">
                    <fo:table-cell>
                      <fo:block
                          font-size="12pt"
                          font-family="sans-serif"
                          language="en"
                          space-before.optimum="5pt">
                        <xsl:text>Patient DOB:</xsl:text>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                      <fo:block
                          space-before.optimum="5pt"
                          font-size="12pt"
                          font-family="sans-serif"
                          text-align="left">
                        <xsl:value-of select="$patDOB"/>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </xsl:if>
                <xsl:if test="$patSex">
                  <fo:table-row keep-together="always"
keep-with-next="always">
                    <fo:table-cell>
                      <fo:block
                          font-size="12pt"
                          font-family="sans-serif">
                        <xsl:text>Patient Sex:</xsl:text>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                      <fo:block
                          font-size="12pt"
                          font-family="sans-serif"
                          text-align="left">
                        <xsl:choose>
                          <xsl:when test="$patSex = 'M'">
                            <xsl:text>Male</xsl:text>
                          </xsl:when>
                          <xsl:when test="$patSex = 'F'">
                            <xsl:text>Female</xsl:text>
                          </xsl:when>
                        </xsl:choose>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </xsl:if>
              </fo:table-body>
            </fo:table>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </xsl:template>
-->
  <xsl:template match="Procedure">
    <xsl:variable name="procType" select="./Type"/>
    <xsl:variable name="procPrintType" select="./PrintType"/>
    <xsl:variable name="procDate" select="./Date"/>
    <xsl:variable name="preAssess" select="./PreAssessment"/>
    <xsl:variable name="postAssess" select="./PostAssessment"/>
    <xsl:variable name="procLocation" select="./Location"/>
    <fo:table inline-progression-dimension.optimum="5pt" text-align="left"
table-layout="fixed">
      <fo:table-column/>
      <fo:table-column/>
      <fo:table-body>
        <xsl:if test="$procDate">
          <fo:table-row>
            <fo:table-cell keep-together="always">
              <fo:block
                  space-after.optimum="10pt">
                <xsl:text>DATE OF PROCEDURE:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell >
              <fo:block
                  space-after.optimum="10pt">
                <xsl:value-of select="$procDate"/>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>

        <xsl:if test="$procLocation">
          <fo:table-row>
            <fo:table-cell keep-together="always">
              <fo:block
                  space-after.optimum="10pt">
                <xsl:text>LOCATION:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell >
              <fo:block
                  space-after.optimum="10pt">
                <xsl:value-of select="$procLocation"/>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
        <xsl:if test="$procType">
          <fo:table-row>
            <fo:table-cell keep-together="always">
              <fo:block
                  space-after.optimum="10pt">
                <xsl:text>PROCEDURE:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell >
              <fo:block
                  space-after.optimum="10pt">
                <xsl:choose>
                  <xsl:when test="$procPrintType and $procPrintType != ''">
                    <xsl:value-of select="$procPrintType"/>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="$procType"/>
                  </xsl:otherwise>
                </xsl:choose>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
        <xsl:if test="$preAssess">
          <fo:table-row>
            <fo:table-cell>
              <fo:block
                  space-after.optimum="10pt">
                <xsl:text>PREOPERATIVE DIAGNOSIS:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell >
              <fo:block
                  space-after.optimum="10pt">
                <xsl:value-of select="$preAssess"/>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
        <xsl:if test="$postAssess">
          <fo:table-row>
            <fo:table-cell>
              <fo:block
                  space-after.optimum="10pt">
                <xsl:text>POSTOPERATIVE DIAGNOSIS:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell >
              <fo:block
                  space-after.optimum="10pt">
                <xsl:value-of select="$postAssess"/>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
      </fo:table-body>
    </fo:table>
  </xsl:template>

  <xsl:template match="SurgicalTeam">
    <xsl:variable name="surgeon" select="./Surgeon"/>
    <xsl:variable name="firstAssistant" select="./FirstAssistant"/>
    <xsl:variable name="surgicalTeam" select="./Team"/>
    <fo:table inline-progression-dimension.optimum="5pt" text-align="left"
table-layout="fixed">
      <fo:table-column/>
      <fo:table-column/>
      <fo:table-body>
        <xsl:if test="$surgeon">
          <fo:table-row>
            <fo:table-cell keep-together="always">
              <fo:block
                  space-after.optimum="10pt">
                <xsl:text>SURGEON:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:table inline-progression-dimension.optimum="5pt"
space-after.optimum="10pt" text-align="left" table-layout="fixed">
                <fo:table-column/>
                <fo:table-body>
                    <!--
                    <xsl:variable name="first"
select="./Surgeon/FirstName"/>
                    <xsl:variable name="last" select="./Surgeon/LastName"/>
                    <xsl:variable name="title" select="./Surgeon/Title"/>
                    -->
                    <fo:table-row keep-together="always"
keep-with-next="always">
                      <fo:table-cell>
                        <fo:block>
                          <xsl:value-of select="$surgeon"/>
                          <!--
                          <xsl:value-of select="$first"/>
                          <xsl:text> </xsl:text>
                          <xsl:value-of select="$last"/>
                          <xsl:if test="string-length($title) > 0">,
<xsl:value-of select="$title"/></xsl:if>
                          -->
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
        <xsl:if test="$firstAssistant">
          <fo:table-row>
            <fo:table-cell keep-together="always">
              <fo:block
                  space-after.optimum="10pt">
                <xsl:text>FIRST ASSISTANT:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:table inline-progression-dimension.optimum="5pt"
space-after.optimum="10pt" text-align="left" table-layout="fixed">
                <fo:table-column/>
                <fo:table-body>
                    <!--
                    <xsl:variable name="first"
select="./FirstAssistant/FirstName"/>
                    <xsl:variable name="last"
select="./FirstAssistant/LastName"/>
                    <xsl:variable name="title"
select="./FirstAssistant/Title"/>
                    -->
                    <fo:table-row keep-together="always"
keep-with-next="always">
                      <fo:table-cell>
                        <fo:block>
                          <xsl:value-of select="$firstAssistant"/>
                          <!--
                          <xsl:value-of select="$first"/>
                          <xsl:text> </xsl:text>
                          <xsl:value-of select="$last"/>
                          <xsl:if test="string-length($title) > 0">,
<xsl:value-of select="$title"/></xsl:if>
                          -->
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
        <xsl:if test="$surgicalTeam">
          <fo:table-row>
            <fo:table-cell keep-together="always">
              <fo:block
                  space-after.optimum="10pt">
                <xsl:text>SURGICAL TEAM:</xsl:text>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:table inline-progression-dimension.optimum="5pt"
space-after.optimum="10pt" text-align="left" table-layout="fixed">
                <fo:table-column/>
                <fo:table-body>
                  <xsl:for-each select="./Team/User/Name">
                    <xsl:sort select="LastName" order="ascending"/>
                    <xsl:variable name="first" select="FirstName"/>
                    <xsl:variable name="last" select="LastName"/>
                    <xsl:variable name="title" select="Title"/>
                    <fo:table-row keep-together="always"
keep-with-next="always">
                      <fo:table-cell>
                        <fo:block>
                          <xsl:value-of select="$first"/>
                          <xsl:text> </xsl:text>
                          <xsl:value-of select="$last"/>
                          <xsl:if test="string-length($title) > 0">,
<xsl:value-of select="$title"/></xsl:if>
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                  </xsl:for-each>
                </fo:table-body>
              </fo:table>
            </fo:table-cell>
          </fo:table-row>
        </xsl:if>
      </fo:table-body>
    </fo:table>
  </xsl:template>

  <xsl:template match="Sections">
    <xsl:param name="status"/>
    <!-- Process all column formatted sections first. -->
    <xsl:for-each select="[EMAIL PROTECTED] = 'column']">
      <xsl:variable name="include" select="./@include"/>
      <xsl:if test="$include = 'true'">
        <fo:table inline-progression-dimension.optimum="5pt"
text-align="left" table-layout="fixed">
          <fo:table-column/>
          <fo:table-column/>
          <fo:table-body>
            <fo:table-row>
              <fo:table-cell keep-together="always">
                <fo:block
                    space-after.optimum="10pt">
                  <xsl:value-of select="./Title"/>
                  <xsl:text>:</xsl:text>
                </fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <xsl:apply-templates select="./Subsections">
                  <xsl:with-param name="status" select="$status"/>
                </xsl:apply-templates>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </xsl:if>
    </xsl:for-each>
    <xsl:for-each select="[EMAIL PROTECTED] = 'paragraph']">
      <xsl:variable name="include" select="./@include"/>
      <xsl:if test="$include = 'true'">
        <fo:table inline-progression-dimension.optimum="5pt"
text-align="left" table-layout="fixed" table-omit-header-at-break="false">
          <fo:table-column/>
          <fo:table-header>
            <fo:table-row>
              <fo:table-cell keep-together="always">
                <fo:block>
                  <xsl:value-of select="./Title"/>
                  <xsl:text>:</xsl:text>
                </fo:block>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-header>
          <fo:table-body>
            <fo:table-row>
              <fo:table-cell>
                <xsl:apply-templates select="./Subsections">
                  <xsl:with-param name="status" select="$status"/>
                </xsl:apply-templates>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </xsl:if>
    </xsl:for-each>

  </xsl:template>

  <xsl:template match="Images">
    <fo:table inline-progression-dimension.optimum="5pt" text-align="left"
table-layout="fixed">
      <fo:table-column/>
      <fo:table-column/>
      <fo:table-column/>
      <fo:table-body>
        <xsl:for-each select="Image">
          <!-- computes the position of the element in the tree and
determines wether it is even or odd-->
          <xsl:variable name="pos" select="position() mod 3"/>
          <xsl:if test="$pos!=0 and $pos!=2">
            <!-- creates a row only on every two elements-->
            <fo:table-row keep-together="always" keep-with-next="always">
              <xsl:variable name="image" select="./@imageId"/>
              <xsl:variable name="mimetype" select="./MimeType"/>
              <xsl:variable name="iname" select="./Name"/>
              <xsl:variable name="idate" select="./CreationDate"/>
              <fo:table-cell>
                <xsl:if test="$image">
                  <xsl:variable name="uri" select="concat($servlet, $image,
'&amp;mimetype=', $mimetype)"/>
                  <fo:block>
                    <fo:external-graphic width="2.06in" height="1.53in">
                      <xsl:attribute name="src">
                        <xsl:value-of select="$uri"/>
                      </xsl:attribute>
                    </fo:external-graphic>
                  </fo:block>
                  <fo:block font-size="8pt" font-family="sans-serif"
font-weight="bold" space-after.optimum="10pt">
                    <xsl:value-of select="$iname"/>
                  </fo:block>
                </xsl:if>
              </fo:table-cell>
              <!-- selects the value of the following - even - element -->
              <xsl:variable name="sibling"
select="following-sibling::*[position() = 1]"/>
              <xsl:variable name="image2" select="$sibling/@imageId"/>
              <xsl:variable name="mimetype2" select="$sibling/MimeType"/>
              <xsl:variable name="iname2" select="$sibling/Name"/>
              <xsl:variable name="idate2" select="$sibling/CreationDate"/>
              <fo:table-cell>
                <xsl:if test="$image2">
                  <xsl:variable name="uri2" select="concat($servlet,
$image2, '&amp;mimetype=', $mimetype2)"/>
                  <fo:block>
                    <fo:external-graphic width="2.06in" height="1.53in">
                      <xsl:attribute name="src">
                        <xsl:value-of select="$uri2"/>
                      </xsl:attribute>
                    </fo:external-graphic>
                  </fo:block>
                  <fo:block font-size="8pt" font-family="sans-serif"
font-weight="bold" space-after.optimum="10pt">
                    <xsl:value-of select="$iname2"/>
                  </fo:block>
                </xsl:if>
              </fo:table-cell>
              <xsl:variable name="sibling2"
select="following-sibling::*[position() = 2]"/>
              <xsl:variable name="image3" select="$sibling2/@imageId"/>
              <xsl:variable name="mimetype3" select="$sibling2/MimeType"/>
              <xsl:variable name="iname3" select="$sibling2/Name"/>
              <xsl:variable name="idate3" select="$sibling2/CreationDate"/>
              <fo:table-cell>
                <xsl:if test="$image3">
                  <xsl:variable name="uri3" select="concat($servlet,
$image3, '&amp;mimetype=', $mimetype3)"/>
                  <fo:block>
                    <fo:external-graphic width="2.06in" height="1.53in">
                      <xsl:attribute name="src">
                        <xsl:value-of select="$uri3"/>
                      </xsl:attribute>
                    </fo:external-graphic>
                  </fo:block>
                  <fo:block font-size="8pt" font-family="sans-serif"
font-weight="bold" space-after.optimum="10pt">
                    <xsl:value-of select="$iname3"/>
                  </fo:block>
                </xsl:if>
              </fo:table-cell>
            </fo:table-row>
          </xsl:if>
        </xsl:for-each>
      </fo:table-body>
    </fo:table>
  </xsl:template>

  <xsl:template match="Name">
    <fo:block
        font-size="14pt"
        font-style="oblique"
        font-weight="bold"
        font-family="sans-serif"
        text-align="center">
      <xsl:value-of select="."/>
    </fo:block>
  </xsl:template>

  <xsl:template match="Address">
    <fo:block
        font-size="12pt"
        font-family="sans-serif"
        text-align="center">
      <xsl:value-of select="./Street"/>
    </fo:block>
    <xsl:variable name="city" select="./City"/>
    <xsl:variable name="state" select="./State"/>
    <xsl:if test="string-length($city) > 0 and string-length($state) > 0">
      <fo:block
          font-size="12pt"
          font-family="sans-serif"
          text-align="center">
        <xsl:value-of select="$city"/>, <xsl:value-of
select="$state"/><xsl:text>&#10;</xsl:text><xsl:value-of select="./Zip"/>
      </fo:block>
    </xsl:if>
    <xsl:if test="string-length(./Country) > 0">
      <fo:block
          font-size="12pt"
          font-family="sans-serif"
          text-align="center">
        <xsl:value-of select="./Country"/>
      </fo:block>
    </xsl:if>
  </xsl:template>

  <xsl:template match="Phone">
    <fo:block
        font-size="12pt"
        font-family="sans-serif"
        space-after.optimum="15pt"
        text-align="center">
      <xsl:value-of select="."/>
    </fo:block>
  </xsl:template>


  <xsl:template match="Logo">
    <fo:block
        font-size="14pt"
        font-style="oblique"
        font-weight="bold"
        font-family="sans-serif"
        text-align="left">
      <fo:external-graphic>
        <xsl:attribute name="src">
          <xsl:value-of select="@url"/>
        </xsl:attribute>
      </fo:external-graphic>
    </fo:block>
  </xsl:template>

  <xsl:template match="Signature">
    <xsl:if test="string-length(normalize-space(SignatureValue)) &gt; 0 or
string-length(normalize-space(SignatureProperty/Date)) &gt; 0">
      <fo:list-item>
        <fo:list-item-label>
          <fo:block/>
        </fo:list-item-label>
        <fo:list-item-body start-indent="4in">
          <fo:block
              font-size="12pt"
              text-align="left">
            <fo:leader leader-pattern="rule" leader-length="2.5in"/>
          </fo:block>
        </fo:list-item-body>
      </fo:list-item>
    </xsl:if>
    <fo:list-item>
      <fo:list-item-label>
        <fo:block/>
      </fo:list-item-label>
      <fo:list-item-body start-indent="4in">
        <fo:block
            font-size="12pt"
            text-align="left">
          <xsl:value-of select="./SignatureValue"/>
        </fo:block>
      </fo:list-item-body>
    </fo:list-item>
    <fo:list-item>
      <fo:list-item-label>
        <fo:block/>
      </fo:list-item-label>
      <fo:list-item-body start-indent="4in">
        <fo:block
            font-size="12pt"
            text-align="left">
          <xsl:value-of select="./SignatureProperty/Date"/>
        </fo:block>
      </fo:list-item-body>
    </fo:list-item>
  </xsl:template>

  <xsl:template match="CC">
    <fo:table space-before.optimum="0.5in"
inline-progression-dimension.optimum="5pt" text-align="left"
table-layout="fixed">
      <fo:table-column column-number="1"
column-width="proportional-column-width(10)"/>
      <fo:table-column column-number="2"
column-width="proportional-column-width(90)"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell keep-together="always">
            <fo:block
                font-size="12pt"
                font-family="sans-serif">
              <xsl:text>cc:</xsl:text>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block
                font-size="12pt"
                font-family="sans-serif">
              <xsl:value-of select="."/>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </xsl:template>

  <xsl:template match="Subsections">
    <xsl:param name="status"/>
    <xsl:for-each select="Subsection/Body">
      <fo:block
          space-after.optimum="10pt"
          white-space-collapse="false">
        <xsl:call-template name="substitute">
          <xsl:with-param name="state" select="$status"/>
        </xsl:call-template>
      </fo:block>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>



This electronic transmission is strictly confidential to Smith & Nephew and
intended solely for the addressee.  It may contain information which is
covered by legal, professional or other privilege.  If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy or take any action in reliance on this
transmission.  If you have received this transmission in error, please
notify the sender as soon as possible and destroy this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to