<?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="14.8cm" page-height="10.5cm" margin="0.5cm">
                    <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="8pt">
                        <fo:table table-layout="fixed" width="13.8cm">
                            <fo:table-column column-width="1.8cm"/>
                            <fo:table-column column-width="7cm"/>
                            <fo:table-column column-width="1.5cm"/>
                            <fo:table-column column-width="3.5cm"/>
                            <fo:table-body>

                                <fo:table-row>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>SAAJA ANDMED</fo:block>
                                            <fo:block font-size="6pt">RECEIVER DATA</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-bottom="0.25pt solid #000076" padding="0.05cm 0.5cm" display-align="center">
                                        <fo:block><xsl:value-of select="data/receiver/data"/></fo:block>
                                    </fo:table-cell>
                                    <!-- <fo:table-cell number-columns-spanned="2" number-rows-spanned="2" border="0.25pt solid #000076" padding="0.05cm 0.1cm 0cm 0.1cm"> -->
                                    <fo:table-cell number-columns-spanned="2" number-rows-spanned="2" padding-left="0.1cm">

                                        <fo:block-container border="0.25pt solid #000076">
                                            <fo:block margin="0mm" padding="0.1cm">

                                                <fo:block color="#000076">SAADETISE NR: <xsl:value-of select="data/cargo/barcode"/></fo:block>
                                                <fo:block font-size="6pt" color="#000076">DELIVERY NO</fo:block>

                                            </fo:block>
                                        </fo:block-container>

                                        <fo:block padding-top="0.075cm" font-weight="bold" text-align="right" font-size="26pt"><xsl:value-of select="data/cargo/name"/></fo:block>

                                    </fo:table-cell>
                                </fo:table-row>

                                <fo:table-row>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>LINN</fo:block>
                                            <fo:block font-size="6pt">CITY</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-bottom="0.25pt solid #000076" padding="0.05cm 0.5cm" display-align="center">
                                        <fo:block font-weight="bold"><xsl:value-of select="data/receiver/city"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                                <fo:table-row>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>SAAJA</fo:block>
                                            <fo:block font-size="6pt">RECEIVER</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-columns-spanned="3" border-bottom="0.25pt solid #000076" padding="0.05cm 0.5cm" display-align="center">
                                        <fo:block><xsl:value-of select="data/receiver/name"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                                <fo:table-row>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>AADRESS</fo:block>
                                            <fo:block font-size="6pt">ADDRESS</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-columns-spanned="3" border-bottom="0.25pt solid #000076" padding="0.05cm 0.5cm" display-align="center">
                                        <fo:block><xsl:value-of select="data/receiver/address"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                                <fo:table-row>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>TELEFON</fo:block>
                                            <fo:block font-size="6pt">TELEPHONE</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-bottom="0.25pt solid #000076" padding="0.05cm 0.5cm" display-align="center">
                                        <fo:block><xsl:value-of select="data/receiver/phone"/></fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>E-post</fo:block>
                                            <fo:block font-size="6pt">E-mail</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-bottom="0.25pt solid #000076" padding="0.05cm 0cm" display-align="center">
                                        <fo:block text-align="right"><xsl:value-of select="data/receiver/email"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                                <fo:table-row>
                                    <fo:table-cell number-columns-spanned="4" padding="0.2cm 0" display-align="center">
                                        <fo:block font-size="6pt" font-weight="bold" color="#d92500"><xsl:value-of select="data/cargo/data"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                                <fo:table-row>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>SAATJA ANDMED</fo:block>
                                            <fo:block font-size="6pt">SENDER DATA</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-columns-spanned="3" border-bottom="0.25pt solid #000076" padding="0.05cm 0.5cm" display-align="center">
                                        <fo:block><xsl:value-of select="data/sender/data"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                                <fo:table-row>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>SAATJA</fo:block>
                                            <fo:block font-size="6pt">SENDER</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-columns-spanned="3" border-bottom="0.25pt solid #000076" padding="0.05cm 0.5cm" display-align="center">
                                        <fo:block><xsl:value-of select="data/sender/name"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                                <fo:table-row>
                                    <fo:table-cell padding="0.05cm 0" display-align="center">
                                        <fo:block color="#000076">
                                            <fo:block>AADRESS</fo:block>
                                            <fo:block font-size="6pt">ADDRESS</fo:block>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-columns-spanned="3" border-bottom="0.25pt solid #000076" padding="0.05cm 0.5cm" display-align="center">
                                        <fo:block><xsl:value-of select="data/sender/address"/></fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                            </fo:table-body>
                        </fo:table>
                    </fo:block>

                    <fo:block padding-top="0.05cm" text-align="center">
                        <xsl:variable name="barcode">
                            <xsl:value-of select="data/cargo/barcode"/>
                        </xsl:variable>
                        <fo:instream-foreign-object>
                            <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns" message="{$barcode}">
                                <barcode:code128>
                                    <barcode:module-width>0.5mm</barcode:module-width>
                                    <barcode:height>1.75cm</barcode:height>
                                    <barcode:human-readable>none</barcode:human-readable>
                                </barcode:code128>
                            </barcode:barcode>
                        </fo:instream-foreign-object>
                    </fo:block>

                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>