<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
   <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />

   <xsl:template match="application">
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
         <fo:layout-master-set>
            <fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="1cm" margin-right="1cm">
               <fo:region-body />
            </fo:simple-page-master>
         </fo:layout-master-set>

         <fo:page-sequence master-reference="simpleA4">
            <fo:flow flow-name="xsl-region-body">
               <fo:block space-after="10mm" text-align="center">
                  <fo:external-graphic src="{iconUrl}" />
               </fo:block>
               <fo:block font-size="18pt" font-weight="bold" space-after="5mm" background-color="red" color="white"><xsl:value-of select="@name" /></fo:block>
               <fo:block font-size="9pt" space-after="10mm">Version <xsl:value-of select="version" /></fo:block>
               <fo:block font-size="10pt" font-style="italic" space-after="10mm"><xsl:value-of select="longDescription" /></fo:block>
               <fo:block font-size="12pt" font-weight="bold" space-after="5mm">Specifications</fo:block>
               <fo:block font-size="10pt" space-after="140mm">
                  <fo:table table-layout="fixed">
                     <fo:table-column column-width="7cm" />
                     <fo:table-column column-width="10cm" />
                     <fo:table-body>
                        <xsl:apply-templates />
                     </fo:table-body>
                  </fo:table>
               </fo:block>
               <fo:block vertical-align="baseline" font-size="9pt" font-style="italic">Copyright <xsl:value-of select="copyright" /></fo:block>
            </fo:flow>
         </fo:page-sequence>
      </fo:root>
   </xsl:template>

   <xsl:template match="specifications">
      <fo:table-row>
         <fo:table-cell>
            <fo:block>Supported protocols</fo:block>
         </fo:table-cell>
         <fo:table-cell>
            <xsl:for-each select="supportedProtocols/protocol">
               <fo:block>
                  <xsl:value-of select="." />
               </fo:block>
            </xsl:for-each>
         </fo:table-cell>
      </fo:table-row>
      <fo:table-row>
         <fo:table-cell>
            <fo:block>Validation Types</fo:block>
         </fo:table-cell>
         <fo:table-cell>
            <xsl:for-each select="validationTypes/validationType">
               <fo:block>
                  <xsl:value-of select="." />
               </fo:block>
            </xsl:for-each>
         </fo:table-cell>
      </fo:table-row>
      <fo:table-row>
         <fo:table-cell>
            <fo:block>Additional Features</fo:block>
         </fo:table-cell>
         <fo:table-cell>
            <xsl:for-each select="additionalFeatures/feature">
               <fo:block>
                  <xsl:value-of select="." />
               </fo:block>
            </xsl:for-each>
         </fo:table-cell>
      </fo:table-row>
   </xsl:template>
</xsl:stylesheet>