xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Calero, Roberto" <roberto.cal...@assirt.com.au>
Subject RE: Writing efficient XSL
Date Thu, 20 Feb 2003 23:27:34 GMT
If your concern is performance I would consider putting all the children  of
<Fund_Row> as attributes of it. Your code is wasting too much processor for
retrieving each children of <Fund_Row>
5 minutes seems to be too much time... if you are using windows, you may
want to start your jvm using "start /high" (i.e start /high java ........) .
 
Let me know how it goes...
 
Cheers!

-----Original Message-----
From: Lee, Insoo [mailto:Insoo.Lee@gs.com]
Sent: Friday, February 21, 2003 10:17 AM
To: 'fop-user@xml.apache.org'
Subject: RE: Writing efficient XSL


 
Hi,
I have something like this
 
<?xml version="1.0" encoding="UTF-8" ?>
  <REPORT>
  <REPORT_NAME>Prior Day Rates</REPORT_NAME>
  <DATE_RANGE>for 19 Feb 2003</DATE_RANGE>
  <REPORT_TAG />
  <DATE_FROM>1 Feb 2003</DATE_FROM>
  <DATE_TO>19 Feb 2003</DATE_TO>
  <CREATED_BY>leeins</CREATED_BY>
  <EXCEL_DATE_FROM>1%20Feb%202003</EXCEL_DATE_FROM>
  <EXCEL_DATE_TO>19%20Feb%202003</EXCEL_DATE_TO>
 
<EXCEL_CREATED_DATE_AND_TIME>Thu%2023%20Jan%202003%203:05:34%20PM%20ET</EXCE
L_CREATED_DATE_AND_TIME>
  <CREATED_DATE_AND_TIME>Thu 23 Jan 2003 3:05:34 PM
ET</CREATED_DATE_AND_TIME>
  <SELECTED_SORT>0</SELECTED_SORT>
  <SELECTED_FUND>ALL</SELECTED_FUND>
  <FUND_GROUP CURRENCY="GBP" STATUS="Active">
  <FUND_ROW>
      <TA_FUND_CODE>GF6</TA_FUND_CODE>
      <LONG_NAME>ILA Treasury Obligations Inst</LONG_NAME>
      <DAILY_FACTOR>0.00002156000</DAILY_FACTOR>
      <SHORT_RATE_365>1.02</SHORT_RATE_365>
      <LONG_RATE_365>1.0449400</LONG_RATE_365>
      <RATE_360>1.0642200</RATE_360>
      <CURR_7_DAY_YIELD>NA</CURR_7_DAY_YIELD>
      <SEVEN_DAY_EFF_YIELD>0.99</SEVEN_DAY_EFF_YIELD>
      <AVG_30_DAY_RATE>1.26</AVG_30_DAY_RATE>
      <PRICE>1.0000</PRICE>
      <RATE_DATE>1 Feb 2003</RATE_DATE>
      <CURRENCY>GBP</CURRENCY>
      <AS_OF_DATE>20 Feb 2003</AS_OF_DATE>
      <PERIODIC_FAMILY_NAME>My Fund</PERIODIC_FAMILY_NAME>
      <ISIN />
      <CUSIP>38XX2B765</CUSIP>
  </FUND_ROW>
....
 
and 1,000 or so FUND_ROW....
Thanks!


-----Original Message-----
From: Calero, Roberto [mailto:roberto.calero@assirt.com.au]
Sent: Thursday, February 20, 2003 5:35 PM
To: 'fop-user@xml.apache.org'
Subject: RE: Writing efficient XSL
Importance: High



How about the data file? 

-----Original Message----- 
From: Lee, Insoo [ mailto:Insoo.Lee@gs.com <mailto:Insoo.Lee@gs.com> ] 
Sent: Friday, February 21, 2003 4:01 AM 
To: fop-user@xml.apache.org 
Subject: Writing efficient XSL 



Could you please take a quick look at my XSL and see where I can improve 
it?... 
I know it's a very vague request, but I would appreciate any comments or 
advice... 
I can generate FO object relative quickly, but when generating 20 pages, it 
takes about 5 minutes.. (Driver.run()) and I think my XSL is not efficiently

written..  I basically have one big table because I need to repeat column 
headings.. people say I need to make smaller tables, but how would I do that

without counting lines to be on one page... (without relying on page header)

Thanks 


<?xml version="1.0"?> 
<xsl:stylesheet version="1.0" 
  xmlns:xsl=" http://www.w3.org/1999/XSL/Transform
<http://www.w3.org/1999/XSL/Transform> " 
  xmlns:fo=" http://www.w3.org/1999/XSL/Format
<http://www.w3.org/1999/XSL/Format> "> 

<xsl:attribute-set name="column-heading"> 
    <xsl:attribute name="font-family">Helvetica</xsl:attribute> 
    <xsl:attribute name="font-weight">bold</xsl:attribute> 
    <xsl:attribute name="font-size">8pt</xsl:attribute> 
    <xsl:attribute name="text-align">left</xsl:attribute> 
</xsl:attribute-set> 

<xsl:attribute-set name="table-content"> 
    <xsl:attribute name="font-family">Helvetica</xsl:attribute> 
    <xsl:attribute name="font-size">8pt</xsl:attribute> 
</xsl:attribute-set> 

<xsl:attribute-set name="table-content-right"> 
    <xsl:attribute name="font-family">Helvetica</xsl:attribute> 
    <xsl:attribute name="font-size">8pt</xsl:attribute> 
    <xsl:attribute name="text-align">right</xsl:attribute> 
</xsl:attribute-set> 

<xsl:attribute-set name="table-content-bold"> 
    <xsl:attribute name="font-family">Helvetica</xsl:attribute> 
    <xsl:attribute name="font-weight">bold</xsl:attribute> 
    <xsl:attribute name="font-size">8pt</xsl:attribute> 
</xsl:attribute-set> 

<xsl:template match="/REPORT"> 
    <fo:root xmlns:fo=" http://www.w3.org/1999/XSL/Format
<http://www.w3.org/1999/XSL/Format> "> 

        <!-- START OF LAYOUT-MASTER-SET --> 
        <fo:layout-master-set> 
            <fo:simple-page-master master-name="anypage" 
                page-width="29.7cm"  
                page-height="21.0cm" 
                margin-top="0.5cm"  
                margin-bottom="0.5cm" 
                margin-left="1.5cm" 
                margin-right="1.5cm"> 
                <fo:region-body 
                    margin-top="0.5cm" 
                    margin-bottom="1.5cm"/> 
                <fo:region-before 
                    extent="0cm"/> 
                <fo:region-after 
                    extent="0.5cm"/> 
            </fo:simple-page-master> 
    
        </fo:layout-master-set> 
            <!-- END OF LAYOUT-MASTER-SET --> 

            <fo:page-sequence master-reference="anypage"> 

                <fo:flow flow-name="xsl-region-body"> 

                    <xsl:apply-templates select="REPORT_NAME"/> 
                    <xsl:apply-templates select="CREATED_BY"/> 

            <xsl:for-each select="FUND_GROUP"> 

                    <fo:table table-omit-header-at-break="false" 
table-layout="fixed"> 

                    <fo:table-header> 

                        <fo:table-row> 
                            <fo:table-cell 
                                border-collapse="collapse" 
                                number-columns-spanned="11"> 

                            <fo:block font-size="12pt" text-align="left" 
                                font-family="Helvetica" 
                                space-after="0pt" font-weight="bold"> 
                                <xsl:choose> 
                                    <xsl:when test="@STATUS!='Single'"> 
                                        <xsl:value-of select="@STATUS"/> 
  
<xsl:text>&#160;</xsl:text><xsl:value-of select="@CURRENCY"/> Funds

                                    </xsl:when> 
                                    <xsl:otherwise> 
                                        Single Fund Report 
                                    </xsl:otherwise> 
                                </xsl:choose> 
                            </fo:block> 
                            </fo:table-cell> 
                        </fo:table-row> 

                        <fo:table-row> 
                            <fo:table-cell 
                                border-collapse="collapse" 
                                space-before="0pt" 
                                number-columns-spanned="11"> 
                               <fo:block> 
                                    <fo:leader leader-length="100%" 
leader-pattern="rule"/> 
                               </fo:block> 
                            </fo:table-cell> 
                        </fo:table-row> 

                        <fo:table-row> 
                            <fo:table-cell display-align="center"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Fund 
                                </fo:block> 
                            </fo:table-cell> 

                            <fo:table-cell display-align="center" 
                                           number-columns-spanned="2"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Date 
                                </fo:block> 
                            </fo:table-cell> 

                            <fo:table-cell display-align="center"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Daily Factor 
                                </fo:block> 
                            </fo:table-cell> 

                     <fo:table-cell display-align="center" 
                                           number-columns-spanned="2"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    1-Day Yield (365 Day Rate) 
                                </fo:block> 

                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    <fo:leader leader-length="85%" 
leader-pattern="rule"/> 
                                </fo:block> 

                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Short 
  
<xsl:text>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;

&#160;&#160;&#160;&#160;&#160;&#160;&#160;</xsl:text> 
                                    Long 
                                </fo:block> 
                            </fo:table-cell> 

                            <fo:table-cell display-align="center"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    360 Day 
                                </fo:block> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Rates 
                                </fo:block> 

                            </fo:table-cell> 

                            <fo:table-cell display-align="center"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    7-Day 
                                </fo:block> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Current 
                                </fo:block> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Yield 
                                </fo:block> 

                            </fo:table-cell> 

                            <fo:table-cell display-align="center"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    7-Day 
                                </fo:block> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Effective 
                                </fo:block> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Yield 
                                </fo:block> 
                            </fo:table-cell> 

                            <fo:table-cell display-align="center"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    30-Day 
                                </fo:block> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    Yield 
                                </fo:block> 
                            </fo:table-cell> 

                            <fo:table-cell display-align="center"> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    NAV<fo:inline vertical-align="super" 
font-size="8pt">1</fo:inline> 
                                </fo:block> 
                                <fo:block 
xsl:use-attribute-sets="column-heading"> 
                                    (<xsl:value-of select="@CURRENCY"/>) 
                                </fo:block> 
                            </fo:table-cell> 
                    </fo:table-row> 

                        <fo:table-row> 
                            <fo:table-cell 
                                border-collapse="collapse" 
                                number-columns-spanned="11" 
                                display-align="before"> 
                               <fo:block space-before="0pt"> 
                                    <fo:leader leader-length="100%" 
leader-pattern="rule"/> 
                               </fo:block> 
                            </fo:table-cell> 
                        </fo:table-row> 

            </fo:table-header> 

            <fo:table-column column-width="70mm"/> 
            <fo:table-column column-width="18mm"/> 
            <fo:table-column column-width="5mm"/> 
            <fo:table-column column-width="35mm"/> 
            <fo:table-column column-width="23mm"/> 
            <fo:table-column column-width="19mm"/> 
            <fo:table-column column-width="17mm"/> 
            <fo:table-column column-width="17mm"/> 
            <fo:table-column column-width="17mm"/> 
            <fo:table-column column-width="17mm"/> 
            <fo:table-column column-width="19mm"/> 

            <fo:table-body> 
                <xsl:call-template name="FUND_GROUP_ROWS"/> 
            </fo:table-body> 

        </fo:table> 
        </xsl:for-each> 
        <!-- End of TALBE 1 : Active EUR --> 


            <xsl:apply-templates select="DISCLAIMER"/> 

        </fo:flow> 

      </fo:page-sequence> 

    </fo:root> 

  </xsl:template> 
  <!-- END OF template REPORT --> 


 <xsl:template match="REPORT_NAME"> 
    <fo:block border-style="solid" 
             border-width=".6mm" 
             text-align="center" 
             font-family="Helvetica" 
             space-after.optimum="5pt" 
             padding-top="5pt" 
             line-height="20pt"> 

       <fo:block font-size="16pt" 
                font-weight="bold" 
            space-after.minimum="2pt"> 
         <xsl:value-of select="."/> 
        </fo:block> 

        <fo:block font-size="9pt" 
            space-before.minimum="0pt"> 
         <xsl:value-of select="/REPORT/DATE_RANGE"/> 
       </fo:block> 

    </fo:block> 
 </xsl:template> 

 <xsl:template match="CREATED_BY"> 
    <fo:block font-family="Helvetica" 
            font-size="9pt" text-align="right" space-after.optimum="10pt"> 
         Created by <xsl:value-of select="."/> 
         on <xsl:value-of select="/REPORT/CREATED_DATE_AND_TIME"/> 
    </fo:block> 
 </xsl:template> 



  <xsl:template name="FUND_GROUP_ROWS"> 

      <xsl:for-each select="FUND_ROW"> 

    <!-- this is just to create a empty line between funds --> 
      <xsl:for-each select="TA_FUND_CODE"> 
    <xsl:choose> 
        <xsl:when test=".=../preceding-sibling::FUND_ROW[1]/TA_FUND_CODE"> 
        </xsl:when> 
        <xsl:otherwise> 
            <fo:table-row> 
                <fo:table-cell 
                    border-collapse="collapse" 
                    number-columns-spanned="11" 
                    display-align="before"> 
                    <fo:block> 
                        <xsl:text>&#160;</xsl:text> 
                    </fo:block> 
                </fo:table-cell> 
            </fo:table-row> 
        </xsl:otherwise> 
    </xsl:choose> 
    </xsl:for-each> 

    <fo:table-row> 

      <xsl:for-each select="TA_FUND_CODE"> 
      <fo:table-cell> 
        <xsl:choose> 
            <xsl:when 
test=".=../preceding-sibling::FUND_ROW[1]/TA_FUND_CODE"> 
            </xsl:when> 
            <xsl:otherwise> 

                <fo:block xsl:use-attribute-sets="table-content-bold"> 
                    <xsl:value-of select="../LONG_NAME"/> - 
                    <xsl:value-of select="."/> 
                </fo:block> 

            </xsl:otherwise> 
        </xsl:choose> 
      </fo:table-cell> 
      </xsl:for-each> 

      <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content-right"> 
            <xsl:value-of select="RATE_DATE"/> 
        </fo:block> 
      </fo:table-cell> 

      <fo:table-cell> 
      </fo:table-cell> 

      <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content"> 
          <xsl:value-of select="DAILY_FACTOR"/> 
        </fo:block> 
      </fo:table-cell> 
      <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content"> 
          <xsl:value-of select="SHORT_RATE_365"/> 
        </fo:block> 
      </fo:table-cell> 
      <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content"> 
          <xsl:value-of select="LONG_RATE_365"/> 
        </fo:block> 
      </fo:table-cell> 
      <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content"> 
            <xsl:value-of select="RATE_360"/> 
        </fo:block> 
      </fo:table-cell> 
      <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content"> 
          <xsl:value-of select="CURR_7_DAY_YIELD"/> 
        </fo:block> 
      </fo:table-cell> 
      <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content"> 
          <xsl:value-of select="SEVEN_DAY_EFF_YIELD"/> 
        </fo:block> 
      </fo:table-cell> 

    <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content"> 
          <xsl:value-of select="AVG_30_DAY_RATE"/> 
        </fo:block> 
      </fo:table-cell> 
      <fo:table-cell> 
        <fo:block xsl:use-attribute-sets="table-content"> 
          <xsl:value-of select="PRICE"/> 
        </fo:block> 
      </fo:table-cell> 
    </fo:table-row> 

    </xsl:for-each> 
  </xsl:template> 
  <!-- ROW_ACTIVE_EUR --> 

 <xsl:template match="DISCLAIMER"> 
    <fo:block font-size="10pt" space-before="3cm"> 
    <fo:inline vertical-align="super" font-size="8pt">+</fo:inline> 
        The investment return and principal value of an investment in a Fund

        will fluctuate and, therefore, an investor's shares when redeemed, 
may be worth 
        more or less than their original cost. Past performance is no 
guarantee of future 
        results which will fluctuate as market conditions change. 
    </fo:block> 

 </xsl:template> 

</xsl:stylesheet> 



--------------------------------------------------------------------- 
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org 
For additional commands, e-mail: fop-user-help@xml.apache.org 

--------------------------------------------------------------------- To
unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org For additional
commands, e-mail: fop-user-help@xml.apache.org 


Mime
View raw message