<?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="A6" page-width="10.5cm" page-height="14.8cm" margin="0.25cm">
                    <fo:region-body/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="A6">
                <fo:flow flow-name="xsl-region-body">
          
                    <fo:block font-family="Helvetica" font-size="10pt">

                        <fo:table table-layout="fixed" width="10cm" margin-bottom="10pt">
                            <fo:table-column column-width="7cm"/>
                            <fo:table-column column-width="3cm"/>
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block>
                                            <fo:external-graphic content-height="scale-to-fit" width="4cm">
                                                <xsl:attribute name="src">
                                                    <xsl:value-of select="data/courier/logo"/>
                                                </xsl:attribute>
                                            </fo:external-graphic>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell text-align="right">
                                        <fo:block font-size="9pt"><xsl:value-of select="data/courier/name"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>

                        <fo:table table-layout="fixed" width="9.5cm" margin-bottom="10pt">
                            <fo:table-column column-width="7cm"/>
                            <fo:table-column column-width="3cm"/>
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block font-weight="bold">DELIVER TO:</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell text-align="right">
                                        <fo:block font-weight="bold">ACCOUNT: ALV</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block><xsl:value-of select="data/delivery/ttl"/></fo:block>
                                        <fo:block><xsl:value-of select="data/delivery/address"/></fo:block>
                                        <fo:block><xsl:value-of select="data/delivery/city"/></fo:block>
                                        <fo:block><xsl:value-of select="data/delivery/country"/></fo:block>
                                        <fo:block><xsl:value-of select="data/delivery/name"/></fo:block>
                                        <fo:block><xsl:value-of select="data/delivery/phone"/></fo:block>
                                        <fo:block><xsl:value-of select="data/delivery/mail"/></fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell display-align="after" text-align="right">
                                        <fo:block font-size="20pt" font-weight="bold">TLL</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>

                        <fo:block border-top="1pt solid #000000" border-bottom="1pt solid #000000" padding-top="5pt" margin-bottom="10pt">
                            <fo:block font-size="12pt" font-weight="bold">DELIVERY INSTRUCTIONS</fo:block>
                            <fo:table table-layout="fixed" width="10cm">
                                <fo:table-column column-width="6cm"/>
                                <fo:table-column column-width="2cm"/>
                                <fo:table-column column-width="2cm"/>
                                <fo:table-body>
                                    <fo:table-row>
                                        <fo:table-cell padding-bottom="2.5pt">
                                            <fo:block></fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell padding-bottom="2.5pt" text-align="right">
                                            <fo:block font-weight="bold"><xsl:value-of select="data/delivery/instructions/count"/></fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell padding-bottom="2.5pt" text-align="right">
                                            <fo:block font-weight="bold"><xsl:value-of select="data/delivery/instructions/weight"/></fo:block>
                                        </fo:table-cell>
                                    </fo:table-row>
                                    <fo:table-row>
                                        <fo:table-cell padding-bottom="2.5pt">
                                            <fo:block padding-right="0.25pt"><xsl:value-of select="data/delivery/instructions/title"/></fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell padding-bottom="2.5pt" text-align="right">
                                            <fo:block><xsl:value-of select="data/delivery/instructions/size"/></fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell padding-bottom="2.5pt" text-align="right">
                                            <fo:block><xsl:value-of select="data/delivery/instructions/price"/></fo:block>
                                        </fo:table-cell>
                                    </fo:table-row>
                                </fo:table-body>
                            </fo:table>
                            <fo:block font-size="20pt" font-weight="bold" text-align="right">ED</fo:block>
                        </fo:block>

                        <fo:table table-layout="fixed" width="10cm">
                            <fo:table-column column-width="7.5cm"/>
                            <fo:table-column column-width="2.5cm"/>
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block>
                                            <xsl:variable name="barcode">
                                                <xsl:value-of select="data/barcode"/>
                                            </xsl:variable>
                                            <fo:instream-foreign-object>
                                                <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns" message="{$barcode}" orientation="0">
                                                    <barcode:code128>
                                                        <barcode:module-width>0.06cm</barcode:module-width>
                                                        <barcode:height>2cm</barcode:height>
                                                    </barcode:code128>
                                                </barcode:barcode>
                                            </fo:instream-foreign-object>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell font-size="7.5pt" font-weight="bold">
                                        <fo:block>***************</fo:block>
                                        <fo:block>Customs</fo:block>
                                        <fo:block>Duties/Taxes</fo:block>
                                        <fo:block>Payable by</fo:block>
                                        <fo:block>Consignee</fo:block>
                                        <fo:block>***************</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>

                        <fo:table table-layout="fixed" width="9.5cm">
                            <fo:table-column column-width="7cm"/>
                            <fo:table-column column-width="3cm"/>
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell font-size="8pt">
                                        <fo:block font-weight="bold">SENDER</fo:block>
                                        <fo:block><xsl:value-of select="data/sender/company"/></fo:block>
                                        <fo:block><xsl:value-of select="data/sender/person"/></fo:block>
                                        <fo:block><xsl:value-of select="data/sender/warehouse"/></fo:block>
                                        <fo:block><xsl:value-of select="data/sender/address"/></fo:block>
                                        <fo:block><xsl:value-of select="data/sender/city"/></fo:block>
                                        <fo:block><xsl:value-of select="data/sender/country"/></fo:block>
                                        <fo:block><xsl:value-of select="data/sender/ph"/></fo:block>
                                        <fo:block><xsl:value-of select="data/sender/ref"/></fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell font-size="6pt" text-align="right">
                                        <fo:block>I/WE AGREE THAT THE CARRIERS STANDARD TERMS AND CONDITIONS APPLY TO THIS SHIPMENT AND LIMIT THE CARRIERS LIABILITY</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>