我正在尝试实现这个示例:http://www.scriptorium.com/whitepapers/xslfo/xslfo_4.html - 为我的环境创建多个页面序列。我转换大数据时得到一个java.lang.OutOfMemoryError。
这是我的xsl文件的一部分:
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:call-template name="LAYOUT"/>
<xsl:choose>
<xsl:when test="ROOT/MEM-STMT/COUNTRY ='MU'">
<fo:page-sequence master-reference="pre-print">
<fo:static-content
flow-name="xsl-region-before-first">
<fo:block>
<xsl:call-template name="HEADER"/>
</fo:block>
</fo:static-content>
<fo:static-content
flow-name="xsl-region-after">
<fo:block text-align="center">
<xsl:call-template name="FOOT"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:choose>
<xsl:when test="ROOT/MEM-STMT/FIN-BAL/FIN-BAMT !='0'">
<fo:block>
<xsl:call-template name="FIN-BAL"/>
</fo:block>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="PROVIDER"/>
<xsl:apply-templates select="MEM-TOTALS"/>
<xsl:apply-templates select="F-OTHER"/>
<xsl:apply-templates select="DUE"/>
<xsl:apply-templates select="REASON"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</xsl:when>
<xsl:otherwise>
<fo:page-sequence master-reference="global">
<fo:static-content
flow-name="xsl-region-before-first">
<fo:block>
<xsl:call-template name="HEADER"/>
</fo:block>
</fo:static-content>
<fo:static-content
flow-name="xsl-region-after">
<fo:block text-align="center">
<xsl:call-template name="FOOT"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<xsl:choose>
<xsl:when test="ROOT/MEM-STMT/FIN-BAL/FIN-BAMT !='0'">
<fo:block>
<xsl:apply-templates select="FIN-BAL"/>
</fo:block>
</xsl:when>
</xsl:choose>
<xsl:if test="count(ancestor::PROV)=4">
<xsl:apply-templates select="PROVIDER"/>
</xsl:if>
<xsl:apply-templates select="MEM-TOTALS"/>
<xsl:apply-templates select="F-OTHER"/>
<xsl:apply-templates select="DUE"/>
<xsl:apply-templates select="REASON"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
<xsl:if test="count(ancestor::PROV) < 4">
<xsl:apply-templates select="PROVIDER" mode="page"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</fo:root>
</xsl:template>
示例xml文件如下所示:
<ROOT>
<MEM-STMT>
<COUNTRY>co</COUNTRY>
<CURRENCY>cu</CURRENCY>
<STMT>
<ST-NO>1</ST-NO>
<ST-DATE>21-JUL-11</ST-DATE>
<CC>21</CC>
<YY>11</YY>
<MM>07</MM>
<DD>21</DD>
</STMT>
<MEM-DET>
<MEM-NO>9</MEM-NO>
<MEM-PROD-LEV>24</MEM-PROD-LEV>
<MEM-OPTION>option</MEM-OPTION>
<MEM-EMP-NO/>
<MEM-EMP-NAME>name</MEM-EMP-NAME>
</MEM-DET>
<MEM-ADDR>
<MEM-NAME>name</MEM-NAME>
<MEM-ADDR1> Addr1</MEM-ADDR1>
<MEM-ADDR2> Addr2</MEM-ADDR2>
<MEM-ADDR3> Addr3</MEM-ADDR3>
<MEM-SUB> Sub</MEM-SUB>
<MEM-CITY> +2</MEM-CITY>
<MEM-REG> Employer:reg</MEM-REG>
<MEM-CNTRY/>
<MEM-PCODE/>
<MEM-EMPCODE/>
</MEM-ADDR>
<ACC>
<PROV>
<PR-NO>1</PR-NO>
<PR-NAME> pr</PR-NAME>
<REF-NO>1</REF-NO>
<CLM>
<REF>1</REF>
<CL-DEP-NO>04</CL-DEP-NO>
<CL-DEP-NAME>dep</CL-DEP-NAME>
<CL-DOS>10-APR-11</CL-DOS>
<CC>21</CC>
<YY>11</YY>
<MM>04</MM>
<DD>10</DD>
<CL-TAR-DRUG-CD>1 </CL-TAR-DRUG-CD>
<CL-TAR-DRUG-DESC>desc </CL-TAR-DRUG-DESC>
<CL-NO>1</CL-NO>
<CL-LINE>2</CL-LINE>
<CL-AMT>16.8</CL-AMT>
<CL-TAR-AMT>16.8</CL-TAR-AMT>
<CL-PAID-PROV>16.8</CL-PAID-PROV>
<CL-PAID-MEM>0</CL-PAID-MEM>
<CL-RSN/>
</CLM>
<CLM>
<REF>1</REF>
<CL-DEP-NO>04</CL-DEP-NO>
<CL-DEP-NAME>dep </CL-DEP-NAME>
<CL-DOS>20-APR-11</CL-DOS>
<CC>21</CC>
<YY>11</YY>
<MM>04</MM>
<DD>20</DD>
<CL-TAR-DRUG-CD>1 </CL-TAR-DRUG-CD>
<CL-TAR-DRUG-DESC>desc </CL-TAR-DRUG-DESC>
<CL-NO>1</CL-NO>
<CL-LINE>2</CL-LINE>
<CL-AMT>50.4</CL-AMT>
<CL-TAR-AMT>50.4</CL-TAR-AMT>
<CL-PAID-PROV>50.4</CL-PAID-PROV>
<CL-PAID-MEM>0</CL-PAID-MEM>
<CL-RSN/>
</CLM>
<TOTALS>
<TOT-AMT>67.2</TOT-AMT>
<TOT-TAR-AMT>67.2</TOT-TAR-AMT>
<TOT-PAID-PROV>67.2</TOT-PAID-PROV>
<TOT-PAID-MEM>0</TOT-PAID-MEM>
</TOTALS>
</PROV>
<PROV>
<PR-NO>2</PR-NO>
<PR-NAME> pr</PR-NAME>
<REF-NO>1</REF-NO>
<CLM>
<REF>1</REF>
<CL-DEP-NO>04</CL-DEP-NO>
<CL-DEP-NAME>dep</CL-DEP-NAME>
<CL-DOS>10-APR-11</CL-DOS>
<CC>21</CC>
<YY>11</YY>
<MM>04</MM>
<DD>10</DD>
<CL-TAR-DRUG-CD>1</CL-TAR-DRUG-CD>
<CL-TAR-DRUG-DESC>desc </CL-TAR-DRUG-DESC>
<CL-NO>1</CL-NO>
<CL-LINE>2</CL-LINE>
<CL-AMT>15</CL-AMT>
<CL-TAR-AMT>0</CL-TAR-AMT>
<CL-PAID-PROV>15</CL-PAID-PROV>
<CL-PAID-MEM>0</CL-PAID-MEM>
<CL-RSN/>
</CLM>
<TOTALS>
<TOT-AMT>15</TOT-AMT>
<TOT-TAR-AMT>0</TOT-TAR-AMT>
<TOT-PAID-PROV>15</TOT-PAID-PROV>
<TOT-PAID-MEM>0</TOT-PAID-MEM>
</TOTALS>
</PROV>
<PROV>
<PR-NO>1</PR-NO>
<PR-NAME> pr</PR-NAME>
<REF-NO>I0428202</REF-NO>
<CLM>
<REF>I0428202</REF>
<CL-DEP-NO>03</CL-DEP-NO>
<CL-DEP-NAME>dep</CL-DEP-NAME>
<CL-DOS>10-APR-11</CL-DOS>
<CC>21</CC>
<YY>11</YY>
<MM>04</MM>
<DD>10</DD>
<CL-TAR-DRUG-CD>2</CL-TAR-DRUG-CD>
<CL-TAR-DRUG-DESC>desc</CL-TAR-DRUG-DESC>
<CL-NO>112153</CL-NO>
<CL-LINE>217615</CL-LINE>
<CL-AMT>31.58</CL-AMT>
<CL-TAR-AMT>0</CL-TAR-AMT>
<CL-PAID-PROV>31.58</CL-PAID-PROV>
<CL-PAID-MEM>0</CL-PAID-MEM>
<CL-RSN/>
</CLM>
<TOTALS>
<TOT-AMT>31.58</TOT-AMT>
<TOT-TAR-AMT>0</TOT-TAR-AMT>
<TOT-PAID-PROV>31.58</TOT-PAID-PROV>
<TOT-PAID-MEM>0</TOT-PAID-MEM>
</TOTALS>
</PROV>
<PROV>
<PR-NO>1</PR-NO>
<PR-NAME> pr</PR-NAME>
<REF-NO>0027579</REF-NO>
<CLM>
<REF>1</REF>
<CL-DEP-NO>04</CL-DEP-NO>
<CL-DEP-NAME>dep</CL-DEP-NAME>
<CL-DOS>09-JUN-11</CL-DOS>
<CC>21</CC>
<YY>11</YY>
<MM>06</MM>
<DD>09</DD>
<CL-TAR-DRUG-CD>99200 </CL-TAR-DRUG-CD>
<CL-TAR-DRUG-DESC>desc</CL-TAR-DRUG-DESC>
<CL-NO>1</CL-NO>
<CL-LINE>1</CL-LINE>
<CL-AMT>12</CL-AMT>
<CL-TAR-AMT>0</CL-TAR-AMT>
<CL-PAID-PROV>12</CL-PAID-PROV>
<CL-PAID-MEM>0</CL-PAID-MEM>
<CL-RSN/>
</CLM>
<TOTALS>
<TOT-AMT>12</TOT-AMT>
<TOT-TAR-AMT>0</TOT-TAR-AMT>
<TOT-PAID-PROV>12</TOT-PAID-PROV>
<TOT-PAID-MEM>0</TOT-PAID-MEM>
</TOTALS>
</PROV>
</ACC>
<RSN-LIST>
<RSN-ERR>????</RSN-ERR>
<RSN-DESC/>
</RSN-LIST>
<FIN-OTHER>
<FIN-DATE/>
<FIN-AMT>0</FIN-AMT>
<FIN-TT/>
</FIN-OTHER>
<GTOTALS>
<GTOT-AMT>125.78</GTOT-AMT>
<GTOT-TAR-AMT>67.2</GTOT-TAR-AMT>
<GTOT-PAID-PROV>125.78</GTOT-PAID-PROV>
<GTOT-PAID-MEM>0</GTOT-PAID-MEM>
</GTOTALS>
<MEM-GTOT>
<M-MESSAGE/>
<M-TOT-PAID-MEM>0</M-TOT-PAID-MEM>
<M-PMT-METH/>
</MEM-GTOT>
<FIN-BAL>
<FIN-BDATE>21-JUL-11</FIN-BDATE>
<FIN-BAMT>0</FIN-BAMT>
<FIN-BTT/>
</FIN-BAL>
</MEM-STMT>
</ROOT>
转换有效,但只创建一页文档。我显然需要这种转换来创建整个文档。