All,

 

I am new to this mailing list so please forgive any over information.

 

The environment I am working with is the following:

 

Operating System: Red Hat AS4 Upd 4

Development Environment: Cache 2009.1.3, FOP 0.95 and barcode4j-2.0

 

I have been trying to render a PDF file containing a PDF417 2D barcode.
Attached is the "fo" and "xsl" files generated by Cache's Zen reports.  When
the barcode is scanned, the first 41 characters scan fine, but then the data
becomes corrupted.  The data being encoded is a variation of the ASTM
electronic order standard, so the data is a combination of letters, numbers,
vertical bars, carets and a carriage return at the end of each segment.
When the data is just characters, the barcode will scan correctly.  Does
anyone have any idea as to what is causing the data corruption?  Any help
will be greatly appreciated.

 

Thanks in advance,

Donnie Garrett

<?xml version="1.0" encoding='utf-8' ?>
<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:output method='xml' version='1.0' indent='yes' encoding='utf-8'/>
<xsl:attribute-set name='p.banner1'>
	<xsl:attribute name='color'>darkblue</xsl:attribute>
	<xsl:attribute name='font-family'>Arial</xsl:attribute>
	<xsl:attribute name='border-bottom'>1px solid darkblue</xsl:attribute>
	<xsl:attribute name='font-size'>24pt</xsl:attribute>
	<xsl:attribute name='font-weight'>bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='inline.banner1'>
	<xsl:attribute name='color'>darkblue</xsl:attribute>
	<xsl:attribute name='font-family'>Arial</xsl:attribute>
	<xsl:attribute name='border-bottom'>1px solid darkblue</xsl:attribute>
	<xsl:attribute name='font-size'>24pt</xsl:attribute>
	<xsl:attribute name='font-weight'>bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='table.table1'>
	<xsl:attribute name='border'>none</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='th.table1'>
	<xsl:attribute name='text-align'>right</xsl:attribute>
	<xsl:attribute name='font-weight'>bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='td.table1'>
	<xsl:attribute name='text-align'>left</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='table.table2'>
</xsl:attribute-set>
<xsl:attribute-set name='th.table2'>
	<xsl:attribute name='border'>1px solid gray</xsl:attribute>
	<xsl:attribute name='text-align'>left</xsl:attribute>
	<xsl:attribute name='background-color'>#e0e0e0</xsl:attribute>
	<xsl:attribute name='font-weight'>normal</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='td.table2'>
	<xsl:attribute name='font-weight'>bold</xsl:attribute>
	<xsl:attribute name='border'>1px solid gray</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='table.table3'>
    <xsl:attribute name='border'>none</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='th.table3'>
    <xsl:attribute name='border'>none</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
    <xsl:attribute name='font-weight'>bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='td.table3'>
    <xsl:attribute name='border'>none</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
    <xsl:attribute name='font-weight'>normal</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='table.table4'>
    <xsl:attribute name='border'>1px solid gray</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='th.table4'>
    <xsl:attribute name='border'>none</xsl:attribute>
    <xsl:attribute name='color'>white</xsl:attribute>
    <xsl:attribute name='background-color'>#6f6fff</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
    <xsl:attribute name='font-weight'>bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='td.table4'>
    <xsl:attribute name='border'>none</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
    <xsl:attribute name='font-weight'>normal</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='table.table5'>
    <xsl:attribute name='border'>none</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='th.table5'>
    <xsl:attribute name='border'>none</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
    <xsl:attribute name='font-weight'>normal</xsl:attribute>
    <xsl:attribute name='background-color'>#bbbbff</xsl:attribute>
    <xsl:attribute name='border-top'>1.5px solid black</xsl:attribute>
    <xsl:attribute name='border-bottom'>1.5px solid black</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='td.table5'>
    <xsl:attribute name='border'>none</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
    <xsl:attribute name='font-weight'>normal</xsl:attribute>
    <xsl:attribute name='line-height'>150%</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='table.grid'>
    <xsl:attribute name='border'>none</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='th.grid'>
    <xsl:attribute name='border'>1px solid black</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
    <xsl:attribute name='font-weight'>bold</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='td.grid'>
    <xsl:attribute name='border'>1px solid black</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
    <xsl:attribute name='font-weight'>normal</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='table.invisible'>
    <xsl:attribute name='border'>none</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='th.invisible'>
    <xsl:attribute name='border'>none</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name='td.invisible'>
    <xsl:attribute name='border'>none</xsl:attribute>
    <xsl:attribute name='text-align'>left</xsl:attribute>
</xsl:attribute-set>
   <xsl:template match='/BarcodeTest'>
   <fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>
       <fo:layout-master-set>
           <fo:simple-page-master master-name='main'
            margin-right='1.25in'
            margin-left='1.25in'
            margin-top='1in'
            margin-bottom='1in'
            reference-orientation='0'
            page-width='8.5in' page-height='11in'>
             <fo:region-body margin-bottom='0' margin-top='0'/>
       		 <fo:region-before extent='0.0pt' display-align='inherit' />
       		 <fo:region-after extent='0.0pt' display-align='after' />
            </fo:simple-page-master>
       </fo:layout-master-set>
       <fo:page-sequence master-reference='main'>
          <fo:title></fo:title>
<fo:flow flow-name='xsl-region-body'>
  <fo:block>
<fo:inline >
<![CDATA[Barcode Test Report]]>
</fo:inline>
<fo:block><fo:leader leader-pattern='space'/></fo:block>
<fo:block>
  <fo:table table-layout='fixed' >
<xsl:attribute name='width'>4.5in</xsl:attribute>
<fo:table-column column-width='1.5in'/>
<fo:table-column column-width='1in'/>
<fo:table-column column-width='2in'/>
<fo:table-body>
<fo:table-row><fo:table-cell >
<xsl:attribute name='width'>1.5in</xsl:attribute>
<fo:block>
<fo:inline>
<xsl:value-of select='@datetime'/>
</fo:inline>
</fo:block></fo:table-cell>
<fo:table-cell >
<xsl:attribute name='width'>1in</xsl:attribute>
<fo:block>
<fo:inline>
<xsl:value-of select='@SSID'/>
</fo:inline>
</fo:block></fo:table-cell>
<fo:table-cell >
<xsl:attribute name='width'>2in</xsl:attribute>
<fo:block>
<fo:inline >
<xsl:attribute name='width'>2in</xsl:attribute>
<fo:block>
<fo:instream-foreign-object>
<xsl:variable name="bctext" select='@SSID'/>
<barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns";>
<xsl:attribute name="message"><xsl:value-of select='@SSID'/></xsl:attribute>
<barcode:code39>
<barcode:height>8mm</barcode:height>
<barcode:human-readable>none</barcode:human-readable>
</barcode:code39>
</barcode:barcode>
</fo:instream-foreign-object>
</fo:block>
</fo:inline>
</fo:block></fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table></fo:block>
<fo:block><fo:leader leader-pattern='space'/></fo:block>
<fo:block><fo:leader leader-pattern='space'/></fo:block>
<fo:block>
  <fo:table table-layout='fixed' >
<xsl:attribute name='width'>7.5in</xsl:attribute>
<fo:table-column column-width='1in'/>
<fo:table-column column-width='3.5in'/>
<fo:table-column column-width='2in'/>
<fo:table-body>
<fo:table-row><fo:table-cell >
<xsl:attribute name='width'>1in</xsl:attribute>
<fo:block>
<fo:inline>
<xsl:text><![CDATA[ ]]></xsl:text>
</fo:inline>
</fo:block></fo:table-cell>
<fo:table-cell >
<xsl:attribute name='width'>3.5in</xsl:attribute>
<fo:block>
<fo:inline >
<xsl:attribute name='width'>3.5in</xsl:attribute>
<fo:block>
<fo:instream-foreign-object>
<barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns";>
<xsl:attribute name="message"><xsl:value-of select='@data2D'/></xsl:attribute>
<barcode:pdf417>
<barcode:module-width>0.25</barcode:module-width>
<barcode:columns>15</barcode:columns>
<barcode:ec-level>4</barcode:ec-level>
</barcode:pdf417>
</barcode:barcode>
</fo:instream-foreign-object>
</fo:block>
</fo:inline>
</fo:block></fo:table-cell>
<fo:table-cell >
<xsl:attribute name='width'>2in</xsl:attribute>
<fo:block>
<fo:inline>
<xsl:text><![CDATA[ ]]></xsl:text>
</fo:inline>
</fo:block></fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table></fo:block>
  </fo:block>
<fo:block id='%ZENLastPage'/>
</fo:flow>
       </fo:page-sequence>
   </fo:root>
    </xsl:template>

<xsl:template name="break">
  <xsl:param name="text" select="."/>
  <xsl:choose>
    <xsl:when test="contains($text, '&#xA;')">
       <xsl:value-of select="substring-before($text, '&#xA;')"/>
       <fo:block/>
       <xsl:choose>
         <xsl:when test="substring-after($text,'&#xA;')!=$text">
           <xsl:call-template name="break">
             <xsl:with-param name="text" select="substring-after($text,'&#xA;')"/>
           </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
           <xsl:value-of select="$text"/>
         </xsl:otherwise>
       </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$text"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
<xsl:template name="spacebreak">
        <xsl:param name="text" select='.'/>
        <xsl:choose>
            <xsl:when test="contains($text, '&#xA;') or contains($text,'&#x20;')">
                <xsl:choose>
                    <xsl:when test="contains($text,'&#x20;')">
                        <xsl:choose>
                            <xsl:when test="contains(substring-before($text, '&#xA;'),substring-before($text, '&#x20;'))"> <!-- space comes before linefeed -->
                                <xsl:value-of select="substring-before($text, '&#x20;')"/>
                                <xsl:text>&#160;</xsl:text>      
                                <xsl:call-template name="spacebreak">
                                    <xsl:with-param name="text" select="substring-after($text,'&#x20;')"/>
                                </xsl:call-template>
                            </xsl:when>
                            <xsl:otherwise> <!-- space does not come before linefeed -->
                                <xsl:choose>
                                    <xsl:when test="contains($text,'&#x0A;')"> <!-- process linefeed since comes first -->
                                        <xsl:value-of select="substring-before($text, '&#x0A;')"/>
                                        <fo:block/>
                                        <xsl:call-template name="spacebreak">
                                            <xsl:with-param name="text" select="substring-after($text,'&#x0A;')"/>
                                        </xsl:call-template>   
                                     </xsl:when>
                                    <xsl:otherwise>
                                    <xsl:value-of select="substring-before($text, '&#x20;')"/> <!-- space does not come before linefeed and we have space but no linefeed -->
                                    <xsl:text>&#160;</xsl:text>      
                                    <xsl:call-template name="spacebreak">
                                        <xsl:with-param name="text" select="substring-after($text,'&#x20;')"/>
                                    </xsl:call-template>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise> <!-- no spaces in this string -->
                        <xsl:value-of select="substring-before($text, '&#x0A;')"/>
                        <fo:block/>      
                        <xsl:call-template name="spacebreak">
                            <xsl:with-param name="text" select="substring-after($text,'&#x0A;')"/>
                        </xsl:call-template>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:when>
            <xsl:otherwise> <!-- don't contain space or linefeed -->
                <xsl:value-of select="$text"/>
            </xsl:otherwise>
        </xsl:choose>    
    </xsl:template>
    <xsl:template name="space">
  <xsl:param name="text" select="."/>
  <xsl:choose>
    <xsl:when test="contains($text, '&#x20;')">
       <xsl:value-of select="substring-before($text, '&#x20;')"/>
		 <xsl:text>&#160;</xsl:text>       <xsl:choose>
         <xsl:when test="substring-after($text,'&#x20;')!=$text">
           <xsl:call-template name="space">
             <xsl:with-param name="text" select="substring-after($text,'&#x20;')"/>
           </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
           <xsl:value-of select="$text"/>
         </xsl:otherwise>
       </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$text"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

  </xsl:stylesheet>

Attachment: AxHzAEQ.fo
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to