Loading ...
Sorry, an error occurred while loading the content.

RE: [XSL-FO] Repeating Bookmarks

Expand Messages
  • Prashant Gupta
    Hi Ken, Thanks a lot for the reply. The bookmark processing is not happening inside the invoice processing. I am sending you the XSLT . Any suggestions are
    Message 1 of 3 , Jun 13, 2004
    • 0 Attachment
      Hi Ken,
      Thanks a lot for the reply. The bookmark processing is not happening
      inside the invoice processing.

      I am sending you the XSLT . Any suggestions are welcome.


      Here it is :

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:transform version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
      <xsl:param name="includeData" select="'true'"/>
      <!-- Output XML using UTF-8 encoding -->
      <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

      <xsl:template match="package">


      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
      xmlns:fox="http://xml.apache.org/fop/extensions">

      <!-- defines page layout -->
      <fo:layout-master-set>

      <!-- layout for the first page -->
      <fo:simple-page-master master-name="Invoice"
      page-height="29.7cm"
      page-width="21cm"
      margin-top="1cm"
      margin-bottom="2cm"
      margin-left="1.5cm"
      margin-right="1.5cm">
      <fo:region-body margin-top="1.5cm"/>
      <fo:region-before extent="1.5cm"/>
      <fo:region-after extent="1.5cm"/>

      </fo:simple-page-master>




      <fo:page-sequence-master master-name="InvoicePackaging">
      <fo:single-page-master-reference master-reference="Invoice" />

      </fo:page-sequence-master>

      </fo:layout-master-set>
      <!-- end: defines page layout -->

      <fox:bookmarks>

      <xsl:apply-templates select="invoice" mode="pdfoutline">
      <xsl:sort select="core/building/@name" />
      <xsl:sort select="core/vendor/@name" />
      <xsl:sort select="core/@invoiceNum" />
      </xsl:apply-templates>


      </fox:bookmarks>




      <xsl:apply-templates select="invoice">
      <xsl:sort select="core/building/@name" />
      <xsl:sort select="core/vendor/@name" />
      <xsl:sort select="core/@invoiceNum" />
      <xsl:with-param name="includeDataParam" select="$includeData" />
      </xsl:apply-templates>

      </fo:root>
      </xsl:template>



      <xsl:template match="invoice">



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

      <fo:flow flow-name="xsl-region-body">
      <fo:block-container height="44cm" width="18cm" top="0cm" left="0cm"
      position="absolute">
      <xsl:choose>
      <xsl:when test="$includeData='true'">

      <fo:block font-family="sans-serif" font-size="14pt" text-align="center"
      >
      <fo:inline font-weight="bold" text-decoration="underline"> Invoice
      Detail</fo:inline>
      </fo:block>
      <fo:block>
      <fo:leader leader-alignment="reference-area" leader-pattern="rule"
      leader-pattern-width="10mm" leader-length.maximum="100" />
      </fo:block>

      <xsl:apply-templates select="core"/>
      <xsl:apply-templates select="acctEntry"/>


      </xsl:when>

      <xsl:otherwise>

      </xsl:otherwise>

      </xsl:choose>


      <xsl:apply-templates select="core/image" />

      <fo:block >
      <fo:leader rule-style="solid" rule-thickness="0.1cm"
      leader-alignment="reference-area" leader-pattern="rule"
      leader-pattern-width="5pt" leader-length.maximum="100" />
      </fo:block>

      </fo:block-container>
      </fo:flow>
      </fo:page-sequence>



      </xsl:template>


      <!-- TEMPLATE 1 -->

      <xsl:template match="core">

      <fo:table border-collapse="separate">
      <fo:table-column column-width="100mm"/>
      <fo:table-column column-width="80mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-body>
      <fo:table-row>
      <fo:table-cell background-color="lightgrey" >

      <fo:block font-weight="bold" >

      <xsl:text>Invoice No.:  </xsl:text>
      <fo:inline font-weight="normal"> <xsl:value-of select="@invoiceNum" />
      </fo:inline>

      </fo:block>

      </fo:table-cell>
      <fo:table-cell background-color="lightgrey" ><fo:block
      font-weight="bold"><xsl:text>PO/Job:   </xsl:text>
      <fo:inline font-weight="normal"><xsl:value-of
      select="../acctEntry/@poNumber"/> </fo:inline>

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

      </fo:table-row>
      <fo:table-row>
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold">
      <xsl:text>Invoice Desc.:</xsl:text>

      <fo:inline font-weight="normal">
      <xsl:value-of select="@invoiceDesc" />
      </fo:inline>



      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold" >
      <xsl:text>Acct # /Sub:  </xsl:text>
      <fo:inline font-weight="normal"><xsl:value-of
      select="../acctEntry/@glCodeName"/>
      </fo:inline>

      </fo:block></fo:table-cell>
      </fo:table-row>
      <fo:table-row >
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold"
      ><xsl:text>Priority:  </xsl:text>
      <fo:inline font-weight="normal"><xsl:value-of
      select="@priorityDesc" />
      </fo:inline>
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>APU Number:  </xsl:text>
      <fo:inline font-weight="normal"><xsl:text>None / Unpaid</xsl:text>
      </fo:inline></fo:block></fo:table-cell>
      </fo:table-row>
      <fo:table-row>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold"><xsl:text>Priority Reason:  </xsl:text>
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Workflow:</xsl:text><fo:inline
      font-weight="normal"><xsl:text>WF Name</xsl:text></fo:inline>

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


      <fo:table-row>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Instance:  </xsl:text>

      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Expense Alloc:</xsl:text><fo:inline
      font-weight="normal"><xsl:text>EAT</xsl:text></fo:inline>
      </fo:block></fo:table-cell>
      </fo:table-row>

      <fo:table-row>
      <fo:table-cell background-color="lightgrey">

      <xsl:variable name="bldg"><xsl:value-of select="building/@name"
      /></xsl:variable>

      <fo:block font-weight="bold" id="{$bldg}"><xsl:text>Default
      Bldg:  </xsl:text>
      <fo:inline font-weight="normal"><xsl:value-of
      select="building/@name" /></fo:inline>
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold"
      ><xsl:text>Stubbing:  </xsl:text><fo:inline
      font-weight="normal"><xsl:value-of select="@stubbing" /></fo:inline>
      </fo:block></fo:table-cell>
      </fo:table-row>

      <fo:table-row>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Bank ID:</xsl:text>

      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Receive Date:  </xsl:text><fo:inline
      font-weight="normal"><xsl:value-of select="@receivedDate" /></fo:inline>

      </fo:block></fo:table-cell>
      <!-- commented for now
      <fo:table-cell background-color="lightgrey"><fo:block
      >(120)
      </fo:block></fo:table-cell>
      -->
      </fo:table-row>

      <fo:table-row>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Vendor Ref:</xsl:text>

      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Period Date:  </xsl:text><fo:inline
      font-weight="normal"><xsl:value-of select="@periodDate" /></fo:inline>
      </fo:block></fo:table-cell>
      </fo:table-row>

      <fo:table-row>
      <xsl:variable name="bldg"><xsl:value-of select="building/@name"
      /></xsl:variable>
      <xsl:variable name="vendor"><xsl:value-of select="vendor/@name"
      /></xsl:variable>
      <xsl:variable name="bldg_vendor" select="concat($bldg,$vendor)"/>
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold" id="{$bldg_vendor}"
      ><xsl:text>Vendor:  </xsl:text>

      <fo:inline font-weight="normal"><xsl:value-of
      select="vendor/@name" /></fo:inline></fo:block>
      <fo:block text-indent="4.2em"><fo:inline
      font-weight="normal"><xsl:value-of
      select="vendor/mailingAddress/addrLine/@value" /></fo:inline></fo:block>
      <fo:block text-indent="4.2em"><fo:inline
      font-weight="normal"><xsl:value-of select="vendor/mailingAddress/@city"
      /></fo:inline></fo:block>
      <fo:block text-indent="4.2em"><fo:inline
      font-weight="normal"><xsl:value-of select="vendor/mailingAddress/@state" />
      <xsl:value-of select="vendor/mailingAddress/@postalCode"
      /></fo:inline></fo:block>
      </fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Invoice
      Date:  </xsl:text><fo:inline font-weight="normal"><xsl:value-of
      select="../@date" /></fo:inline></fo:block></fo:table-cell>
      </fo:table-row>

      <fo:table-row>
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold" >
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Due Date:  </xsl:text><fo:inline
      font-weight="normal"><xsl:value-of select="@dueDate" /></fo:inline>
      </fo:block></fo:table-cell>
      </fo:table-row>


      <fo:table-row>
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold" >
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Scheduled
      Date:  </xsl:text><fo:inline font-weight="normal"><xsl:value-of
      select="@scheduleDate" /></fo:inline>
      </fo:block></fo:table-cell>
      </fo:table-row>

      <fo:table-row>
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold" >
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" ><xsl:text>Total:  </xsl:text><fo:inline
      font-weight="normal">$ <xsl:value-of select="@invoiceTotal" /></fo:inline>
      </fo:block></fo:table-cell>
      </fo:table-row>

      <fo:table-row>
      <fo:table-cell background-color="lightgrey">
      <fo:block font-weight="bold" >
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="lightgrey"><fo:block
      font-weight="bold" >
      <xsl:text>Assigned To:  </xsl:text>
      <xsl:for-each select="../revision" >
      <xsl:choose>
      <xsl:when test="boolean(assignment/@party)">
      <fo:block><fo:inline font-weight="normal"><xsl:value-of
      select="assignment/@party" /></fo:inline></fo:block>
      </xsl:when>
      <xsl:otherwise>
      </xsl:otherwise>
      </xsl:choose>
      </xsl:for-each>

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

      <fo:table-row>
      <fo:table-cell background-color="white">
      <fo:block space-before="1.6em" space-after="0.6em" >
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="white">
      <fo:block space-before="1.6em" space-after="0.6em" >

      </fo:block>

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

      <fo:table-row>
      <fo:table-cell background-color="white">
      <fo:block space-before="1.6em" space-after="0.6em" ><xsl:text>Line
      Items:</xsl:text>
      </fo:block></fo:table-cell>
      <fo:table-cell background-color="white">
      <fo:block space-before="1.6em" space-after="0.6em" >
      </fo:block>

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



      </fo:table-body>
      </fo:table>

      <fo:table border-collapse="separate">
      <fo:table-column column-width="10mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-column column-width="45mm"/>
      <fo:table-body>

      <fo:table-row>
      <fo:table-cell background-color="lightgrey">
      <fo:block ><xsl:text>#</xsl:text>
      </fo:block></fo:table-cell>
      <fo:table-cell
      background-color="lightgrey"><fo:block >
      <xsl:text>GL Code</xsl:text>
      </fo:block></fo:table-cell>
      <fo:table-cell
      background-color="lightgrey"><fo:block >
      <xsl:text>Building</xsl:text>
      </fo:block></fo:table-cell>
      <fo:table-cell
      background-color="lightgrey"><fo:block >
      <xsl:text>Gross Amount</xsl:text>
      </fo:block></fo:table-cell>
      <fo:table-cell
      background-color="lightgrey"><fo:block >
      <xsl:text>Net Amount</xsl:text>
      </fo:block></fo:table-cell>
      <fo:table-cell
      background-color="lightgrey"><fo:block >
      <xsl:text>Status</xsl:text>
      </fo:block></fo:table-cell>
      </fo:table-row>
      </fo:table-body>
      </fo:table>



      </xsl:template>




      <xsl:template match="core/image">



      <xsl:variable name="str1"><xsl:value-of select="@src" /></xsl:variable>
      <xsl:variable name="bldg"><xsl:value-of select="../building/@name"
      /></xsl:variable>
      <xsl:variable name="vendor"><xsl:value-of select="../vendor/@name"
      /></xsl:variable>
      <xsl:variable name="invoiceNum"><xsl:value-of select="../@invoiceNum"
      /></xsl:variable>
      <xsl:variable name="bldg_vendor_invoice"
      select="concat($bldg,$vendor,$invoiceNum)"/>

      <fo:block id="{$bldg_vendor_invoice}">
      <fo:external-graphic content-height="24cm" content-width="18cm" src
      = "{$str1}"/>
      </fo:block>

      </xsl:template>










      <xsl:template match="acctEntry">

      <fo:table border-collapse="separate">
      <fo:table-column column-width="10mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-column column-width="40mm"/>
      <fo:table-column column-width="45mm"/>
      <fo:table-body>



      <fo:table-row>

      <fo:table-cell >
      <xsl:variable name="actEntry" select="0" />
      <fo:block ><xsl:number value= "position()"/>
      </fo:block></fo:table-cell>
      <fo:table-cell ><fo:block >
      <xsl:value-of select="@glCodeName" />
      </fo:block></fo:table-cell>
      <fo:table-cell ><fo:block >
      <xsl:value-of select="building/@name" />
      </fo:block></fo:table-cell>
      <fo:table-cell ><fo:block >
      $ <xsl:value-of select="@extendedAmount" />
      </fo:block></fo:table-cell>
      <fo:table-cell ><fo:block >
      $ <xsl:value-of select="@netItemAmount" />
      </fo:block></fo:table-cell>
      <fo:table-cell ><fo:block >
      <xsl:value-of select="@state" />
      </fo:block></fo:table-cell>
      </fo:table-row>


      </fo:table-body>
      </fo:table>






      </xsl:template>


      <!-- START: BOOKMARKS RELATED CODE -->

      <xsl:template match="invoice" mode="pdfoutline">


      <xsl:variable name="bldg"><xsl:value-of select="core/building/@name"
      /></xsl:variable>
      <xsl:variable name="vendor"><xsl:value-of select="core/vendor/@name"
      /></xsl:variable>
      <xsl:variable name="invoiceNo"><xsl:value-of select="core/@invoiceNum"
      /></xsl:variable>
      <xsl:variable name="Build" select="concat($bldg,$vendor,$invoiceNo)"/>


      <fox:outline internal-destination="{$bldg}">
      <fox:label><xsl:value-of select="core/building/@name" /></fox:label>

      <xsl:apply-templates select="../invoice[core/building[@name=$bldg]]"
      mode="pdfoutline2">
      <xsl:sort select="core/vendor/@name" />
      <xsl:sort select="core/@invoiceNum" />
      </xsl:apply-templates>
      </fox:outline>




      </xsl:template>

      <xsl:template match="invoice" mode="pdfoutline2">
      <xsl:variable name="bldg"><xsl:value-of select="core/building/@name"
      /></xsl:variable>
      <xsl:variable name="vendor"><xsl:value-of select="core/vendor/@name"
      /></xsl:variable>
      <xsl:variable name="invoiceNo"><xsl:value-of select="core/@invoiceNum"
      /></xsl:variable>

      <xsl:variable name="bldg_vendor" select="concat($bldg,$vendor)"/>
      <fox:outline internal-destination="{$bldg_vendor}">
      <fox:label><xsl:value-of select="core/vendor/@name" /></fox:label>

      <xsl:apply-templates select="../invoice[core/vendor[@name=$vendor]]"
      mode="pdfoutline3">
      <xsl:sort select="core/@invoiceNum" />
      </xsl:apply-templates>


      </fox:outline>



      </xsl:template>

      <xsl:template match="invoice" mode="pdfoutline3">
      <xsl:variable name="bldg"><xsl:value-of select="core/building/@name"
      /></xsl:variable>
      <xsl:variable name="vendor"><xsl:value-of select="core/vendor/@name"
      /></xsl:variable>
      <xsl:variable name="invoiceNo"><xsl:value-of select="core/@invoiceNum"
      /></xsl:variable>

      <xsl:variable name="bldg_vendor_invoice"
      select="concat($bldg,$vendor,$invoiceNo)"/>
      <fox:outline internal-destination="{$bldg_vendor_invoice}">
      <fox:label><xsl:value-of select="core/@invoiceNum" /></fox:label>
      </fox:outline>

      </xsl:template>

      </xsl:transform>
      -----Original Message-----
      From: G. Ken Holman [mailto:gkholman@...]
      Sent: Friday, June 11, 2004 10:06 PM
      To: XSL-FO@yahoogroups.com
      Subject: Re: [XSL-FO] Repeating Bookmarks


      At 2004-06-11 18:00 +0530, Prashant Gupta wrote:
      >I have a problem in XSL FO. I am getting repeated bookmarks.

      You don't give any of your XSLT to give anyone a chance to point out your
      problem.

      Repetitive output is often the result of either too many
      <xsl:apply-templates/> or inadvertently falling into the built-in template
      rules of XSLT.

      >Now , my problem is that these bookmarks are repeated. So, instead of
      having
      >one set of bookmarks, i get multiple set of bookmarks. And say if there
      are
      >5 page-sequences (one each for the 5 invoices), i get 5 set of bookmarks.

      If your bookmark processing is happening in your invoice processing, then
      that would explain the repetition. Have you moved the bookmark generation
      to the start or end of your stylesheet to do that processing before or
      after you do the invoice processing?

      I hope this helps.

      ...................... Ken

      --
      Public training 3 days XSLT & 2 days XSL-FO: Phoenix,AZ 2004-08-23
      World-wide on-site corporate, govt. & user group XML/XSL training.
      G. Ken Holman mailto:gkholman@...
      Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
      Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
      Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
      Legal business disclaimers: http://www.CraneSoftwrights.com/legal


      Yahoo! Groups Sponsor
      ADVERTISEMENT





      ----------------------------------------------------------------------------
      --
      Yahoo! Groups Links

      a.. To visit your group on the web, go to:
      http://groups.yahoo.com/group/XSL-FO/

      b.. To unsubscribe from this group, send an email to:
      XSL-FO-unsubscribe@yahoogroups.com

      c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.