<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xml:lang="sk" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:d = "http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:exsl="http://exslt.org/common"  xmlns:egonp="http://schemas.gov.sk/form/30416094.PRIHLASKA_NA_SKUSKU_ADR_OS_VODIC.sk/2.0" exclude-result-prefixes="d" version="1.0">
  <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">      
		<fo:layout-master-set>
    <fo:simple-page-master master-name="A4"
      page-height="842px" page-width="595px"
      margin-top="10px" margin-bottom="10px"
      margin-left="10px" margin-right="10px">
      <fo:region-body margin-bottom="20mm"/>
      <fo:region-after region-name="footer" extent="10mm"/>
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="document">
      <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference master-reference="A4"/>
      </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
  </fo:layout-master-set>
<fo:page-sequence master-reference="document" font-family="Arial" font-size="0.75em" id="document">
    <fo:static-content flow-name="footer">
      <fo:block text-align="end"><fo:page-number/>/<fo:page-number-citation-last ref-id="document"/></fo:block>
    </fo:static-content>
          <fo:flow flow-name="xsl-region-body">										     				
				<xsl:apply-templates/>
			</fo:flow>
           </fo:page-sequence>
          </fo:root>
         </xsl:template>
		 <xsl:template name="string-replace-all">
            <xsl:param name="text"/>
            <xsl:param name="replace"/>
            <xsl:param name="by"/>
            <xsl:choose>
            <xsl:when test="contains($text, $replace)">
            <xsl:value-of select="substring-before($text,$replace)"/>
            <xsl:value-of select="$by"/>
            <xsl:call-template name="string-replace-all">
            <xsl:with-param name="text" select="substring-after($text,$replace)"/>
            <xsl:with-param name="replace" select="$replace"/>
            <xsl:with-param name="by" select="$by" />
            </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
            <xsl:value-of select="$text"/>
            </xsl:otherwise>
            </xsl:choose>
            </xsl:template>
							<xsl:template match="egonp:RegistrationsForExamsADRDriver">
  <fo:table start-indent="1pt" end-indent="0pt">
    <fo:table-column />
    <fo:table-body>
      <fo:table-row>
        <fo:table-cell>
          <xsl:call-template name="PrvaSekcia" />
          <xsl:call-template name="OsobneUdajeZiadatela" />
          <xsl:call-template name="AdresaTrvalehoBydliskaZiadatela" />
          <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress">
            <xsl:call-template name="KorespodencnaAdresaHelp" />
          </xsl:if>
          <xsl:call-template name="KontaktneInformacie" />
        </fo:table-cell>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
</xsl:template>
<xsl:template name="PrvaSekcia">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column />
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column />
                <fo:table-body>
                  <fo:table-row>
                    <fo:table-cell>
                      <fo:block margin-top="1mm" text-align="center" font-weight="bold" font-size="1.75em">
                        <fo:inline>Prihláška na vykonanie opakovanej skúšky vodiča ADR</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column />
                <fo:table-body>
                  <fo:table-row>
                    <fo:table-cell>
                      <fo:block margin-top="1mm">
                        <fo:inline>&#160;</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="111.80px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Školiaca organizácia</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:TrainingOrganization/egonp:Codelist[egonp:CodelistCode='JISCD0070']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                          <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:TrainingOrganization/egonp:Codelist[egonp:CodelistCode='JISCD0070']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="OsobneUdajeZiadatela">
  <fo:block border-width="0.3pt" border-style="solid" margin-left="1pt" margin-top="6pt" margin-right="1pt">
    <fo:block margin-bottom="6pt">
      <fo:block background-color="black" color="white" margin-left="3pt" margin-top="3pt" margin-right="3pt" padding-left="1pt" padding-top="2pt" keep-with-next.within-page="always" keep-together.within-column="1">
        <fo:block>
          <fo:inline>Osobné údaje žiadateľa</fo:inline>
        </fo:block>
      </fo:block>
      <fo:block color="white" keep-with-next.within-page="always" keep-together.within-column="1">|</fo:block>
      <fo:table>
        <fo:table-column column-width="273.00px" />
        <fo:table-column column-width="286.00px" />
        <fo:table-body>
          <fo:table-row>
            <fo:table-cell>
              <xsl:choose>
                <xsl:when test="not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:PersonName/egonp:GivenName)">
                  <xsl:call-template name="PomMeno" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:for-each select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:PersonName/egonp:GivenName">
                    <xsl:call-template name="PomMeno" />
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
              <xsl:choose>
                <xsl:when test="not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:PersonName/egonp:Affix[@type='qualification' and @position='prefix'])">
                  <xsl:call-template name="PomTitulPred" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:for-each select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:PersonName/egonp:Affix[@type='qualification' and @position='prefix']">
                    <xsl:call-template name="PomTitulPred" />
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
              <fo:block margin-top="3mm">
                <fo:table>
                  <fo:table-column column-width="109.20px" />
                  <fo:table-column column-width="104.00px" />
                  <fo:table-body>
                    <fo:table-row keep-together.within-page="always">
                      <fo:table-cell>
                        <fo:block linefeed-treatment="preserve">
                          <fo:inline>Dátum narodenia</fo:inline>
                        </fo:block>
                      </fo:table-cell>
                      <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                        <fo:block>
                          <xsl:call-template name="formatToSkDate">
                            <xsl:with-param name="date" select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:DateOfBirth" />
                          </xsl:call-template>
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                  </fo:table-body>
                </fo:table>
              </fo:block>
              <fo:block>
                <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']/text()">
                  <fo:block margin-top="3mm">
                    <fo:table>
                      <fo:table-column column-width="109.20px" />
                      <fo:table-column column-width="104.00px" />
                      <fo:table-body>
                        <fo:table-row keep-together.within-page="always">
                          <fo:table-cell>
                            <fo:block linefeed-treatment="preserve">
                              <fo:inline>Miesto narodenia</fo:inline>
                            </fo:block>
                          </fo:table-cell>
                          <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                            <fo:block>
                              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                                <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                              </xsl:if>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:block>
                </xsl:if>
              </fo:block>
              <fo:block>
                <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData/text() or (not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemCode/text()))">
                  <fo:block margin-top="3mm">
                    <fo:table>
                      <fo:table-column column-width="109.20px" />
                      <fo:table-column column-width="104.00px" />
                      <fo:table-body>
                        <fo:table-row keep-together.within-page="always">
                          <fo:table-cell>
                            <fo:block linefeed-treatment="preserve">
                              <fo:inline>Miesto narodenia</fo:inline>
                            </fo:block>
                          </fo:table-cell>
                          <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                            <fo:block>
                              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData">
                                <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Birth/egonp:PlaceOfBirth/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData" />
                              </xsl:if>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:block>
                </xsl:if>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <xsl:choose>
                <xsl:when test="not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:PersonName/egonp:FamilyName)">
                  <xsl:call-template name="PomPriezvisko" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:for-each select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:PersonName/egonp:FamilyName">
                    <xsl:call-template name="PomPriezvisko" />
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
              <xsl:choose>
                <xsl:when test="not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:PersonName/egonp:Affix[@type='qualification' and @position='postfix'])">
                  <xsl:call-template name="PomTitulZa" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:for-each select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:PersonName/egonp:Affix[@type='qualification' and @position='postfix']">
                    <xsl:call-template name="PomTitulZa" />
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
              <fo:block margin-top="3mm">
                <fo:table>
                  <fo:table-column column-width="122.20px" />
                  <fo:table-column column-width="104.00px" />
                  <fo:table-body>
                    <fo:table-row keep-together.within-page="always">
                      <fo:table-cell>
                        <fo:block linefeed-treatment="preserve">
                          <fo:inline>Štátne občianstvo</fo:inline>
                        </fo:block>
                      </fo:table-cell>
                      <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                        <fo:block>
                          <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Citizenship/egonp:Codelist[egonp:CodelistCode='CL000086']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                            <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalPerson/egonp:Citizenship/egonp:Codelist[egonp:CodelistCode='CL000086']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                          </xsl:if>
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                  </fo:table-body>
                </fo:table>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:block>
  </fo:block>
</xsl:template>
<xsl:template name="PomMeno">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column />
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="109.20px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Meno</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="local-name()='GivenName'">
                          <xsl:if test=".">
                            <xsl:value-of select="." />
                          </xsl:if>
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="PomTitulPred">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column />
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="109.20px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Titul pred menom</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="local-name()='Affix'">
                          <xsl:if test="./egonp:Codelist[egonp:CodelistCode='CL000062']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                            <xsl:value-of select="./egonp:Codelist[egonp:CodelistCode='CL000062']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                          </xsl:if>
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="PomPriezvisko">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column />
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="122.20px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Priezvisko</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="local-name()='FamilyName'">
                          <xsl:if test=".">
                            <xsl:value-of select="." />
                          </xsl:if>
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="PomTitulZa">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column />
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="122.20px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Titul za menom</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="local-name()='Affix'">
                          <xsl:if test="./egonp:Codelist[egonp:CodelistCode='CL000063']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                            <xsl:value-of select="./egonp:Codelist[egonp:CodelistCode='CL000063']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                          </xsl:if>
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="AdresaTrvalehoBydliskaZiadatela">
  <fo:block border-width="0.3pt" border-style="solid" margin-left="1pt" margin-top="6pt" margin-right="1pt">
    <fo:block margin-bottom="6pt">
      <fo:block background-color="black" color="white" margin-left="3pt" margin-top="3pt" margin-right="3pt" padding-left="1pt" padding-top="2pt" keep-with-next.within-page="always" keep-together.within-column="1">
        <fo:block>
          <fo:inline>Adresa trvalého bydliska žiadateľa</fo:inline>
        </fo:block>
      </fo:block>
      <fo:block color="white" keep-with-next.within-page="always" keep-together.within-column="1">|</fo:block>
      <fo:table>
        <fo:table-column column-width="273.00px" />
        <fo:table-column column-width="286.00px" />
        <fo:table-body>
          <fo:table-row>
            <fo:table-cell>
              <fo:block margin-top="3mm">
                <fo:table>
                  <fo:table-column column-width="112.45px" />
                  <fo:table-column column-width="104.00px" />
                  <fo:table-body>
                    <fo:table-row keep-together.within-page="always">
                      <fo:table-cell>
                        <fo:block linefeed-treatment="preserve">
                          <fo:inline>Štát</fo:inline>
                        </fo:block>
                      </fo:table-cell>
                      <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                        <fo:block>
                          <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Country/egonp:Codelist[egonp:CodelistCode='CL000086']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                            <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Country/egonp:Codelist[egonp:CodelistCode='CL000086']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                          </xsl:if>
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                  </fo:table-body>
                </fo:table>
              </fo:block>
              <fo:block>
                <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemCode/text()">
                  <fo:block margin-top="3mm">
                    <fo:table>
                      <fo:table-column column-width="112.45px" />
                      <fo:table-column column-width="104.00px" />
                      <fo:table-body>
                        <fo:table-row keep-together.within-page="always">
                          <fo:table-cell>
                            <fo:block linefeed-treatment="preserve">
                              <fo:inline>Okres</fo:inline>
                            </fo:block>
                          </fo:table-cell>
                          <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                            <fo:block>
                              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                                <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                              </xsl:if>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:block>
                </xsl:if>
              </fo:block>
              <fo:block>
                <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:NonCodelistData/text() or (not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:NonCodelistData/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemCode/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemName[@Language='sk']/text()))">
                  <fo:block margin-top="3mm">
                    <fo:table>
                      <fo:table-column column-width="111.15px" />
                      <fo:table-column column-width="104.00px" />
                      <fo:table-body>
                        <fo:table-row keep-together.within-page="always">
                          <fo:table-cell>
                            <fo:block linefeed-treatment="preserve">
                              <fo:inline>Okres</fo:inline>
                            </fo:block>
                          </fo:table-cell>
                          <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                            <fo:block>
                              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:NonCodelistData">
                                <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:County/egonp:NonCodelistData" />
                              </xsl:if>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:block>
                </xsl:if>
              </fo:block>
              <fo:block margin-top="3mm">
                <fo:table>
                  <fo:table-column column-width="112.45px" />
                  <fo:table-column column-width="104.00px" />
                  <fo:table-body>
                    <fo:table-row keep-together.within-page="always">
                      <fo:table-cell>
                        <fo:block linefeed-treatment="preserve">
                          <fo:inline>Ulica</fo:inline>
                        </fo:block>
                      </fo:table-cell>
                      <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                        <fo:block>
                          <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:StreetName">
                            <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:StreetName" />
                          </xsl:if>
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                  </fo:table-body>
                </fo:table>
              </fo:block>
              <fo:block margin-top="3mm">
                <fo:table>
                  <fo:table-column column-width="112.45px" />
                  <fo:table-column column-width="104.00px" />
                  <fo:table-body>
                    <fo:table-row keep-together.within-page="always">
                      <fo:table-cell>
                        <fo:block linefeed-treatment="preserve">
                          <fo:inline>PSČ</fo:inline>
                        </fo:block>
                      </fo:table-cell>
                      <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                        <fo:block>
                          <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:DeliveryAddress/egonp:PostalCode">
                            <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:DeliveryAddress/egonp:PostalCode" />
                          </xsl:if>
                        </fo:block>
                      </fo:table-cell>
                    </fo:table-row>
                  </fo:table-body>
                </fo:table>
              </fo:block>
            </fo:table-cell>
            <fo:table-cell>
              <fo:block>
                <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemCode/text()">
                  <fo:block margin-top="3mm">
                    <fo:table>
                      <fo:table-column column-width="122.20px" />
                      <fo:table-column column-width="104.00px" />
                      <fo:table-body>
                        <fo:table-row keep-together.within-page="always">
                          <fo:table-cell>
                            <fo:block linefeed-treatment="preserve">
                              <fo:inline>Kraj</fo:inline>
                            </fo:block>
                          </fo:table-cell>
                          <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                            <fo:block>
                              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                                <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                              </xsl:if>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:block>
                </xsl:if>
              </fo:block>
              <fo:block>
                <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:NonCodelistData/text() or (not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:NonCodelistData/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemCode/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemName[@Language='sk']/text()))">
                  <fo:block margin-top="3mm">
                    <fo:table>
                      <fo:table-column column-width="122.20px" />
                      <fo:table-column column-width="104.00px" />
                      <fo:table-body>
                        <fo:table-row keep-together.within-page="always">
                          <fo:table-cell>
                            <fo:block linefeed-treatment="preserve">
                              <fo:inline>Kraj</fo:inline>
                            </fo:block>
                          </fo:table-cell>
                          <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                            <fo:block>
                              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:NonCodelistData">
                                <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Region/egonp:NonCodelistData" />
                              </xsl:if>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:block>
                </xsl:if>
              </fo:block>
              <fo:block>
                <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemCode/text()">
                  <fo:block margin-top="3mm">
                    <fo:table>
                      <fo:table-column column-width="122.20px" />
                      <fo:table-column column-width="104.00px" />
                      <fo:table-body>
                        <fo:table-row keep-together.within-page="always">
                          <fo:table-cell>
                            <fo:block linefeed-treatment="preserve">
                              <fo:inline>Obec</fo:inline>
                            </fo:block>
                          </fo:table-cell>
                          <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                            <fo:block>
                              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                                <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                              </xsl:if>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:block>
                </xsl:if>
              </fo:block>
              <fo:block>
                <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData/text() or (not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemCode/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']/text()))">
                  <fo:block margin-top="3mm">
                    <fo:table>
                      <fo:table-column column-width="122.20px" />
                      <fo:table-column column-width="104.00px" />
                      <fo:table-body>
                        <fo:table-row keep-together.within-page="always">
                          <fo:table-cell>
                            <fo:block linefeed-treatment="preserve">
                              <fo:inline>Obec</fo:inline>
                            </fo:block>
                          </fo:table-cell>
                          <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                            <fo:block>
                              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData">
                                <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData" />
                              </xsl:if>
                            </fo:block>
                          </fo:table-cell>
                        </fo:table-row>
                      </fo:table-body>
                    </fo:table>
                  </fo:block>
                </xsl:if>
              </fo:block>
              <xsl:call-template name="PomSupOrientCis" />
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:block>
  </fo:block>
</xsl:template>
<xsl:template name="PomSupOrientCis">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column column-width="172.25px" />
      <fo:table-column column-width="6.50px" />
      <fo:table-column column-width="52.65px" />
      <fo:table-body>
        <fo:table-row keep-together.within-page="always">
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="120.25px" />
                <fo:table-column column-width="45.50px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve" margin-left="0px">
                        <fo:inline>Súpisné / orientačné číslo</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:BuildingNumber">
                          <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:BuildingNumber" />
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="6.50px" />
                <fo:table-body>
                  <fo:table-row>
                    <fo:table-cell>
                      <fo:block margin-top="1mm">
                        <fo:inline>/</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="45.50px" />
                <fo:table-body>
                  <fo:table-row>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:PropertyRegistrationNumber">
                          <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:PhysicalAddress/egonp:PropertyRegistrationNumber" />
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="KorespodencnaAdresaHelp">
  <fo:block border-width="0.3pt" border-style="solid" margin-left="1pt" margin-top="6pt" margin-right="1pt">
    <fo:block margin-bottom="6pt">
      <fo:block background-color="black" color="white" margin-left="3pt" margin-top="3pt" margin-right="3pt" padding-left="1pt" padding-top="2pt" keep-with-next.within-page="always" keep-together.within-column="1">
        <fo:block>
          <fo:inline>Korešpondenčná adresa</fo:inline>
        </fo:block>
      </fo:block>
      <fo:block color="white" keep-with-next.within-page="always" keep-together.within-column="1">|</fo:block>
      <fo:table>
        <fo:table-column />
        <fo:table-body>
          <fo:table-row>
            <fo:table-cell>
              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress">
                <xsl:call-template name="KorespodencnaAdresa" />
              </xsl:if>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:block>
  </fo:block>
</xsl:template>
<xsl:template name="KorespodencnaAdresa">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column column-width="273.00px" />
      <fo:table-column column-width="286.00px" />
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="112.45px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Štát</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Country/egonp:Codelist[egonp:CodelistCode='CL000086']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                          <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Country/egonp:Codelist[egonp:CodelistCode='CL000086']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
            <fo:block>
              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemCode/text()">
                <fo:block margin-top="3mm">
                  <fo:table>
                    <fo:table-column column-width="112.45px" />
                    <fo:table-column column-width="104.00px" />
                    <fo:table-body>
                      <fo:table-row keep-together.within-page="always">
                        <fo:table-cell>
                          <fo:block linefeed-treatment="preserve">
                            <fo:inline>Okres</fo:inline>
                          </fo:block>
                        </fo:table-cell>
                        <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                          <fo:block>
                            <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                              <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                            </xsl:if>
                          </fo:block>
                        </fo:table-cell>
                      </fo:table-row>
                    </fo:table-body>
                  </fo:table>
                </fo:block>
              </xsl:if>
            </fo:block>
            <fo:block>
              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:NonCodelistData/text() or (not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:NonCodelistData/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemCode/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:Codelist[egonp:CodelistCode='CL000024']/egonp:CodelistItem/egonp:ItemName[@Language='sk']/text()))">
                <fo:block margin-top="3mm">
                  <fo:table>
                    <fo:table-column column-width="112.45px" />
                    <fo:table-column column-width="104.00px" />
                    <fo:table-body>
                      <fo:table-row keep-together.within-page="always">
                        <fo:table-cell>
                          <fo:block linefeed-treatment="preserve">
                            <fo:inline>Okres</fo:inline>
                          </fo:block>
                        </fo:table-cell>
                        <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                          <fo:block>
                            <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:NonCodelistData">
                              <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:County/egonp:NonCodelistData" />
                            </xsl:if>
                          </fo:block>
                        </fo:table-cell>
                      </fo:table-row>
                    </fo:table-body>
                  </fo:table>
                </fo:block>
              </xsl:if>
            </fo:block>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="112.45px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Ulica</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:StreetName">
                          <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:StreetName" />
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="112.45px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>PSČ</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:DeliveryAddress/egonp:PostalCode">
                          <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:DeliveryAddress/egonp:PostalCode" />
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block>
              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemCode/text()">
                <fo:block margin-top="3mm">
                  <fo:table>
                    <fo:table-column column-width="122.20px" />
                    <fo:table-column column-width="104.00px" />
                    <fo:table-body>
                      <fo:table-row keep-together.within-page="always">
                        <fo:table-cell>
                          <fo:block linefeed-treatment="preserve">
                            <fo:inline>Kraj</fo:inline>
                          </fo:block>
                        </fo:table-cell>
                        <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                          <fo:block>
                            <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                              <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                            </xsl:if>
                          </fo:block>
                        </fo:table-cell>
                      </fo:table-row>
                    </fo:table-body>
                  </fo:table>
                </fo:block>
              </xsl:if>
            </fo:block>
            <fo:block>
              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:NonCodelistData/text() or (not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:NonCodelistData/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemCode/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:Codelist[egonp:CodelistCode='CL000023']/egonp:CodelistItem/egonp:ItemName[@Language='sk']/text()))">
                <fo:block margin-top="3mm">
                  <fo:table>
                    <fo:table-column column-width="122.20px" />
                    <fo:table-column column-width="104.00px" />
                    <fo:table-body>
                      <fo:table-row keep-together.within-page="always">
                        <fo:table-cell>
                          <fo:block linefeed-treatment="preserve">
                            <fo:inline>Kraj</fo:inline>
                          </fo:block>
                        </fo:table-cell>
                        <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                          <fo:block>
                            <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:NonCodelistData">
                              <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Region/egonp:NonCodelistData" />
                            </xsl:if>
                          </fo:block>
                        </fo:table-cell>
                      </fo:table-row>
                    </fo:table-body>
                  </fo:table>
                </fo:block>
              </xsl:if>
            </fo:block>
            <fo:block>
              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemCode/text()">
                <fo:block margin-top="3mm">
                  <fo:table>
                    <fo:table-column column-width="122.20px" />
                    <fo:table-column column-width="104.00px" />
                    <fo:table-body>
                      <fo:table-row keep-together.within-page="always">
                        <fo:table-cell>
                          <fo:block linefeed-treatment="preserve">
                            <fo:inline>Obec</fo:inline>
                          </fo:block>
                        </fo:table-cell>
                        <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                          <fo:block>
                            <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                              <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                            </xsl:if>
                          </fo:block>
                        </fo:table-cell>
                      </fo:table-row>
                    </fo:table-body>
                  </fo:table>
                </fo:block>
              </xsl:if>
            </fo:block>
            <fo:block>
              <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData/text() or (not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemCode/text())and not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:Codelist[egonp:CodelistCode='CL000025']/egonp:CodelistItem/egonp:ItemName[@Language='sk']/text()))">
                <fo:block margin-top="3mm">
                  <fo:table>
                    <fo:table-column column-width="122.20px" />
                    <fo:table-column column-width="104.00px" />
                    <fo:table-body>
                      <fo:table-row keep-together.within-page="always">
                        <fo:table-cell>
                          <fo:block linefeed-treatment="preserve">
                            <fo:inline>Obec</fo:inline>
                          </fo:block>
                        </fo:table-cell>
                        <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                          <fo:block>
                            <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData">
                              <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:Municipality/egonp:NonCodelistData" />
                            </xsl:if>
                          </fo:block>
                        </fo:table-cell>
                      </fo:table-row>
                    </fo:table-body>
                  </fo:table>
                </fo:block>
              </xsl:if>
            </fo:block>
            <xsl:call-template name="PomSupOrientCis2" />
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="PomSupOrientCis2">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column column-width="173.55px" />
      <fo:table-column column-width="6.50px" />
      <fo:table-column column-width="52.65px" />
      <fo:table-body>
        <fo:table-row keep-together.within-page="always">
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="121.55px" />
                <fo:table-column column-width="45.50px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve" margin-left="0px">
                        <fo:inline>Súpisné / orientačné číslo</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:BuildingNumber">
                          <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:BuildingNumber" />
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="6.50px" />
                <fo:table-body>
                  <fo:table-row>
                    <fo:table-cell>
                      <fo:block margin-top="1mm">
                        <fo:inline>/</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="45.50px" />
                <fo:table-body>
                  <fo:table-row>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:PropertyRegistrationNumber">
                          <xsl:value-of select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:MailingAddress/egonp:PhysicalAddress/egonp:PropertyRegistrationNumber" />
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="KontaktneInformacie">
  <fo:block border-width="0.3pt" border-style="solid" margin-left="1pt" margin-top="6pt" margin-right="1pt">
    <fo:block margin-bottom="6pt">
      <fo:block background-color="black" color="white" margin-left="3pt" margin-top="3pt" margin-right="3pt" padding-left="1pt" padding-top="2pt" keep-with-next.within-page="always" keep-together.within-column="1">
        <fo:block>
          <fo:inline>Kontaktné informácie</fo:inline>
        </fo:block>
      </fo:block>
      <fo:block color="white" keep-with-next.within-page="always" keep-together.within-column="1">|</fo:block>
      <fo:table>
        <fo:table-column />
        <fo:table-body>
          <fo:table-row>
            <fo:table-cell>
              <xsl:choose>
                <xsl:when test="not(/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:TelephoneAddress)">
                  <xsl:call-template name="Telefon" />
                </xsl:when>
                <xsl:otherwise>
                  <xsl:for-each select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:TelephoneAddress">
                    <xsl:call-template name="Telefon" />
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
              <xsl:call-template name="EmailWeb" />
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:block>
  </fo:block>
</xsl:template>
<xsl:template name="Telefon">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column column-width="273.00px" />
      <fo:table-column column-width="286.00px" />
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="112.45px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Typ telefónu</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="local-name()='TelephoneAddress'">
                          <xsl:if test="./egonp:TelephoneType/egonp:Codelist[egonp:CodelistCode='12']/egonp:CodelistItem/egonp:ItemName[@Language='sk']">
                            <xsl:value-of select="./egonp:TelephoneType/egonp:Codelist[egonp:CodelistCode='12']/egonp:CodelistItem/egonp:ItemName[@Language='sk']" />
                          </xsl:if>
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="122.20px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Číslo</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:if test="local-name()='TelephoneAddress'">
                          <xsl:if test="./egonp:Number/egonp:FormattedNumber">
                            <xsl:value-of select="./egonp:Number/egonp:FormattedNumber" />
                          </xsl:if>
                        </xsl:if>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
<xsl:template name="EmailWeb">
  <fo:block margin-bottom="6pt">
    <fo:table start-indent="1pt" end-indent="0pt">
      <fo:table-column column-width="273.00px" />
      <fo:table-column column-width="286.00px" />
      <fo:table-body>
        <fo:table-row keep-together.within-page="always">
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="112.45px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>E-mail</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:call-template name="formatAnyUri">
                          <xsl:with-param name="anyUri" select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:InternetAddress[contains(egonp:Address,'@')]/egonp:Address" />
                        </xsl:call-template>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
          <fo:table-cell>
            <fo:block margin-top="3mm">
              <fo:table>
                <fo:table-column column-width="122.20px" />
                <fo:table-column column-width="104.00px" />
                <fo:table-body>
                  <fo:table-row keep-together.within-page="always">
                    <fo:table-cell>
                      <fo:block linefeed-treatment="preserve">
                        <fo:inline>Web</fo:inline>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell border-width="0.6pt" border-style="solid" background-color="white" padding="1pt" block-progression-dimension.minimum="10px">
                      <fo:block>
                        <xsl:call-template name="formatAnyUri">
                          <xsl:with-param name="anyUri" select="/egonp:RegistrationsForExamsADRDriver/egonp:Applicant/egonp:PersonData/egonp:InternetAddress[not(contains(egonp:Address,'@'))]/egonp:Address" />
                        </xsl:call-template>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row>
                </fo:table-body>
              </fo:table>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </fo:block>
</xsl:template>
	

<xsl:template name="intersperse-with-zero-spaces">
<xsl:param name="str"/>
<xsl:variable name="spacechars">
	&#x9;&#xA;
	&#x2000;&#x2001;&#x2002;&#x2003;&#x2004;&#x2005;
	&#x2006;&#x2007;&#x2008;&#x2009;&#x200A;&#x200B;
</xsl:variable>

<xsl:if test="string-length($str) &gt; 0">
	<xsl:variable name="c1" select="substring($str, 1, 1)"/>

	<xsl:value-of select="$c1"/>
	<xsl:if test="$c1 != '' and not(contains($spacechars, $c1))">
		<xsl:text>&#x200B;</xsl:text>
	</xsl:if>

	<xsl:call-template name="intersperse-with-zero-spaces">
		<xsl:with-param name="str" select="substring($str, 2)"/>
	</xsl:call-template>
</xsl:if>
</xsl:template> 

<xsl:template name="formatAnyUri">
<xsl:param name="anyUri" />
<xsl:variable name="anyUriString" select="string($anyUri)" />
<xsl:variable name="anyUriSubString">
<xsl:choose>
<xsl:when test="$anyUriString != '' and contains($anyUriString, 'mailto:') and contains($anyUriString, '@')">
<xsl:value-of select="substring($anyUriString, 8, string-length($anyUriString))" />
</xsl:when>
<xsl:when test="$anyUriString != '' and contains($anyUriString, 'http://')">
<xsl:value-of select="substring($anyUriString, 8, string-length($anyUriString))" />
</xsl:when>
<xsl:when test="$anyUriString != '' and contains($anyUriString, 'https://')">
<xsl:value-of select="substring($anyUriString, 9, string-length($anyUriString))" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$anyUriString"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$anyUriSubString"/>
</xsl:template>

<xsl:template name="formatToSkDate">
<xsl:param name="date" />
<xsl:variable name="dateString" select="string($date)" />
<xsl:choose>
<xsl:when test="$dateString != '' and string-length($dateString)=10 and string(number(substring($dateString, 1, 4))) != 'NaN' ">
<xsl:value-of select="concat(substring($dateString, 9, 2), '.', substring($dateString, 6, 2), '.', substring($dateString, 1, 4))" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$dateString"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="formatTimeTrimMinutes">
<xsl:param name="time" />
<xsl:variable name="timeString" select="string($time)" />
<xsl:if test="$timeString != ''">
<xsl:value-of select="substring($timeString, 1, 5)" />
</xsl:if>
</xsl:template>

<xsl:template name="formatToSkDateTime">
<xsl:param name="dateTime" />
<xsl:variable name="dateSubstring" select="substring($dateTime, 1, 10)" />
<xsl:variable name="timeSubstring" select="substring($dateTime, 12, 8)" />
<xsl:variable name="dateString">
<xsl:choose>
<xsl:when test="$dateSubstring != '' and string-length($dateSubstring)=10 and string(number(substring($dateSubstring, 1, 4))) != 'NaN' ">
<xsl:value-of select="concat(substring($dateSubstring, 9, 2), '.', substring($dateSubstring, 6, 2), '.', substring($dateSubstring, 1, 4))" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$dateSubstring"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="timeString">
<xsl:if test="$timeSubstring != ''">
<xsl:value-of select="substring($timeSubstring, 1, 5)" />
</xsl:if>
</xsl:variable>
<xsl:value-of select="concat($dateString,' ',$timeString)"/>
</xsl:template>

<xsl:template name="booleanToSkString">
<xsl:param name="boolValue" />
<xsl:variable name="boolValueString" select="string($boolValue)" />
<xsl:choose>
<xsl:when test="$boolValueString = 'true' ">
<xsl:text>Áno</xsl:text>
</xsl:when>
<xsl:when test="$boolValueString = '1' ">
<xsl:text>Áno</xsl:text>
</xsl:when>
<xsl:when test="$boolValueString = 'false' ">
<xsl:text>Nie</xsl:text>
</xsl:when>
<xsl:when test="$boolValueString = '0' ">
<xsl:text>Nie</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$boolValueString"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
