Variable insertion repeated over and over in footer

Here should go questions about transforming XML with XSLT and FOP.
Posts: 3

Variable insertion repeated over and over in footer

Wed Mar 28, 2018 7:27 pm

I created a custom PDF plugin. One of the customizations inserts a Document ID in the footer of the PDF, using booknumber/bookpartno (for bookmaps) and othermetaname/othermetacontent (for maps).

When we transform a bookmap, the Document ID appears once in each footer, as expected.

When we transform a map, the Document ID repeats over and over again in each footer. It repeats 10 times on the cover page, and 15 times on body pages. How can I fix this?

Code: Select all

<!--  Document ID variable -->
  <xsl:variable name="DocumentID">
    <xsl:variable name="booknumber" select="(/*/opentopic:map//*[contains(@class, ' bookmap/booknumber ')])[1]"/>
    <xsl:variable name="bookpartno" select="(/*/opentopic:map//*[contains(@class, ' bookmap/bookpartno ')])[1]"/>
    <xsl:variable name="othermetaname" select="(/*/opentopic:map//*[contains(@class, ' topic/othermeta ')])/@name"/>
    <xsl:variable name="othermetacontent" select="(/*/opentopic:map//*[contains(@class, ' topic/othermeta ')])/@content"/>
      <xsl:when test="exists($booknumber)">
        <xsl:value-of select="$booknumber"/>
      <xsl:when test="exists($bookpartno)">
        <xsl:value-of select="$bookpartno"/>
      <xsl:when test="exists($othermetaname)">
        <xsl:value-of select="$othermetaname"/>
        <xsl:value-of select="$othermetacontent"/>
        <xsl:call-template name="getVariable">
          <xsl:with-param name="id" select="'DocumentID'"/>

Code: Select all

  <xsl:template name="insertBodyOddFooter">
    <fo:static-content flow-name="odd-body-footer">
      <fo:block xsl:use-attribute-sets="__body__odd__footer__legal">
        <xsl:call-template name="getVariable">
          <xsl:with-param name="id" select="'Body odd footer legal'"/>
          <!--  <xsl:with-param name="params">
                            <fo:inline xsl:use-attribute-sets="__body__odd__footer__heading">
                                <fo:retrieve-marker retrieve-class-name="current-header"/>
                            <fo:inline xsl:use-attribute-sets="__body__odd__footer__pagenum">
                    </xsl:with-param> -->
      <fo:block xsl:use-attribute-sets="__body__odd__footer__addr">
        <xsl:call-template name="getVariable">
          <xsl:with-param name="id" select="'Body odd footer addr'"/>
          <xsl:with-param name="params">
            <!-- Adding Document ID variable -->
              <xsl:value-of select="$DocumentID"/>

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests