<?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">
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
        <fo:root>
            <fo:layout-master-set>
                <fo:simple-page-master master-name="58x40" page-width="5.8cm" page-height="4cm" margin="0.2cm 0.3cm 0.2cm 0.3cm">
                    <fo:region-body/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="58x40">
                <fo:flow flow-name="xsl-region-body">

                    <fo:block font-family="Helvetica" font-size="8pt">

                        <fo:table table-layout="fixed" width="100%" margin-bottom="6px" border-bottom="2px solid #000000">
                            <fo:table-column column-width="30%"/>
                            <fo:table-column column-width="45%"/>
                            <fo:table-column column-width="25%"/>
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell padding-bottom="4px">
                                        <fo:block>
                                            <fo:inline background-color="#000000" font-weight="bold" color="#ffffff" padding="1px 3px 0 3px">
                                                <xsl:value-of select="data/logo"/>
                                            </fo:inline>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell padding-bottom="4px">
                                        <fo:block font-weight="bold">
                                            <xsl:value-of select="data/delivery/name"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell padding-bottom="4px" text-align="right">
                                        <fo:block>
                                            <xsl:value-of select="data/delivery/type"/>
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>

                        <fo:table table-layout="fixed" width="100%">
                            <fo:table-column column-width="100%"/>
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell height="16pt" line-height="8pt">
                                        <fo:block>
                                            <xsl:value-of select="data/product/name"/>
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row><fo:table-cell height="0.1cm"><fo:block></fo:block></fo:table-cell></fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                      <xsl:variable name="ordnum">
                                        <xsl:value-of select="data/product/ordnum"/>
                                      </xsl:variable>
                                      <fo:block line-height="0.15cm" margin-left="-0.21cm">
                                        <fo:instream-foreign-object height="0.33cm">
                                          <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns" message="{$ordnum}">
                                            <barcode:code128>
                                              <barcode:height>0.7cm</barcode:height>
                                              <barcode:module-width>0.35mm</barcode:module-width>
                                              <barcode:human-readable>none</barcode:human-readable>
                                            </barcode:code128>
                                          </barcode:barcode>
                                        </fo:instream-foreign-object>
                                      </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block padding-top="1px">
                                            <fo:inline background-color="#000000" font-size="9pt" font-weight="bold" color="#ffffff" padding="2px 4px 0 4px">
                                                <xsl:value-of select="data/product/ord"/>
                                            </fo:inline>
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row><fo:table-cell height="0.1cm"><fo:block></fo:block></fo:table-cell></fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                      <xsl:variable name="alnum">
                                        <xsl:value-of select="data/product/alnum"/>
                                      </xsl:variable>
                                      <fo:block line-height="0.15cm" margin-left="-0.21cm">
                                        <fo:instream-foreign-object height="0.33cm">
                                          <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns" message="{$alnum}">
                                            <barcode:code128>
                                              <barcode:height>0.7cm</barcode:height>
                                              <barcode:module-width>0.35mm</barcode:module-width>
                                              <barcode:human-readable>none</barcode:human-readable>
                                            </barcode:code128>
                                          </barcode:barcode>
                                        </fo:instream-foreign-object>
                                      </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block font-weight="bold">
                                            <xsl:value-of select="data/product/al"/>
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row><fo:table-cell height="0.1cm"><fo:block></fo:block></fo:table-cell></fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                      <xsl:variable name="itmnum">
                                        <xsl:value-of select="data/product/itmnum"/>
                                      </xsl:variable>
                                      <fo:block line-height="0.15cm" margin-left="-0.21cm">
                                        <fo:instream-foreign-object height="0.33cm">
                                          <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns" message="{$itmnum}">
                                            <barcode:code128>
                                              <barcode:height>0.7cm</barcode:height>
                                              <barcode:module-width>0.35mm</barcode:module-width>
                                              <barcode:human-readable>none</barcode:human-readable>
                                            </barcode:code128>
                                          </barcode:barcode>
                                        </fo:instream-foreign-object>
                                      </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block padding-top="1px">
                                            <fo:inline background-color="#000000" font-size="9pt" font-weight="bold" color="#ffffff" padding="2px 4px 0 4px">
                                                <xsl:value-of select="data/product/itm"/>
                                            </fo:inline>
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>

                    </fo:block>

                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>
