<?xml version=“1.0” encoding=“UTF-8”?><xsl:stylesheet xmlns:xsl=“www.w3.org/1999/XSL/Transform” xmlns:fo=“www.w3.org/1999/XSL/Format” xmlns:m3d=“www.metanorma.org/ns/m3d” xmlns:mathml=“www.w3.org/1998/Math/MathML” xmlns:xalan=“xml.apache.org/xalan” xmlns:fox=“xmlgraphics.apache.org/fop/extensions” version=“1.0”>

  <xsl:output method="xml" encoding="UTF-8" indent="no"/>

  <xsl:param name="svg_images"/>
  <xsl:variable name="images" select="document($svg_images)"/>

  <xsl:key name="kfn" match="m3d:p/m3d:fn" use="@reference"/>

  <xsl:variable name="debug">true</xsl:variable>
  <xsl:variable name="pageWidth" select="'215.9mm'"/>
  <xsl:variable name="pageHeight" select="'279.4mm'"/>

  <xsl:variable name="title-en" select="/m3d:m3d-standard/m3d:bibdata/m3d:title[@language = 'en']"/>
  <!-- Example:
          <item level="1" id="Foreword" display="true">Foreword</item>
          <item id="term-script" display="false">3.2</item>
  -->
  <xsl:variable name="contents">
          <contents>
                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:preface/node()" mode="contents"/>

                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:sections/m3d:clause[1]" mode="contents"> <!-- [@id = '_scope'] -->
                          <xsl:with-param name="sectionNum" select="'1'"/>
                  </xsl:apply-templates>
                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:bibliography/m3d:references[1]" mode="contents"> <!-- [@id = '_normative_references'] -->
                          <xsl:with-param name="sectionNum" select="'2'"/>
                  </xsl:apply-templates>
                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:sections/*[position() &gt; 1]" mode="contents"> <!-- @id != '_scope' -->
                          <xsl:with-param name="sectionNumSkew" select="'1'"/>
                  </xsl:apply-templates>
                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:annex" mode="contents"/>
                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:bibliography/m3d:references[position() &gt; 1]" mode="contents"/> <!-- @id = '_bibliography' -->

                  <xsl:apply-templates select="//m3d:figure" mode="contents"/>

                  <xsl:apply-templates select="//m3d:table" mode="contents"/>
          </contents>
  </xsl:variable>

  <xsl:variable name="lang">
          <xsl:call-template name="getLang"/>
  </xsl:variable>

  <xsl:template match="/">
          <xsl:message>INFO: Document namespace: '<xsl:value-of select="namespace-uri(/*)"/>'</xsl:message>
          <fo:root font-family="Garamond" font-size="12pt" xml:lang="{$lang}">
                  <fo:layout-master-set>

                          <!-- cover page -->
                          <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
                                  <fo:region-body margin-top="31mm" margin-bottom="32mm" margin-left="17.3mm" margin-right="22mm"/>
                                  <fo:region-before region-name="cover-header" extent="31mm"/>
                                  <fo:region-after region-name="cover-footer" extent="32mm"/>
                                  <fo:region-start region-name="cover-left-region" extent="17.3mm"/>
                                  <fo:region-end region-name="cover-right-region" extent="22mm"/>
                          </fo:simple-page-master>

                          <!-- contents pages -->                         
                          <fo:simple-page-master master-name="page" page-width="{$pageWidth}" page-height="{$pageHeight}">
                                  <fo:region-body margin-top="20mm" margin-bottom="23mm" margin-left="17.3mm" margin-right="17.3mm"/>
                                  <fo:region-before region-name="header" extent="35mm"/>
                                  <fo:region-after region-name="footer" extent="23mm"/>
                                  <fo:region-start region-name="left-region" extent="17.3mm"/>
                                  <fo:region-end region-name="right-region" extent="17.3mm"/>
                          </fo:simple-page-master>

                          <fo:simple-page-master master-name="last" page-width="{$pageWidth}" page-height="{$pageHeight}">
                                  <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="17.3mm" margin-right="17.3mm"/>
                                  <fo:region-before region-name="header" extent="35mm"/>
                                  <fo:region-after region-name="footer-last" extent="53mm"/>
                                  <fo:region-start region-name="left-region" extent="17.3mm"/>
                                  <fo:region-end region-name="right-region" extent="17.3mm"/>
                          </fo:simple-page-master>

                          <fo:page-sequence-master master-name="document">
                                  <fo:repeatable-page-master-alternatives>
                                          <fo:conditional-page-master-reference page-position="first" master-reference="cover"/>
                                          <fo:conditional-page-master-reference page-position="last" master-reference="last"/>
                                          <fo:conditional-page-master-reference page-position="any" master-reference="page"/>
                                  </fo:repeatable-page-master-alternatives>
                          </fo:page-sequence-master>

                  </fo:layout-master-set>

                  <fo:declarations>
                          <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
                                          <pdf:dictionary type="normal" key="ViewerPreferences">
                                                  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
                                          </pdf:dictionary>
                                  </pdf:catalog>
                          <x:xmpmeta xmlns:x="adobe:ns:meta/">
                                  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
                                          <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
                                          <!-- Dublin Core properties go here -->
                                                  <dc:title><xsl:value-of select="/m3d:m3d-standard/m3d:bibdata/m3d:title"/> </dc:title>
                                                  <dc:creator><xsl:value-of select="/m3d:m3d-standard/m3d:bibdata/m3d:contributor[m3d:role/@type='author']/m3d:organization/m3d:name"/></dc:creator>
                                                  <dc:description>
                                                          <xsl:variable name="abstract">
                                                                  <xsl:text> </xsl:text>
                                                          </xsl:variable>
                                                          <xsl:value-of select="normalize-space($abstract)"/>
                                                  </dc:description>
                                                  <pdf:Keywords>
                                                          <xsl:call-template name="insertKeywords"/>
                                                  </pdf:Keywords>
                                          </rdf:Description>
                                          <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
                                                  <!-- XMP properties go here -->
                                                  <xmp:CreatorTool/>
                                          </rdf:Description>
                                  </rdf:RDF>
                          </x:xmpmeta>
                  </fo:declarations>

                  <fo:page-sequence master-reference="document" force-page-count="no-force">

                          <fo:static-content flow-name="cover-header">
                                  <fo:block-container height="18mm" border-bottom="0.5pt solid red">
                                          <fo:block-container height="100%" display-align="after">
                                                  <fo:block margin-bottom="-1mm">
                                                          <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-M3AAWG-Logo))}" width="85.4mm" content-height="11mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image M3AAWG Logo"/>
                                                  </fo:block>
                                          </fo:block-container>
                                  </fo:block-container>
                          </fo:static-content>
                          <fo:static-content flow-name="cover-footer">
                                  <fo:block-container height="31mm" border-top="0.5pt solid red" font-family="Arial" text-align="center">
                                                  <fo:block font-size="12pt" font-weight="bold" color="rgb(51, 169, 207)" margin-top="2mm">
                                                          <fo:inline>M<fo:inline font-size="8pt" vertical-align="super">3</fo:inline>AAWG</fo:inline>
                                                  </fo:block>
                                                  <fo:block font-size="9pt">
                                                          <xsl:value-of select="/m3d:m3d-standard/m3d:bibdata/m3d:contributor[m3d:role/@type='author']/m3d:organization/m3d:name"/>
                                                          <xsl:value-of select="$linebreak"/>
                                                          <fo:inline>781 Beach Street, Suite 302</fo:inline>
                                                          <fo:inline font-size="11pt" color="rgb(51, 169, 207)" baseline-shift="5%" padding-left="1mm" padding-right="1mm">■</fo:inline>
                                                          <fo:inline>San Francisco, California 94109 U.S.A.</fo:inline>
                                                          <fo:inline font-size="11pt" color="rgb(51, 169, 207)" baseline-shift="5%" padding-left="1mm" padding-right="1mm">■</fo:inline>
                                                          <fo:inline color="blue" text-decoration="underline">www.m3aawg.org</fo:inline>
                                                  </fo:block>
                                  </fo:block-container>
                          </fo:static-content>
                          <fo:static-content flow-name="footer">
                                  <fo:block-container height="31mm" font-size="10pt">
                                          <fo:block text-align-last="justify" margin-top="2mm">
                                                  <fo:inline font-weight="bold">
                                                          <fo:inline>M<fo:inline font-size="6.5pt" vertical-align="super">3</fo:inline>AAWG </fo:inline>
                                                          <xsl:value-of select="$title-en"/>                                                              
                                                  </fo:inline>
                                                  <fo:leader font-weight="normal" leader-pattern="space"/>
                                                  <fo:inline font-size="9pt"><fo:page-number/></fo:inline>
                                          </fo:block>
                                  </fo:block-container>                           
                          </fo:static-content>

                          <fo:static-content flow-name="footer-last">
                                  <fo:block-container height="53mm" border-top="0.5pt solid rgb(103, 141, 207)" display-align="after">
                                          <fo:block-container padding-bottom="16mm">
                                                  <fo:block text-align="justify">
                                                          <fo:inline>As with all M3AAWG documents that we publish, please check the M3AAWG website (<fo:inline color="blue" text-decoration="underline">www.m3aawg.org</fo:inline>) for updates to this paper.</fo:inline>
                                                  </fo:block>
                                                  <fo:block> </fo:block>
                                                  <fo:block> </fo:block>                                          
                                                  <fo:block>
                                                          <xsl:text>© </xsl:text>
                                                          <xsl:value-of select="/m3d:m3d-standard/m3d:bibdata/m3d:copyright/m3d:from"/>
                                                          <xsl:text> copyright by the </xsl:text>
                                                          <xsl:value-of select="/m3d:m3d-standard/m3d:bibdata/m3d:copyright/m3d:owner/m3d:organization/m3d:name"/>
                                                          <xsl:text> (</xsl:text>
                                                          <xsl:value-of select="/m3d:m3d-standard/m3d:bibdata/m3d:copyright/m3d:owner/m3d:organization/m3d:abbreviation"/>
                                                          <xsl:text>)</xsl:text>                                                  
                                                  </fo:block>
                                                  <fo:block font-size="10pt">
                                                          <fo:block text-align-last="justify" margin-top="2mm">
                                                                  <fo:inline font-weight="bold">
                                                                          <fo:inline>M<fo:inline font-size="6.5pt" vertical-align="super">3</fo:inline>AAWG </fo:inline>
                                                                          <xsl:value-of select="$title-en"/>                                                              
                                                                  </fo:inline>
                                                                  <fo:leader font-weight="normal" leader-pattern="space"/>
                                                                  <fo:inline font-size="9pt"><fo:page-number/></fo:inline>
                                                          </fo:block>
                                                  </fo:block>
                                          </fo:block-container>
                                  </fo:block-container>
                          </fo:static-content>

                          <fo:flow flow-name="xsl-region-body">
                                  <fo:block-container font-weight="bold" text-align="center">
                                          <!-- Messaging, Malware and Mobile Anti-Abuse Working Group -->
                                          <fo:block font-size="16pt">
                                                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:boilerplate/m3d:feedback-statement/m3d:p[@id = 'boilerplate-name']/node()"/>
                                          </fo:block>
                                          <!-- M 3 AAWG Companion Document:  
                                                  Recipes for Encrypting  
                                                  DNS Stub Resolver-to-Recursive Resolver Traffic  -->                                            
                                          <fo:block font-size="22pt" margin-top="16pt">
                                                  <fo:inline border-bottom="1pt solid black">
                                                                  <fo:inline>M</fo:inline><fo:inline font-size="13pt" vertical-align="super">3</fo:inline><fo:inline>AAWG Companion Document: </fo:inline>
                                                  </fo:inline>
                                          </fo:block>

                                          <fo:block font-size="22pt" margin-bottom="12pt">
                                                  <xsl:value-of select="$title-en"/>
                                          </fo:block>
                                          <!-- Version 1.0  -->
                                          <fo:block font-size="12pt" margin-bottom="6pt">
                                                  <xsl:text>Version: </xsl:text>
                                                  <xsl:variable name="edition" select="/m3d:m3d-standard/m3d:bibdata/m3d:edition"/>
                                                  <xsl:choose>
                                                          <xsl:when test="contains($edition, '.')">
                                                                  <xsl:value-of select="$edition"/>
                                                          </xsl:when>
                                                          <xsl:otherwise>
                                                                  <xsl:value-of select="$edition"/><xsl:text>.0</xsl:text>
                                                          </xsl:otherwise>
                                                  </xsl:choose>
                                          </fo:block>
                                          <fo:block font-size="12pt" margin-bottom="12pt">
                                                  <xsl:call-template name="convertDate">
                                                          <xsl:with-param name="date" select="/m3d:m3d-standard/m3d:bibdata/m3d:version/m3d:revision-date"/>
                                                  </xsl:call-template>
                                          </fo:block>
                                  </fo:block-container>

                                  <fo:block-container font-size="12pt">
                                          <fo:block text-align="center" font-weight="normal" margin-bottom="10pt">
                                                  <xsl:text>The direct URL to this paper is:  </xsl:text><fo:inline color="blue" text-decoration="underline">www.m3aawg.org/dns-crypto-recipes</fo:inline>
                                          </fo:block>
                                          <fo:block margin-bottom="10pt">This document is intended to accompany and complement the companion document, “M<fo:inline font-size="7pt" vertical-align="super">3</fo:inline> AAWG Tutorial  on Third Party Recursive Resolvers and Encrypting DNS Stub Resolver-to-Recursive Resolver Traffic” 
                                                          (<fo:inline color="blue" text-decoration="underline">www.m3aawg.org/dns-crypto-tutorial</fo:inline>). 
                                          </fo:block>
                                          <fo:block margin-bottom="12pt">This document was produced by the M<fo:inline font-size="7pt" vertical-align="super">3</fo:inline> AAWG Data and Identity Protection Committee. </fo:block>
                                  </fo:block-container>

                                  <xsl:if test="$debug = 'true'">
                                          <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
                                                  DEBUG
                                                  contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
                                          <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
                                  </xsl:if>

                                  <!-- Table of content -->
                                  <fo:block-container>
                                          <fo:block font-size="12pt" font-weight="bold" text-decoration="underline" margin-bottom="4pt">Table of Contents</fo:block>
                                          <fo:table table-layout="fixed" width="100%" font-size="10pt">
                                                  <fo:table-column column-width="25mm"/>
                                                  <fo:table-column column-width="155mm"/>
                                                  <fo:table-body>
                                                          <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->                                                      
                                                                  <fo:table-row height="6mm">
                                                                          <fo:table-cell>
                                                                                  <fo:block font-weight="bold">
                                                                                          <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
                                                                                                  <xsl:choose>
                                                                                                          <xsl:when test="@section = '0'">
                                                                                                                  <xsl:value-of select="text()"/>
                                                                                                          </xsl:when>
                                                                                                          <xsl:when test="@type = 'references' and @section = ''">
                                                                                                                  <xsl:value-of select="text()"/>
                                                                                                          </xsl:when>
                                                                                                          <xsl:when test="@level = 1">
                                                                                                                  <xsl:value-of select="@section"/>
                                                                                                          </xsl:when>
                                                                                                          <xsl:otherwise/>
                                                                                                  </xsl:choose>
                                                                                          </fo:basic-link>
                                                                                  </fo:block>
                                                                          </fo:table-cell>
                                                                          <fo:table-cell>
                                                                                  <fo:block text-align-last="justify">
                                                                                          <xsl:if test="@level = 1">
                                                                                                  <xsl:attribute name="font-weight">bold</xsl:attribute>
                                                                                          </xsl:if>
                                                                                          <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
                                                                                                  <xsl:choose>
                                                                                                          <xsl:when test="@section = '0'"/>
                                                                                                          <xsl:when test="@type = 'references' and @section = ''"/>
                                                                                                          <xsl:otherwise>
                                                                                                                  <xsl:value-of select="text()"/>
                                                                                                          </xsl:otherwise>
                                                                                                  </xsl:choose>
                                                                                                  <fo:inline keep-together.within-line="always">
                                                                                                          <fo:leader font-weight="normal" leader-pattern="dots"/>
                                                                                                          <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
                                                                                                  </fo:inline>
                                                                                          </fo:basic-link>
                                                                                  </fo:block>
                                                                          </fo:table-cell>
                                                                  </fo:table-row>
                                                          </xsl:for-each>
                                                  </fo:table-body>
                                          </fo:table>
                                  </fo:block-container>

                                  <fo:block break-after="page"/>

                                  <fo:block>
                                          <xsl:apply-templates select="/m3d:m3d-standard/m3d:boilerplate"/>
                                  </fo:block>

                                  <!-- Foreword, Introduction -->
                                  <fo:block>
                                          <xsl:apply-templates select="/m3d:m3d-standard/m3d:preface/node()"/>
                                  </fo:block>

                                  <fo:block break-after="page"/>

                                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:sections/m3d:clause[1]"> <!-- Scope -->
                                          <xsl:with-param name="sectionNum" select="'1'"/>
                                  </xsl:apply-templates>

                                  <!-- Normative references  -->
                                  <xsl:if test="/m3d:m3d-standard/m3d:bibliography/m3d:references[1]">
                                          <fo:block break-after="page"/>
                                          <xsl:apply-templates select="/m3d:m3d-standard/m3d:bibliography/m3d:references[1]">
                                                  <xsl:with-param name="sectionNum" select="'2'"/>
                                          </xsl:apply-templates>
                                  </xsl:if>

                                  <!-- Main sections -->
                                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:sections/*[position() &gt; 1]">
                                          <xsl:with-param name="sectionNumSkew" select="'1'"/>
                                  </xsl:apply-templates>

                                  <!-- Annex(s) -->
                                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:annex"/>

                                  <!-- Bibliography -->
                                  <xsl:apply-templates select="/m3d:m3d-standard/m3d:bibliography/m3d:references[position() &gt; 1]"/>

                          </fo:flow>
                  </fo:page-sequence>

          </fo:root>
  </xsl:template> 

  <xsl:template match="m3d:boilerplate//m3d:p">
          <fo:block font-size="11pt" margin-bottom="12pt">
                  <xsl:apply-templates/>
          </fo:block>
  </xsl:template>

  <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
  <xsl:template match="node()">
          <xsl:param name="sectionNum"/>
          <xsl:param name="sectionNumSkew"/>
          <xsl:apply-templates>
                  <xsl:with-param name="sectionNum" select="$sectionNum"/>
                  <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
          </xsl:apply-templates>
  </xsl:template>

  <!-- ============================= -->
  <!-- CONTENTS                                       -->
  <!-- ============================= -->
  <xsl:template match="node()" mode="contents">
          <xsl:param name="sectionNum"/>
          <xsl:param name="sectionNumSkew"/>
          <xsl:apply-templates mode="contents">
                  <xsl:with-param name="sectionNum" select="$sectionNum"/>
                  <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
          </xsl:apply-templates>
  </xsl:template>

  <!-- calculate main section number (1,2,3) and pass it deep into templates -->
  <!-- it's necessary, because there is itu:bibliography/itu:references from other section, but numbering should be sequental -->
  <xsl:template match="m3d:m3d-standard/m3d:sections/*" mode="contents">
          <xsl:param name="sectionNum"/>
          <xsl:param name="sectionNumSkew" select="0"/>
          <xsl:variable name="sectionNum_">
                  <xsl:choose>
                          <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
                          <xsl:when test="$sectionNumSkew != 0">
                                  <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!-- m3d:sections/m3d:clause | m3d:sections/m3d:terms -->
                                  <xsl:value-of select="$number + $sectionNumSkew"/>
                          </xsl:when>
                          <xsl:otherwise>
                                  <xsl:number count="*"/>
                          </xsl:otherwise>
                  </xsl:choose>
          </xsl:variable>
          <xsl:apply-templates mode="contents">
                  <xsl:with-param name="sectionNum" select="$sectionNum_"/>
          </xsl:apply-templates>
  </xsl:template>

  <!-- Any node with title element - clause, definition, annex,... -->
  <xsl:template match="m3d:title | m3d:preferred" mode="contents">
          <xsl:param name="sectionNum"/>
          <!-- sectionNum=<xsl:value-of select="$sectionNum"/> -->
          <xsl:variable name="id">
                  <xsl:call-template name="getId"/>
          </xsl:variable>

          <xsl:variable name="level">
                  <xsl:call-template name="getLevel"/>
          </xsl:variable>

          <xsl:variable name="section">
                  <xsl:call-template name="getSection">
                          <xsl:with-param name="sectionNum" select="$sectionNum"/>
                  </xsl:call-template>
          </xsl:variable>

          <xsl:variable name="display">
                  <xsl:choose>
                          <xsl:when test="ancestor::m3d:bibitem">false</xsl:when>
                          <xsl:when test="ancestor::m3d:term">false</xsl:when>
                          <xsl:when test="ancestor::m3d:annex and $level &gt;= 3">false</xsl:when>
                          <xsl:when test="$level &lt;= 3">true</xsl:when>
                          <xsl:otherwise>false</xsl:otherwise>
                  </xsl:choose>
          </xsl:variable>

          <xsl:variable name="display-section">true</xsl:variable>

          <xsl:variable name="type">
                  <xsl:value-of select="local-name(..)"/>
          </xsl:variable>

          <xsl:variable name="root">
                  <xsl:choose>
                          <xsl:when test="ancestor::m3d:annex">annex</xsl:when>
                  </xsl:choose>
          </xsl:variable>

          <item id="{$id}" level="{$level}" section="{$section}" display-section="{$display-section}" display="{$display}" type="{$type}" root="{$root}">
                  <xsl:attribute name="addon">
                          <xsl:if test="local-name(..) = 'annex'">

                                  <xsl:variable name="obligation" select="../@obligation"/>
                                  <xsl:value-of select="$obligation"/>

                          </xsl:if>
                  </xsl:attribute>
                  <xsl:value-of select="."/>
          </item>

          <xsl:apply-templates mode="contents">
                  <xsl:with-param name="sectionNum" select="$sectionNum"/>
          </xsl:apply-templates>

  </xsl:template>

  <xsl:template match="m3d:figure" mode="contents">
          <item level="" id="{@id}" display="false">
                  <xsl:attribute name="section">
                          <xsl:call-template name="getFigureNumber"/>
                  </xsl:attribute>
          </item>
  </xsl:template>

  <xsl:template match="m3d:table" mode="contents">
          <xsl:param name="sectionNum"/>
          <xsl:variable name="annex-id" select="ancestor::m3d:annex/@id"/>
          <item level="" id="{@id}" display="false" type="table">
                  <xsl:attribute name="section">
                          <xsl:value-of select="$title-table"/>
                          <xsl:choose>
                                  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
                                                  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
                                          </xsl:when>
                                  <xsl:when test="ancestor::*[local-name()='annex']">
                                          <xsl:number format="A-" count="m3d:annex"/>
                                          <xsl:number format="1" level="any" count="m3d:table[ancestor::m3d:annex[@id = $annex-id]]"/>
                                  </xsl:when>
                                  <xsl:otherwise>
                                          <!-- <xsl:number format="1"/> -->
                                          <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table']"/>
                                  </xsl:otherwise>
                          </xsl:choose>
                  </xsl:attribute>
                  <xsl:value-of select="m3d:name/text()"/>
          </item>
  </xsl:template>

  <xsl:template match="m3d:formula" mode="contents">
          <item level="" id="{@id}" display="false">
                  <xsl:attribute name="section">
                          <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="m3d:annex | m3d:formula"/><xsl:text>)</xsl:text>
                  </xsl:attribute>
          </item>
  </xsl:template>

  <xsl:template match="m3d:li" mode="contents">
          <xsl:param name="sectionNum"/>
          <item level="" id="{@id}" display="false" type="li">
                  <xsl:attribute name="section">
                          <xsl:call-template name="getListItemFormat"/>
                  </xsl:attribute>
                  <xsl:attribute name="parent_section">
                          <xsl:for-each select="ancestor::*[not(local-name() = 'p' or local-name() = 'ol')][1]">
                                  <xsl:call-template name="getSection">
                                          <xsl:with-param name="sectionNum" select="$sectionNum"/>
                                  </xsl:call-template>
                          </xsl:for-each>
                  </xsl:attribute>
          </item>
          <xsl:apply-templates mode="contents">
                  <xsl:with-param name="sectionNum" select="$sectionNum"/>
          </xsl:apply-templates>
  </xsl:template>

  <xsl:template name="getListItemFormat">
          <xsl:choose>
                  <xsl:when test="local-name(..) = 'ul'">•</xsl:when> <!-- &#x2014; dash -->
                  <xsl:otherwise> <!-- for ordered lists -->
                          <xsl:choose>
                                  <xsl:when test="../@type = 'arabic'">
                                          <xsl:number format="a)"/>
                                  </xsl:when>
                                  <xsl:when test="../@type = 'alphabet'">
                                          <xsl:number format="1)"/>
                                  </xsl:when>
                                  <xsl:otherwise>
                                          <xsl:number format="1."/>
                                  </xsl:otherwise>
                          </xsl:choose>
                  </xsl:otherwise>
          </xsl:choose>
  </xsl:template>

  <!-- ============================= -->
  <!-- ============================= -->

  <!-- Foreword, Introduction -->
  <xsl:template match="m3d:m3d-standard/m3d:preface/*">
          <fo:block break-after="page"/>
          <xsl:apply-templates/>
  </xsl:template>

  <!-- clause, terms, clause, ...-->
  <xsl:template match="m3d:m3d-standard/m3d:sections/*">
          <xsl:param name="sectionNum"/>
          <xsl:param name="sectionNumSkew" select="0"/>
          <fo:block break-after="page"/>
          <fo:block>
                  <xsl:variable name="pos"><xsl:number count="m3d:sections/m3d:clause | m3d:sections/m3d:terms"/></xsl:variable>
                  <xsl:if test="$pos &gt;= 2">
                          <xsl:attribute name="space-before">18pt</xsl:attribute>
                  </xsl:if>
                  <!-- pos=<xsl:value-of select="$pos" /> -->
                  <xsl:variable name="sectionNum_">
                          <xsl:choose>
                                  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
                                  <xsl:when test="$sectionNumSkew != 0">
                                          <xsl:variable name="number"><xsl:number count="m3d:sections/m3d:clause | m3d:sections/m3d:terms"/></xsl:variable>
                                          <xsl:value-of select="$number + $sectionNumSkew"/>
                                  </xsl:when>
                          </xsl:choose>
                  </xsl:variable>
                  <xsl:if test="not(m3d:title)">
                          <fo:block margin-top="3pt" margin-bottom="12pt">
                                  <xsl:value-of select="$sectionNum_"/><xsl:number format=".1 " level="multiple" count="m3d:clause"/>
                          </fo:block>
                  </xsl:if>
                  <xsl:apply-templates>
                          <xsl:with-param name="sectionNum" select="$sectionNum_"/>
                  </xsl:apply-templates>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:clause//m3d:clause[not(m3d:title)]">
          <xsl:param name="sectionNum"/>
          <xsl:variable name="section">
                  <xsl:call-template name="getSection">
                          <xsl:with-param name="sectionNum" select="$sectionNum"/>
                  </xsl:call-template>
          </xsl:variable>
          <fo:block margin-top="6pt" margin-bottom="6pt" keep-with-next="always">
                  <fo:inline>
                          <xsl:value-of select="$section"/><!-- <xsl:text>.</xsl:text> -->
                  </fo:inline>                    
          </fo:block>
          <xsl:apply-templates>
                  <xsl:with-param name="sectionNum" select="$sectionNum"/>
          </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="m3d:title">
          <xsl:param name="sectionNum"/>

          <xsl:variable name="parent-name" select="local-name(..)"/>
          <xsl:variable name="references_num_current">
                  <xsl:number level="any" count="m3d:references"/>
          </xsl:variable>

          <xsl:variable name="id">
                  <xsl:call-template name="getId"/>
          </xsl:variable>

          <xsl:variable name="level">
                  <xsl:call-template name="getLevel"/>
          </xsl:variable>

          <xsl:variable name="section">
                  <xsl:call-template name="getSection">
                          <xsl:with-param name="sectionNum" select="$sectionNum"/>
                  </xsl:call-template>
          </xsl:variable>

          <xsl:variable name="font-size">
                  <xsl:choose>
                          <xsl:when test="ancestor::m3d:preface">14pt</xsl:when>
                          <xsl:when test="$level = 1">14pt</xsl:when>
                          <!-- <xsl:when test="@level = 2">12pt</xsl:when> -->
                          <xsl:otherwise>12pt</xsl:otherwise>
                  </xsl:choose>
          </xsl:variable>

          <xsl:variable name="element-name">
                  <xsl:choose>
                          <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
                          <xsl:otherwise>fo:block</xsl:otherwise>
                  </xsl:choose>
          </xsl:variable>

          <xsl:choose>
                  <xsl:when test="ancestor::m3d:boilerplate">
                          <fo:block id="{$id}" font-size="14pt" font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="15.5pt" keep-with-next="always">
                                  <xsl:apply-templates/>
                          </fo:block>
                  </xsl:when>
                  <xsl:when test="$parent-name = 'annex'">
                          <fo:block id="{$id}" font-size="{$font-size}" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always">
                                  <xsl:value-of select="$section"/>
                                  <xsl:if test=" ../@obligation">
                                          <xsl:value-of select="$linebreak"/>
                                          <fo:inline font-weight="normal">
                                                  <xsl:text>(</xsl:text>
                                                  <xsl:variable name="obligation" select="../@obligation"/>
                                                  <xsl:value-of select="$obligation"/>

                                                  <xsl:text>)</xsl:text>
                                          </fo:inline>
                                  </xsl:if>
                                  <fo:block margin-top="14pt" margin-bottom="24pt"><xsl:apply-templates/></fo:block>
                          </fo:block>
                  </xsl:when>
                   <!-- Bibliography -->
                  <!-- <xsl:when test="$parent-name = 'references' and $references_num_current != 1">
                          <fo:block id="{$id}" text-align="center" margin-top="6pt" margin-bottom="16pt" keep-with-next="always">
                                  <xsl:apply-templates />
                          </fo:block>
                  </xsl:when> -->

                  <xsl:otherwise>
                          <xsl:element name="{$element-name}">
                                  <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
                                  <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
                                  <xsl:attribute name="font-weight">bold</xsl:attribute>
                                  <xsl:attribute name="margin-top">
                                          <xsl:choose>
                                                  <xsl:when test="ancestor::m3d:preface">8pt</xsl:when>
                                                  <xsl:when test="$level = 2 and ancestor::m3d:annex">10pt</xsl:when>
                                                  <xsl:when test="$level = 1">0pt</xsl:when>
                                                  <xsl:when test="$level = ''">6pt</xsl:when>
                                                  <xsl:otherwise>12pt</xsl:otherwise>
                                          </xsl:choose>
                                  </xsl:attribute>
                                  <xsl:attribute name="margin-bottom">
                                          <xsl:choose>
                                                  <xsl:when test="ancestor::m3d:preface">6pt</xsl:when>
                                                  <xsl:when test="$level = 1">12pt</xsl:when>
                                                  <xsl:otherwise>8pt</xsl:otherwise>
                                          </xsl:choose>
                                  </xsl:attribute>
                                  <xsl:attribute name="keep-with-next">always</xsl:attribute>             

                                  <xsl:choose>
                                          <xsl:when test="(ancestor::m3d:sections and $level = 1) or                  ($parent-name = 'references' and $references_num_current = 1)">
                                                  <fo:table table-layout="fixed" width="100%">
                                                          <fo:table-column column-width="25mm"/>
                                                          <fo:table-column column-width="150mm"/>
                                                          <fo:table-body>
                                                                  <fo:table-row>
                                                                                  <fo:table-cell>
                                                                                          <fo:block>
                                                                                                  <xsl:value-of select="$section"/>
                                                                                          </fo:block>
                                                                                  </fo:table-cell>
                                                                                  <fo:table-cell>
                                                                                          <fo:block>
                                                                                                  <xsl:apply-templates/>
                                                                                          </fo:block>
                                                                                  </fo:table-cell>
                                                                  </fo:table-row>
                                                          </fo:table-body>
                                                  </fo:table>
                                          </xsl:when>
                                          <xsl:when test="ancestor::m3d:sections or ancestor::m3d:annex">
                                                  <fo:inline padding-right="3mm"><xsl:value-of select="$section"/></fo:inline>
                                                  <xsl:apply-templates/>
                                          </xsl:when>
                                          <xsl:otherwise>
                                                  <xsl:apply-templates/>
                                          </xsl:otherwise>
                                  </xsl:choose>

                          </xsl:element>

                          <xsl:if test="$element-name = 'fo:inline' and not(following-sibling::m3d:p)">
                                  <!-- <fo:block> -->
                                          <xsl:value-of select="$linebreak"/>
                                  <!-- </fo:block> -->
                          </xsl:if>
                  </xsl:otherwise>
          </xsl:choose>           
  </xsl:template>

  <xsl:template match="m3d:p">
          <xsl:param name="inline" select="'false'"/>
          <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
          <xsl:variable name="element-name">
                  <xsl:choose>
                          <xsl:when test="$inline = 'true'">fo:inline</xsl:when>
                          <xsl:when test="../@inline-header = 'true' and $previous-element = 'title'">fo:inline</xsl:when> <!-- first paragraph after inline title -->
                          <!-- <xsl:when test="local-name(..) = 'admonition'">fo:inline</xsl:when> -->
                          <xsl:otherwise>fo:block</xsl:otherwise>
                  </xsl:choose>
          </xsl:variable>
          <xsl:element name="{$element-name}">
                  <xsl:attribute name="text-align">
                          <xsl:choose>
                                  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
                                  <xsl:when test="ancestor::m3d:td/@align"><xsl:value-of select="ancestor::m3d:td/@align"/></xsl:when>
                                  <xsl:when test="ancestor::m3d:th/@align"><xsl:value-of select="ancestor::m3d:th/@align"/></xsl:when>
                                  <xsl:otherwise>justify</xsl:otherwise><!-- left -->
                          </xsl:choose>
                  </xsl:attribute>
                  <xsl:attribute name="text-indent">0mm</xsl:attribute>
                  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
                  <xsl:apply-templates/>
          </xsl:element>
          <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
                  <xsl:choose>
                          <xsl:when test="ancestor::m3d:annex">
                                  <xsl:value-of select="$linebreak"/>
                          </xsl:when>
                          <xsl:otherwise>
                                  <fo:block margin-bottom="12pt">
                                          <xsl:value-of select="$linebreak"/>
                                  </fo:block>
                          </xsl:otherwise>
                  </xsl:choose>
          </xsl:if>
          <xsl:if test="$inline = 'true'">
                  <fo:block> </fo:block>
          </xsl:if>
  </xsl:template>

  <xsl:template match="m3d:li//m3d:p//text()">
          <xsl:choose>
                  <xsl:when test="contains(., '&#9;')">
                          <fo:inline white-space="pre"><xsl:value-of select="."/></fo:inline>
                  </xsl:when>
                  <xsl:otherwise>
                          <xsl:value-of select="."/>
                  </xsl:otherwise>
          </xsl:choose>

  </xsl:template>

  <!--
  <fn reference="1">
                  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
          </fn>
  -->

  <xsl:variable name="p_fn">
          <xsl:for-each select="//m3d:p/m3d:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
                  <!-- copy unique fn -->
                  <fn gen_id="{generate-id(.)}">
                          <xsl:copy-of select="@*"/>
                          <xsl:copy-of select="node()"/>
                  </fn>
          </xsl:for-each>
  </xsl:variable>

  <xsl:template match="m3d:p/m3d:fn" priority="2">
          <xsl:variable name="gen_id" select="generate-id(.)"/>
          <xsl:variable name="reference" select="@reference"/>
          <xsl:variable name="number">
                  <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
          </xsl:variable>
          <xsl:choose>
                  <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
                          <fo:footnote>
                                  <fo:inline font-size="7pt" keep-with-previous.within-line="always" vertical-align="super">
                                          <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
                                                  <!-- <xsl:value-of select="@reference"/> -->
                                                  <xsl:value-of select="$number + count(//m3d:bibitem[ancestor::m3d:references[@id='_normative_references' or not(preceding-sibling::m3d:references)]]/m3d:note)"/>
                                          </fo:basic-link>
                                  </fo:inline>
                                  <fo:footnote-body>
                                          <fo:block font-size="9pt" margin-bottom="12pt">
                                                  <fo:inline font-size="6pt" id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" vertical-align="super" padding-right="1mm">
                                                          <xsl:value-of select="$number + count(//m3d:bibitem[ancestor::m3d:references[@id='_normative_references' or not(preceding-sibling::m3d:references)]]/m3d:note)"/>
                                                  </fo:inline>
                                                  <xsl:for-each select="m3d:p">
                                                                  <xsl:apply-templates/>
                                                  </xsl:for-each>
                                          </fo:block>
                                  </fo:footnote-body>
                          </fo:footnote>
                  </xsl:when>
                  <xsl:otherwise>
                          <fo:inline font-size="7pt" keep-with-previous.within-line="always" vertical-align="super">
                                  <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
                                          <xsl:value-of select="$number + count(//m3d:bibitem/m3d:note)"/>
                                  </fo:basic-link>
                          </fo:inline>
                  </xsl:otherwise>
          </xsl:choose>
  </xsl:template>

  <xsl:template match="m3d:p/m3d:fn/m3d:p">
          <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="m3d:review">
          <!-- comment 2019-11-29 -->
          <!-- <fo:block font-weight="bold">Review:</fo:block>
          <xsl:apply-templates /> -->
  </xsl:template>

  <xsl:template match="text()">
          <xsl:value-of select="."/>
  </xsl:template>

  <xsl:template match="m3d:image">
          <fo:block-container text-align="center">
                  <fo:block>
                          <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
                  </fo:block>
                  <fo:block margin-top="12pt" margin-bottom="12pt">
                          <xsl:value-of select="$title-figure"/>
                          <xsl:call-template name="getFigureNumber"/>
                  </fo:block>
          </fo:block-container>
  </xsl:template>

  <xsl:template match="m3d:figure">
          <fo:block-container id="{@id}">
                  <fo:block>
                          <xsl:apply-templates/>
                  </fo:block>
                  <xsl:call-template name="fn_display_figure"/>
                  <xsl:for-each select="m3d:note//m3d:p">
                          <xsl:call-template name="note"/>
                  </xsl:for-each>
                  <fo:block text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
                          <xsl:call-template name="getFigureNumber"/>
                          <xsl:if test="m3d:name">
                                  <!-- <xsl:if test="not(local-name(..) = 'figure')"> -->
                                          <xsl:text> — </xsl:text>
                                  <!-- </xsl:if> -->
                                  <xsl:value-of select="m3d:name"/>
                          </xsl:if>
                  </fo:block>
          </fo:block-container>
  </xsl:template>

  <xsl:template name="getFigureNumber">
          <xsl:choose>
                  <xsl:when test="ancestor::m3d:annex">
                          <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="m3d:annex | m3d:figure"/>
                  </xsl:when>
                  <xsl:otherwise>
                          <xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/>
                  </xsl:otherwise>
          </xsl:choose>
  </xsl:template>

  <xsl:template match="m3d:figure/m3d:name"/>
  <xsl:template match="m3d:figure/m3d:fn" priority="2"/>
  <xsl:template match="m3d:figure/m3d:note"/>

  <xsl:template match="m3d:figure/m3d:image">
          <fo:block text-align="center">
                  <xsl:variable name="src">
                          <xsl:choose>
                                  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
                                          <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
                                  </xsl:when>
                                  <xsl:otherwise>
                                          <xsl:value-of select="@src"/>
                                  </xsl:otherwise>
                          </xsl:choose>
                  </xsl:variable>         
                  <fo:external-graphic src="{$src}" width="100%" content-height="100%" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/>  <!-- src="{@src}" -->
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:bibitem">
          <fo:block id="{@id}" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm"> <!-- 12 pt -->
                          <!-- m3d:docidentifier -->
                  <xsl:if test="m3d:docidentifier">
                          <xsl:choose>
                                  <xsl:when test="m3d:docidentifier/@type = 'metanorma'"/>
                                  <xsl:otherwise><fo:inline><xsl:value-of select="m3d:docidentifier"/></fo:inline></xsl:otherwise>
                          </xsl:choose>
                  </xsl:if>
                  <xsl:apply-templates select="m3d:note"/>
                  <xsl:if test="m3d:docidentifier">, </xsl:if>
                  <fo:inline font-style="italic">
                          <xsl:choose>
                                  <xsl:when test="m3d:title[@type = 'main' and @language = 'en']">
                                          <xsl:value-of select="m3d:title[@type = 'main' and @language = 'en']"/>
                                  </xsl:when>
                                  <xsl:otherwise>
                                          <xsl:value-of select="m3d:title"/>
                                  </xsl:otherwise>
                          </xsl:choose>
                  </fo:inline>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:bibitem/m3d:note">
          <fo:footnote>
                  <xsl:variable name="number">
                          <xsl:number level="any" count="m3d:bibitem/m3d:note"/>
                  </xsl:variable>
                  <fo:inline font-size="7pt" keep-with-previous.within-line="always" baseline-shift="30%">
                          <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
                                  <xsl:value-of select="$number"/>
                          </fo:basic-link>
                  </fo:inline>
                  <fo:footnote-body>
                          <fo:block font-size="9pt" margin-bottom="4pt" start-indent="0pt">
                                  <fo:inline font-size="6pt" id="footnote_{../@id}" keep-with-next.within-line="always" baseline-shift="30%" padding-right="1mm"><!-- alignment-baseline="hanging" font-size="60%"  -->
                                          <xsl:value-of select="$number"/>
                                  </fo:inline>
                                  <xsl:apply-templates/>
                          </fo:block>
                  </fo:footnote-body>
          </fo:footnote>
  </xsl:template>

  <xsl:template match="m3d:ul | m3d:ol">
          <fo:block-container margin-left="6mm">
                  <fo:block-container margin-left="0mm">
                          <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="6mm"> <!--   margin-bottom="8pt" -->
                                  <xsl:if test="local-name() = 'ol'">
                                          <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
                                  </xsl:if>                       
                                  <xsl:apply-templates/>
                          </fo:list-block>
                          <xsl:for-each select="./m3d:note//m3d:p">
                                  <xsl:call-template name="note"/>
                          </xsl:for-each>
                  </fo:block-container>
          </fo:block-container>
  </xsl:template>

  <xsl:template match="m3d:ul//m3d:note |  m3d:ol//m3d:note"/>

  <xsl:template match="m3d:li">
          <fo:list-item id="{@id}">
                  <fo:list-item-label end-indent="label-end()">
                          <fo:block>
                                  <xsl:if test="local-name(..) = 'ul'">
                                          <xsl:attribute name="font-size">18pt</xsl:attribute>
                                          <xsl:attribute name="margin-top">-0.5mm</xsl:attribute><!-- to vertical align big dot -->
                                  </xsl:if>
                                  <xsl:call-template name="getListItemFormat"/>
                          </fo:block>
                  </fo:list-item-label>
                  <fo:list-item-body start-indent="body-start()">
                          <xsl:apply-templates/>
                          <xsl:apply-templates select=".//m3d:note" mode="process"/>
                  </fo:list-item-body>
          </fo:list-item>
  </xsl:template>

  <xsl:template match="m3d:term">
          <xsl:param name="sectionNum"/>
          <fo:block id="{@id}" keep-with-next="always" margin-top="10pt" margin-bottom="8pt" line-height="1.1">
                  <fo:inline>
                          <xsl:variable name="section">
                                  <xsl:for-each select="*[1]">
                                          <xsl:call-template name="getSection">
                                                  <xsl:with-param name="sectionNum" select="$sectionNum"/>
                                          </xsl:call-template>
                                  </xsl:for-each>
                          </xsl:variable>
                          <xsl:value-of select="$section"/><!-- <xsl:text>.</xsl:text> -->
                  </fo:inline>
          </fo:block>
          <fo:block>
                  <xsl:apply-templates>
                          <xsl:with-param name="sectionNum" select="$sectionNum"/>
                  </xsl:apply-templates>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:preferred">
          <xsl:param name="sectionNum"/>

          <fo:inline>
                  <xsl:apply-templates/>
          </fo:inline>

          <xsl:if test="not(following-sibling::*[1][local-name() = 'preferred'])">
                  <xsl:value-of select="$linebreak"/>
          </xsl:if>

  </xsl:template>

  <xsl:template match="m3d:admitted">
          <xsl:param name="sectionNum"/>

          <fo:inline>
                  <xsl:apply-templates/>
          </fo:inline>

          <xsl:if test="not(following-sibling::*[1][local-name() = 'admitted'])">
                  <xsl:value-of select="$linebreak"/>
          </xsl:if>

  </xsl:template>

  <xsl:template match="m3d:deprecates">
          <xsl:param name="sectionNum"/>          
          <fo:inline>
                  <xsl:if test="not(preceding-sibling::*[1][local-name() = 'deprecates'])">
                          <fo:inline>DEPRECATED: </fo:inline>
                  </xsl:if>
                  <xsl:apply-templates/>
          </fo:inline>
          <xsl:if test="not(following-sibling::*[1][local-name() = 'deprecates'])">
                  <xsl:value-of select="$linebreak"/>
          </xsl:if>

  </xsl:template>

  <xsl:template match="m3d:definition[preceding-sibling::m3d:domain]">
          <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="m3d:definition[preceding-sibling::m3d:domain]/m3d:p">
          <fo:inline> <xsl:apply-templates/></fo:inline>
          <fo:block> </fo:block>
  </xsl:template>

  <xsl:template match="m3d:definition">
          <fo:block>
                  <xsl:apply-templates/>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:termsource">
          <fo:block>
                  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
                  <fo:basic-link internal-destination="{m3d:origin/@bibitemid}" fox:alt-text="{m3d:origin/@citeas}">
                          <xsl:text>[</xsl:text> <!-- SOURCE:  -->
                          <xsl:value-of select="m3d:origin/@citeas"/>

                          <xsl:apply-templates select="m3d:origin/m3d:localityStack"/>

                  </fo:basic-link>
                  <xsl:apply-templates select="m3d:modification"/>
                  <xsl:text>]</xsl:text>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:modification">
          <xsl:text>, modified — </xsl:text>
          <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="m3d:modification/m3d:p">
          <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match="m3d:modification/text()">
          <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="m3d:termnote">
          <fo:block-container margin-left="0mm" margin-top="4pt" line-height="125%">
                  <fo:block>
                          <fo:inline padding-right="1mm">
                                  <xsl:text>Note </xsl:text>
                                          <xsl:number/>
                                  <xsl:text> to entry: </xsl:text>
                          </fo:inline>
                          <xsl:apply-templates/>
                  </fo:block>
          </fo:block-container>
  </xsl:template>

  <xsl:template match="m3d:termnote/m3d:p">
          <fo:inline><xsl:apply-templates/></fo:inline>           
  </xsl:template>

  <xsl:template match="m3d:domain">
          <fo:inline>&lt;<xsl:apply-templates/>&gt; </fo:inline>
  </xsl:template>

  <xsl:template match="m3d:termexample">
          <fo:block margin-top="14pt" margin-bottom="14pt" text-align="justify">
                  <fo:inline padding-right="1mm" font-weight="bold">
                          <xsl:value-of select="$title-example"/>
                          <xsl:if test="count(ancestor::m3d:term[1]//m3d:termexample) &gt; 1">
                                  <xsl:number/>
                          </xsl:if>
                          <xsl:text>:</xsl:text>
                  </fo:inline>
                  <xsl:apply-templates/>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:termexample/m3d:p">
          <fo:inline><xsl:apply-templates/></fo:inline>
  </xsl:template>

  <xsl:template match="m3d:annex">
          <fo:block break-after="page"/>
          <xsl:apply-templates/>
  </xsl:template>

  <!-- <xsl:template match="m3d:references[@id = '_bibliography']"> -->
  <xsl:template match="m3d:references[position() &gt; 1]">
          <fo:block break-after="page"/>
          <xsl:apply-templates/>
          <fo:block-container text-align="center">
                  <fo:block-container margin-left="63mm" width="42mm" border-bottom="2pt solid black">
                          <fo:block> </fo:block>
                  </fo:block-container>
          </fo:block-container>
  </xsl:template>

  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
  <!-- <xsl:template match="m3d:references[@id = '_bibliography']/m3d:bibitem"> -->
  <xsl:template match="m3d:references[position() &gt; 1]/m3d:bibitem">
          <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
                  <fo:list-item>
                          <fo:list-item-label end-indent="label-end()">
                                  <fo:block>
                                          <fo:inline id="{@id}">
                                                  <xsl:number format="[1]"/>
                                          </fo:inline>
                                  </fo:block>
                          </fo:list-item-label>
                          <fo:list-item-body start-indent="body-start()">
                                  <fo:block text-align="justify">
                                          <xsl:variable name="docidentifier">
                                                  <xsl:if test="m3d:docidentifier">
                                                          <xsl:choose>
                                                                  <xsl:when test="m3d:docidentifier/@type = 'metanorma'"/>
                                                                  <xsl:otherwise><xsl:value-of select="m3d:docidentifier"/></xsl:otherwise>
                                                          </xsl:choose>
                                                  </xsl:if>
                                          </xsl:variable>
                                          <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
                                          <xsl:apply-templates select="m3d:note"/>
                                          <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
                                          <xsl:choose>
                                                  <xsl:when test="m3d:title[@type = 'main' and @language = 'en']">
                                                          <xsl:apply-templates select="m3d:title[@type = 'main' and @language = 'en']"/>
                                                  </xsl:when>
                                                  <xsl:otherwise>
                                                          <xsl:apply-templates select="m3d:title"/>
                                                  </xsl:otherwise>
                                          </xsl:choose>
                                          <xsl:apply-templates select="m3d:formattedref"/>
                                  </fo:block>
                          </fo:list-item-body>
                  </fo:list-item>
          </fo:list-block>
  </xsl:template>

  <!-- <xsl:template match="m3d:references[@id = '_bibliography']/m3d:bibitem" mode="contents"/> -->
  <xsl:template match="m3d:references[position() &gt; 1]/m3d:bibitem" mode="contents"/>

  <!-- <xsl:template match="m3d:references[@id = '_bibliography']/m3d:bibitem/m3d:title"> -->
  <xsl:template match="m3d:references[position() &gt; 1]/m3d:bibitem/m3d:title">
          <fo:inline font-style="italic">
                  <xsl:apply-templates/>
          </fo:inline>
  </xsl:template>

  <xsl:template match="m3d:quote">
          <fo:block margin-top="12pt" margin-left="12mm" margin-right="12mm">
                  <xsl:apply-templates select=".//m3d:p"/>
          </fo:block>
          <fo:block text-align="right">
                  <!-- — ISO, ISO 7301:2011, Clause 1 -->
                  <xsl:text>— </xsl:text><xsl:value-of select="m3d:author"/>
                  <xsl:if test="m3d:source">
                          <xsl:text>, </xsl:text>
                          <xsl:apply-templates select="m3d:source"/>
                  </xsl:if>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:source">
          <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
                  <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
                  <xsl:apply-templates select="m3d:localityStack"/>
          </fo:basic-link>
  </xsl:template>

  <xsl:template match="mathml:math" priority="2">
          <fo:inline font-family="Cambria Math">
                  <fo:instream-foreign-object fox:alt-text="Math">
                          <xsl:copy-of select="."/>
                  </fo:instream-foreign-object>
          </fo:inline>
  </xsl:template>

  <xsl:template match="m3d:xref">
          <xsl:param name="sectionNum"/>

          <xsl:variable name="target" select="normalize-space(@target)"/>
          <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
                  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = $target]/@section"/>
                  <!-- <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))"> -->
                          <!-- <xsl:attribute name="color">blue</xsl:attribute>
                          <xsl:attribute name="text-decoration">underline</xsl:attribute> -->
                  <!-- </xsl:if> -->
                  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = $target]/@type"/>
                  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id =$target]/@root"/>
                  <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =$target]/@level"/>
                  <xsl:choose>
                          <xsl:when test="$type = 'clause' and $root != 'annex' and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
                          <xsl:when test="$type = 'clause' and $root = 'annex'"><xsl:value-of select="$title-annex"/></xsl:when>
                          <xsl:when test="$type = 'li'">
                                  <xsl:attribute name="color">black</xsl:attribute>
                                  <xsl:attribute name="text-decoration">none</xsl:attribute>
                                  <xsl:variable name="parent_section" select="xalan:nodeset($contents)//item[@id =$target]/@parent_section"/>
                                  <xsl:variable name="currentSection">
                                          <xsl:call-template name="getSection"/>
                                  </xsl:variable>
                                  <xsl:if test="not(contains($parent_section, $currentSection))">
                                          <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
                                                  <xsl:attribute name="color">blue</xsl:attribute>
                                                  <xsl:attribute name="text-decoration">underline</xsl:attribute>
                                                  <xsl:value-of select="$parent_section"/><xsl:text> </xsl:text>
                                          </fo:basic-link>
                                  </xsl:if>
                          </xsl:when>
                          <xsl:when test="normalize-space($section) = ''">
                                  <xsl:text>[</xsl:text><xsl:value-of select="$target"/><xsl:text>]</xsl:text>
                          </xsl:when>
                          <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
                  </xsl:choose>
                  <xsl:value-of select="$section"/>
</fo:basic-link>
  </xsl:template>

  <xsl:template match="m3d:example/m3d:p">
          <fo:block margin-top="8pt" margin-bottom="8pt">
                  <xsl:variable name="claims_id" select="ancestor::m3d:clause[1]/@id"/>
                  <fo:inline padding-right="5mm" font-weight="bold">
                          <xsl:value-of select="$title-example"/>
                          <xsl:if test="count(ancestor::m3d:clause[1]//m3d:example) &gt; 1">
                                  <xsl:number count="m3d:example[ancestor::m3d:clause[@id = $claims_id]]" level="any"/>
                          </xsl:if>
                  </fo:inline>
                  <xsl:apply-templates/>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:note/m3d:p" name="note">
          <xsl:variable name="claims_id" select="ancestor::m3d:clause[1]/@id"/>
          <fo:block-container margin-left="0mm" margin-top="4pt" line-height="125%">
                  <fo:block>
                          <fo:inline padding-right="5mm" font-weight="bold">
                                  <xsl:value-of select="$title-note"/>
                                  <xsl:if test="count(ancestor::m3d:clause[1]//m3d:note) &gt; 1">
                                          <xsl:text> </xsl:text><xsl:number count="m3d:note[ancestor::m3d:clause[@id = $claims_id]]" level="any"/>
                                  </xsl:if>
                                  <xsl:text>:</xsl:text>
                          </fo:inline>
                          <xsl:apply-templates/>
                  </fo:block>
          </fo:block-container>
  </xsl:template>

  <!-- <eref type="inline" bibitemid="IEC60050-113" citeas="IEC 60050-113:2011"><localityStack><locality type="clause"><referenceFrom>113-01-12</referenceFrom></locality></localityStack></eref> -->
  <xsl:template match="m3d:eref">
          <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
                  <xsl:if test="@type = 'footnote'">
                          <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
                          <xsl:attribute name="font-size">50%</xsl:attribute>
                          <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
                          <xsl:attribute name="vertical-align">super</xsl:attribute>
                  </xsl:if>
                  <!-- <xsl:if test="@type = 'inline'">
                          <xsl:attribute name="color">blue</xsl:attribute>
                          <xsl:attribute name="text-decoration">underline</xsl:attribute>
                  </xsl:if> -->

                  <xsl:choose>
                          <xsl:when test="@citeas and normalize-space(text()) = ''">
                                  <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
                          </xsl:when>
                          <xsl:when test="@bibitemid and normalize-space(text()) = ''">
                                  <xsl:value-of select="//m3d:bibitem[@id = current()/@bibitemid]/m3d:docidentifier"/>
                          </xsl:when>
                          <xsl:otherwise/>
                  </xsl:choose>
                  <xsl:apply-templates select="m3d:localityStack"/>
                  <xsl:apply-templates select="text()"/>
          </fo:basic-link>
  </xsl:template>

  <xsl:template match="m3d:locality">
          <xsl:choose>
                  <xsl:when test="@type ='section' and ancestor::m3d:termsource">SOURCE Section </xsl:when>
                  <xsl:when test="ancestor::m3d:termsource"/>
                  <xsl:when test="@type ='clause' and ancestor::m3d:eref"/>
                  <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
                  <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
                  <xsl:when test="@type ='table'"><xsl:value-of select="$title-table"/></xsl:when>
                  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
          </xsl:choose>
          <xsl:text> </xsl:text><xsl:value-of select="m3d:referenceFrom"/>
  </xsl:template>

  <xsl:template match="m3d:admonition">
          <fo:block text-align="center" margin-bottom="12pt" font-weight="bold">
                  <xsl:value-of select="translate(@type, $lower, $upper)"/>
          </fo:block>
          <fo:block font-weight="bold">
                  <xsl:apply-templates/>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:formula/m3d:dt/m3d:stem">
          <fo:inline>
                  <xsl:apply-templates/>
          </fo:inline>
  </xsl:template>

  <xsl:template match="m3d:formula/m3d:stem">
          <fo:block id="{../@id}" margin-top="14pt" margin-bottom="14pt">
                  <fo:table table-layout="fixed" width="170mm">
                          <fo:table-column column-width="165mm"/>
                          <fo:table-column column-width="5mm"/>
                          <fo:table-body>
                                  <fo:table-row>
                                          <fo:table-cell display-align="center">
                                                  <fo:block text-align="center">
                                                          <xsl:apply-templates/>
                                                  </fo:block>
                                          </fo:table-cell>
                                          <fo:table-cell display-align="center">
                                                  <fo:block text-align="left">
                                                          <xsl:choose>
                                                                  <xsl:when test="ancestor::m3d:annex">
                                                                          <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="m3d:annex | m3d:formula"/><xsl:text>)</xsl:text>
                                                                  </xsl:when>
                                                                  <xsl:otherwise> <!-- not(ancestor::m3d:annex) -->
                                                                          <xsl:text>(</xsl:text><xsl:number level="any" count="m3d:formula"/><xsl:text>)</xsl:text>
                                                                  </xsl:otherwise>
                                                          </xsl:choose>
                                                  </fo:block>
                                          </fo:table-cell>
                                  </fo:table-row>
                          </fo:table-body>
                  </fo:table>
                  <fo:inline keep-together.within-line="always">
                  </fo:inline>
          </fo:block>
  </xsl:template>

  <xsl:template match="m3d:br" priority="2">
          <xsl:value-of select="$linebreak"/>
  </xsl:template>

  <xsl:template name="getId">
          <xsl:choose>
                  <xsl:when test="../@id">
                          <xsl:value-of select="../@id"/>
                  </xsl:when>
                  <xsl:otherwise>
                          <xsl:value-of select="text()"/>
                  </xsl:otherwise>
          </xsl:choose>
  </xsl:template>

  <xsl:template name="getLevel">
          <xsl:variable name="level_total" select="count(ancestor::*)"/>
          <xsl:variable name="level">
                  <xsl:choose>
                          <xsl:when test="ancestor::m3d:preface">
                                  <xsl:value-of select="$level_total - 2"/>
                          </xsl:when>
                          <xsl:when test="ancestor::m3d:sections">
                                  <xsl:value-of select="$level_total - 2"/>
                          </xsl:when>
                          <xsl:when test="ancestor::m3d:bibliography">
                                  <xsl:value-of select="$level_total - 2"/>
                          </xsl:when>
                          <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
                          <xsl:otherwise>
                                  <xsl:value-of select="$level_total - 1"/>
                          </xsl:otherwise>
                  </xsl:choose>
          </xsl:variable>
          <xsl:value-of select="$level"/>
  </xsl:template>

  <xsl:template name="getSection">
          <xsl:param name="sectionNum"/>
          <xsl:variable name="level">
                  <xsl:call-template name="getLevel"/>
          </xsl:variable>
          <xsl:variable name="references_num_current">
                  <xsl:number level="any" count="m3d:references"/>
          </xsl:variable>
          <xsl:variable name="section">
                  <xsl:choose>
                          <xsl:when test="ancestor::m3d:bibliography and $references_num_current = 1"><!-- Normative references -->
                                  <xsl:text>Section </xsl:text><xsl:value-of select="$sectionNum"/><xsl:text>.</xsl:text>
                          </xsl:when>
                          <xsl:when test="ancestor::m3d:bibliography">
                                  <xsl:value-of select="$sectionNum"/>
                          </xsl:when>
                          <xsl:when test="ancestor::m3d:sections">
                                  <!-- 1, 2, 3, 4, ... from main section (not annex, bibliography, ...) -->
                                  <xsl:if test="$level = 1">
                                          <xsl:text>Section </xsl:text>
                                  </xsl:if>
                                  <xsl:choose>
                                          <xsl:when test="$level = 1">
                                                  <xsl:value-of select="$sectionNum"/><xsl:text>.</xsl:text>
                                          </xsl:when>
                                          <xsl:when test="$level &gt;= 2">
                                                  <xsl:variable name="num">
                                                          <xsl:number format=".1" level="multiple" count="m3d:clause/m3d:clause |                                            m3d:clause/m3d:terms |                                            m3d:terms/m3d:term |                                            m3d:clause/m3d:term |                                             m3d:terms/m3d:clause |                                           m3d:terms/m3d:definitions |                                           m3d:definitions/m3d:clause |                                           m3d:clause/m3d:definitions"/>
                                                  </xsl:variable>
                                                  <xsl:value-of select="concat($sectionNum, $num)"/><xsl:text>.</xsl:text>
                                          </xsl:when>
                                          <xsl:otherwise>
                                                  <!-- z<xsl:value-of select="$sectionNum"/>z -->
                                          </xsl:otherwise>
                                  </xsl:choose>
                          </xsl:when>                             
                          <xsl:when test="ancestor::m3d:annex">
                                  <xsl:variable name="annexid" select="normalize-space(/m3d:m3d-standard/m3d:bibdata/m3d:ext/m3d:structuredidentifier/m3d:annexid)"/>
                                  <xsl:choose>
                                          <xsl:when test="$level = 1">
                                                  <xsl:text>Annex </xsl:text>                                                     
                                                  <xsl:choose>
                                                          <xsl:when test="count(//m3d:annex) = 1 and $annexid != ''">
                                                                  <xsl:value-of select="$annexid"/>
                                                          </xsl:when>
                                                          <xsl:otherwise>
                                                                  <xsl:number format="A" level="any" count="m3d:annex"/>
                                                          </xsl:otherwise>
                                                  </xsl:choose>
                                          </xsl:when>
                                          <xsl:otherwise>
                                                  <xsl:choose>
                                                          <xsl:when test="count(//m3d:annex) = 1 and $annexid != ''">
                                                                  <xsl:value-of select="$annexid"/><xsl:number format=".1" level="multiple" count="m3d:clause"/>
                                                          </xsl:when>
                                                          <xsl:otherwise>
                                                                  <xsl:number format="A.1" level="multiple" count="m3d:annex | m3d:clause"/>
                                                          </xsl:otherwise>
                                                  </xsl:choose>
                                          </xsl:otherwise>
                                  </xsl:choose>
                          </xsl:when>
                          <!-- if preface and there is clause(s) -->
                          <xsl:when test="ancestor::m3d:preface">0</xsl:when>
                                  <!-- <xsl:choose>
                                          <xsl:when test="$level = 1 and  ..//m3d:clause">0</xsl:when>
                                          <xsl:when test="$level &gt;= 2">
                                                  <xsl:variable name="num">
                                                          <xsl:number format=".1" level="multiple" count="m3d:clause"/>
                                                  </xsl:variable>
                                                  <xsl:value-of select="concat('0', $num)"/>
                                          </xsl:when>
                                          <xsl:otherwise>
                                          </xsl:otherwise>
                                  </xsl:choose>
                          </xsl:when> -->
                          <xsl:otherwise>
                          </xsl:otherwise>
                  </xsl:choose>
          </xsl:variable>
          <xsl:value-of select="$section"/>
  </xsl:template>

  <xsl:variable name="Image-M3AAWG-Logo">
          <xsl:text>iVBORw0KGgoAAAANSUhEUgAAAjUAAAA8CAYAAACehUt5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA99pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ1dWlkOmZhZjViZGQ1LWJhM2QtMTFkYS1hZDMxLWQzM2Q3NTE4MmYxYiIgeG1wTU06RG9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NpxxuqwnCspk7vvSewQplRk4CGffKrpLu4WsU2xFMqfgTkuIS+hrErAGQ7eV+RpBtsgMaRI0eOqpNswmSFMlscf1yDdZ5rqVfsk3NFkMJL4HkmbZYabCMMUYsM4wNDz3VFkKzUrNShVr7FUOZ9NShw35f64SwWk60P1I2fJiwW9gDQlGR1cGTSNv0gbYKhLrYvh9WWD5peZ3C5fFLqB3dI7HfDm2YPzqkkhzFChQ+bC2gOAdpwAOpSxzYdOXJUW8m8/VQPKGr7yVHdJbgdKy+GwcowwKvGOsCgFnZZy2jfUtv7DMAXtgDYy4dHFM5Yakzw/AsXBTBqhR3AXAaFzOI7nKfc9pMjR44KTNh+cmc/OaqTRBCxpIbrgO2dVXWoz6DF+ZLJkSNHjuodOZduR44cOXLkyJEDNY4cOXLkyJEjR7WF/O2nDbnvXd9oIzfEjhw5cuTI0W8L1CAA0DauOxw5clQA6khe84PrCkeOHBWS/l+AAQACYD7v73Ou8wAAAABJRU5ErkJggg==</xsl:text>
  </xsl:variable>

  <xsl:template name="addLetterSpacing">
          <xsl:param name="text"/>
          <xsl:param name="letter-spacing" select="'0.15'"/>
          <xsl:if test="string-length($text) &gt; 0">
                  <xsl:variable name="char" select="substring($text, 1, 1)"/>
                  <fo:inline padding-right="{$letter-spacing}mm"><xsl:value-of select="$char"/></fo:inline>
                  <xsl:call-template name="addLetterSpacing">
                          <xsl:with-param name="text" select="substring($text, 2)"/>
                          <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
                  </xsl:call-template>
          </xsl:if>
  </xsl:template>

<xsl:variable xmlns:java=“xml.apache.org/xalan/java” name=“title-table”>

                      <xsl:text>Table </xsl:text>

      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note">

                      <xsl:text>NOTE </xsl:text>

      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-figure">

                      <xsl:text>Figure </xsl:text>

      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-example">

                      <xsl:text>EXAMPLE </xsl:text>

      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-inequality">Inequality </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-equation">Equation </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-annex">

                      <xsl:text>Annex </xsl:text>

      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-appendix">
              <xsl:text>Appendix </xsl:text>
      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-clause">

                      <xsl:text>Clause </xsl:text>

      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-edition">
              <xsl:text>Edition </xsl:text>
      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-toc">

      </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-page">Page</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-key">Key</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-where">where</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-descriptors">Descriptors</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-en">Part </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-fr">Partie </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-modified">modified</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-source">SOURCE</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-keywords">Keywords</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="link-style">

                      <xsl:attribute name="color">blue</xsl:attribute>
                      <xsl:attribute name="text-decoration">underline</xsl:attribute>

      </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="sourcecode-style">

                      <xsl:attribute name="font-family">Courier</xsl:attribute>                       
                      <xsl:attribute name="margin-bottom">12pt</xsl:attribute>

      </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-style">

                      <xsl:attribute name="font-size">12pt</xsl:attribute>
                      <xsl:attribute name="font-weight">bold</xsl:attribute>
                      <xsl:attribute name="margin-top">12pt</xsl:attribute>
                      <xsl:attribute name="margin-bottom">12pt</xsl:attribute>

      </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-example-style">

                      <xsl:attribute name="font-size">10pt</xsl:attribute>                    
                      <xsl:attribute name="margin-top">8pt</xsl:attribute>
                      <xsl:attribute name="margin-bottom">8pt</xsl:attribute>

      </xsl:attribute-set><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()">
              <xsl:value-of select="."/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='br']">
              <xsl:value-of select="$linebreak"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
              <!-- <xsl:call-template name="add-zero-spaces"/> -->
              <xsl:call-template name="add-zero-spaces-java"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']">

              <xsl:variable name="simple-table">
                      <!-- <xsl:copy> -->
                              <xsl:call-template name="getSimpleTable"/>
                      <!-- </xsl:copy> -->
              </xsl:variable>

              <!-- DEBUG -->
              <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
              <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->

              <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->

              <!-- <xsl:if test="$namespace = 'iso'">
                      <fo:block space-before="6pt">&#xA0;</fo:block>                          
              </xsl:if> -->

              <xsl:choose>
                      <xsl:when test="@unnumbered = 'true'"/>
                      <xsl:otherwise>

                                      <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">

                                              <xsl:value-of select="$title-table"/>

                                              <xsl:call-template name="getTableNumber"/>

                                              <xsl:if test="*[local-name()='name']">

                                                              <xsl:text> — </xsl:text>

                                                      <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
                                              </xsl:if>
                                      </fo:block>

                                      <xsl:call-template name="fn_name_display"/>

                      </xsl:otherwise>
              </xsl:choose>

              <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>

              <!-- <xsl:variable name="cols-count">
                      <xsl:choose>
                              <xsl:when test="*[local-name()='thead']">
                                      <xsl:call-template name="calculate-columns-numbers">
                                              <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
                                      </xsl:call-template>
                              </xsl:when>
                              <xsl:otherwise>
                                      <xsl:call-template name="calculate-columns-numbers">
                                              <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
                                      </xsl:call-template>
                              </xsl:otherwise>
                      </xsl:choose>
              </xsl:variable> -->
              <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
              <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->

              <xsl:variable name="colwidths">
                      <xsl:call-template name="calculate-column-widths">
                              <xsl:with-param name="cols-count" select="$cols-count"/>
                              <xsl:with-param name="table" select="$simple-table"/>
                      </xsl:call-template>
              </xsl:variable>

              <!-- <xsl:variable name="colwidths2">
                      <xsl:call-template name="calculate-column-widths">
                              <xsl:with-param name="cols-count" select="$cols-count"/>
                      </xsl:call-template>
              </xsl:variable> -->

              <!-- cols-count=<xsl:copy-of select="$cols-count"/>
              colwidthsNew=<xsl:copy-of select="$colwidths"/>
              colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->

              <xsl:variable name="margin-left">
                      <xsl:choose>
                              <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
                              <xsl:otherwise>0</xsl:otherwise>
                      </xsl:choose>
              </xsl:variable>

              <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">                   

                      <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">

                              <xsl:for-each select="xalan:nodeset($colwidths)//column">
                                      <xsl:choose>
                                              <xsl:when test=". = 1 or . = 0">
                                                      <fo:table-column column-width="proportional-column-width(2)"/>
                                              </xsl:when>
                                              <xsl:otherwise>
                                                      <fo:table-column column-width="proportional-column-width({.})"/>
                                              </xsl:otherwise>
                                      </xsl:choose>
                              </xsl:for-each>
                              <xsl:apply-templates/>
                      </fo:table>

              </fo:block-container>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getTableNumber">
              <xsl:choose>
                      <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
                              <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
                      </xsl:when>
                      <xsl:when test="ancestor::*[local-name()='annex']">

                      </xsl:when>
                      <xsl:otherwise>

                                      <xsl:number format="A." count="*[local-name()='annex']"/>
                                      <xsl:number format="1" level="any" count="//*[local-name()='table']                                       [not(ancestor::*[local-name()='annex'])                                        and not(ancestor::*[local-name()='executivesummary'])                                       and not(ancestor::*[local-name()='bibdata'])]                                       [not(@unnumbered) or @unnumbered != 'true']"/>

                      </xsl:otherwise>
              </xsl:choose>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']" mode="process">
              <xsl:apply-templates/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-columns-numbers">
              <xsl:param name="table-row"/>
              <xsl:variable name="columns-count" select="count($table-row/*)"/>
              <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
              <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
              <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-column-widths">
              <xsl:param name="table"/>
              <xsl:param name="cols-count"/>
              <xsl:param name="curr-col" select="1"/>
              <xsl:param name="width" select="0"/>

              <xsl:if test="$curr-col &lt;= $cols-count">
                      <xsl:variable name="widths">
                              <xsl:choose>
                                      <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
                                              <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
                                                      <xsl:variable name="words">
                                                              <xsl:call-template name="tokenize">
                                                                      <xsl:with-param name="text" select="translate(*[local-name()='th'][$curr-col],'- —:', '    ')"/>
                                                              </xsl:call-template>
                                                      </xsl:variable>
                                                      <xsl:variable name="max_length">
                                                              <xsl:call-template name="max_length">
                                                                      <xsl:with-param name="words" select="xalan:nodeset($words)"/>
                                                              </xsl:call-template>
                                                      </xsl:variable>
                                                      <width>
                                                              <xsl:value-of select="$max_length"/>
                                                      </width>
                                              </xsl:for-each>
                                              <xsl:for-each select="*[local-name()='tbody']//*[local-name()='tr']">
                                                      <xsl:variable name="words">
                                                              <xsl:call-template name="tokenize">
                                                                      <xsl:with-param name="text" select="translate(*[local-name()='td'][$curr-col],'- —:', '    ')"/>
                                                              </xsl:call-template>
                                                      </xsl:variable>
                                                      <xsl:variable name="max_length">
                                                              <xsl:call-template name="max_length">
                                                                      <xsl:with-param name="words" select="xalan:nodeset($words)"/>
                                                              </xsl:call-template>
                                                      </xsl:variable>
                                                      <width>
                                                              <xsl:value-of select="$max_length"/>
                                                      </width>

                                              </xsl:for-each>
                                      </xsl:when>
                                      <xsl:otherwise>
                                              <xsl:for-each select="xalan:nodeset($table)//tr">
                                                      <xsl:variable name="td_text">
                                                              <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
                                                      </xsl:variable>
                                                      <xsl:variable name="words">
                                                              <xsl:variable name="string_with_added_zerospaces">
                                                                      <xsl:call-template name="add-zero-spaces-java">
                                                                              <xsl:with-param name="text" select="$td_text"/>
                                                                      </xsl:call-template>
                                                              </xsl:variable>
                                                              <xsl:call-template name="tokenize">
                                                                      <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', '    ')"/> -->
                                                                      <!-- 2009 thinspace -->
                                                                      <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', '    ')"/> -->
                                                                      <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
                                                              </xsl:call-template>
                                                      </xsl:variable>
                                                      <xsl:variable name="max_length">
                                                              <xsl:call-template name="max_length">
                                                                      <xsl:with-param name="words" select="xalan:nodeset($words)"/>
                                                              </xsl:call-template>
                                                      </xsl:variable>
                                                      <width>
                                                              <xsl:variable name="divider">
                                                                      <xsl:choose>
                                                                              <xsl:when test="td[$curr-col]/@divide">
                                                                                      <xsl:value-of select="td[$curr-col]/@divide"/>
                                                                              </xsl:when>
                                                                              <xsl:otherwise>1</xsl:otherwise>
                                                                      </xsl:choose>
                                                              </xsl:variable>
                                                              <xsl:value-of select="$max_length div $divider"/>
                                                      </width>

                                              </xsl:for-each>

                                      </xsl:otherwise>
                              </xsl:choose>
                      </xsl:variable>

                      <column>
                              <xsl:for-each select="xalan:nodeset($widths)//width">
                                      <xsl:sort select="." data-type="number" order="descending"/>
                                      <xsl:if test="position()=1">
                                                      <xsl:value-of select="."/>
                                      </xsl:if>
                              </xsl:for-each>
                      </column>
                      <xsl:call-template name="calculate-column-widths">
                              <xsl:with-param name="cols-count" select="$cols-count"/>
                              <xsl:with-param name="curr-col" select="$curr-col +1"/>
                              <xsl:with-param name="table" select="$table"/>
                      </xsl:call-template>
              </xsl:if>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()" mode="td_text">
              <xsl:variable name="zero-space">​</xsl:variable>
              <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='termsource']" mode="td_text">
              <xsl:value-of select="*[local-name()='origin']/@citeas"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" mode="td_text">
              <xsl:value-of select="@target"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table2']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']" mode="process">
              <xsl:param name="cols-count"/>
              <!-- font-weight="bold" -->
              <fo:table-header>                       

                      <xsl:apply-templates/>
              </fo:table-header>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']" mode="process">
              <xsl:apply-templates/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertTableFooter">
              <xsl:param name="cols-count"/>
              <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
              <xsl:if test="../*[local-name()='tfoot'] or           $isNoteOrFnExist = 'true'">

                      <fo:table-footer>

                              <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>

                              <!-- if there are note(s) or fn(s) then create footer row -->
                              <xsl:if test="$isNoteOrFnExist = 'true'">

                                      <fo:table-row>
                                              <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">

                                                      <!-- fn will be processed inside 'note' processing -->

                                                      <!-- except gb -->

                                                              <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>

                                                      <!-- horizontal row separator -->

                                                      <!-- fn processing -->
                                                      <xsl:call-template name="fn_display"/>

                                              </fo:table-cell>
                                      </fo:table-row>

                              </xsl:if>
                      </fo:table-footer>

              </xsl:if>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tbody']">

              <xsl:variable name="cols-count">
                      <xsl:choose>
                              <xsl:when test="../*[local-name()='thead']">                                    
                                      <xsl:call-template name="calculate-columns-numbers">
                                              <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
                                      </xsl:call-template>
                              </xsl:when>
                              <xsl:otherwise>                                 
                                      <xsl:call-template name="calculate-columns-numbers">
                                              <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
                                      </xsl:call-template>
                              </xsl:otherwise>
                      </xsl:choose>
              </xsl:variable>

              <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
                      <xsl:with-param name="cols-count" select="$cols-count"/>
              </xsl:apply-templates>

              <xsl:call-template name="insertTableFooter">
                      <xsl:with-param name="cols-count" select="$cols-count"/>
              </xsl:call-template>

              <fo:table-body>
                      <xsl:apply-templates/>
                      <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->

              </fo:table-body>

      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']">
              <xsl:variable name="parent-name" select="local-name(..)"/>
              <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
              <fo:table-row min-height="4mm">
                              <xsl:if test="$parent-name = 'thead'">
                                      <xsl:attribute name="font-weight">bold</xsl:attribute>

                              </xsl:if>
                              <xsl:if test="$parent-name = 'tfoot'">

                              </xsl:if>

                      <xsl:apply-templates/>
              </fo:table-row>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th']">
              <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">

                      <xsl:if test="@colspan">
                              <xsl:attribute name="number-columns-spanned">
                                      <xsl:value-of select="@colspan"/>
                              </xsl:attribute>
                      </xsl:if>
                      <xsl:if test="@rowspan">
                              <xsl:attribute name="number-rows-spanned">
                                      <xsl:value-of select="@rowspan"/>
                              </xsl:attribute>
                      </xsl:if>
                      <fo:block>
                              <xsl:apply-templates/>
                      </fo:block>
              </fo:table-cell>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']">
              <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">

                      <xsl:if test="@colspan">
                              <xsl:attribute name="number-columns-spanned">
                                      <xsl:value-of select="@colspan"/>
                              </xsl:attribute>
                      </xsl:if>
                      <xsl:if test="@rowspan">
                              <xsl:attribute name="number-rows-spanned">
                                      <xsl:value-of select="@rowspan"/>
                              </xsl:attribute>
                      </xsl:if>
                      <fo:block>

                              <xsl:apply-templates/>
                      </fo:block>
                      <!-- <xsl:choose>
                              <xsl:when test="count(*) = 1 and *[local-name() = 'p']">
                                      <xsl:apply-templates />
                              </xsl:when>
                              <xsl:otherwise>
                                      <fo:block>
                                              <xsl:apply-templates />
                                      </fo:block>
                              </xsl:otherwise>
                      </xsl:choose> -->

              </fo:table-cell>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']" mode="process">

                      <fo:block font-size="10pt" margin-bottom="12pt">

                              <fo:inline padding-right="2mm">

                                      <xsl:value-of select="$title-note"/>

                                              <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
                                              <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
                                                      <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
                                              </xsl:if>

                              </fo:inline>
                              <xsl:apply-templates mode="process"/>
                      </fo:block>

      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
              <xsl:apply-templates/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display">
              <xsl:variable name="references">
                      <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
                              <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">

                                      <xsl:apply-templates/>
                              </fn>
                      </xsl:for-each>
              </xsl:variable>
              <xsl:for-each select="xalan:nodeset($references)//fn">
                      <xsl:variable name="reference" select="@reference"/>
                      <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
                              <fo:block margin-bottom="12pt">

                                      <fo:inline font-size="80%" padding-right="5mm" id="{@id}">

                                                      <xsl:attribute name="vertical-align">super</xsl:attribute>

                                              <xsl:value-of select="@reference"/>

                                      </fo:inline>
                                      <fo:inline>

                                              <xsl:apply-templates/>
                                      </fo:inline>
                              </fo:block>
                      </xsl:if>
              </xsl:for-each>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_name_display">
              <!-- <xsl:variable name="references">
                      <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
                              <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
                                      <xsl:apply-templates />
                              </fn>
                      </xsl:for-each>
              </xsl:variable>
              $references=<xsl:copy-of select="$references"/> -->
              <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
                      <xsl:variable name="reference" select="@reference"/>
                      <fo:block id="{@reference}_{ancestor::*[@id][1]/@id}"><xsl:value-of select="@reference"/></fo:block>
                      <fo:block margin-bottom="12pt">
                              <xsl:apply-templates/>
                      </fo:block>
              </xsl:for-each>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display_figure">
              <xsl:variable name="key_iso">
                       <!-- and (not(@class) or @class !='pseudocode') -->
              </xsl:variable>
              <xsl:variable name="references">
                      <xsl:for-each select=".//*[local-name()='fn']">
                              <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
                                      <xsl:apply-templates/>
                              </fn>
                      </xsl:for-each>
              </xsl:variable>
              <xsl:if test="xalan:nodeset($references)//fn">
                      <fo:block>
                              <fo:table width="95%" table-layout="fixed">
                                      <xsl:if test="normalize-space($key_iso) = 'true'">
                                              <xsl:attribute name="font-size">10pt</xsl:attribute>

                                      </xsl:if>
                                      <fo:table-column column-width="15%"/>
                                      <fo:table-column column-width="85%"/>
                                      <fo:table-body>
                                              <xsl:for-each select="xalan:nodeset($references)//fn">
                                                      <xsl:variable name="reference" select="@reference"/>
                                                      <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
                                                              <fo:table-row>
                                                                      <fo:table-cell>
                                                                              <fo:block>
                                                                                      <fo:inline font-size="80%" padding-right="5mm" vertical-align="super" id="{@id}">

                                                                                              <xsl:value-of select="@reference"/>
                                                                                      </fo:inline>
                                                                              </fo:block>
                                                                      </fo:table-cell>
                                                                      <fo:table-cell>
                                                                              <fo:block text-align="justify" margin-bottom="12pt">

                                                                                      <xsl:if test="normalize-space($key_iso) = 'true'">
                                                                                              <xsl:attribute name="margin-bottom">0</xsl:attribute>
                                                                                      </xsl:if>

                                                                                      <xsl:apply-templates/>
                                                                              </fo:block>
                                                                      </fo:table-cell>
                                                              </fo:table-row>
                                                      </xsl:if>
                                              </xsl:for-each>
                                      </fo:table-body>
                              </fo:table>
                      </fo:block>
              </xsl:if>

      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']">
              <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
              <fo:inline font-size="80%" keep-with-previous.within-line="always">

                      <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference   | ancestor::*[local-name()='clause'][1]/@id-->

                              <xsl:value-of select="@reference"/>
                      </fo:basic-link>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']/*[local-name()='p']">
              <fo:inline>
                      <xsl:apply-templates/>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']">
              <xsl:variable name="parent" select="local-name(..)"/>

              <xsl:variable name="key_iso">
                       <!-- and  (not(../@class) or ../@class !='pseudocode') -->
              </xsl:variable>

              <xsl:choose>
                      <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->

                                      <fo:block margin-bottom="12pt" text-align="left">

                                              <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
                                              <xsl:apply-templates select="*[local-name()='dt']/*"/>
                                              <xsl:text/>
                                              <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
                                      </fo:block>

                      </xsl:when>
                      <xsl:when test="$parent = 'formula'"> <!-- a few components -->
                              <fo:block margin-bottom="12pt" text-align="left">

                                      <xsl:value-of select="$title-where"/>
                              </fo:block>
                      </xsl:when>
                      <xsl:when test="$parent = 'figure' and  (not(../@class) or ../@class !='pseudocode')">
                              <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">

                                      <xsl:value-of select="$title-key"/>
                              </fo:block>
                      </xsl:when>
              </xsl:choose>

              <!-- a few components -->
              <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
                      <fo:block>

                              <fo:block>

                                      <!-- create virtual html table for dl/[dt and dd] -->
                                      <xsl:variable name="html-table">
                                              <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
                                              <xsl:element name="{$ns}:table">
                                                      <tbody>
                                                              <xsl:apply-templates mode="dl"/>
                                                      </tbody>
                                              </xsl:element>
                                      </xsl:variable>
                                      <!-- html-table<xsl:copy-of select="$html-table"/> -->
                                      <xsl:variable name="colwidths">
                                              <xsl:call-template name="calculate-column-widths">
                                                      <xsl:with-param name="cols-count" select="2"/>
                                                      <xsl:with-param name="table" select="$html-table"/>
                                              </xsl:call-template>
                                      </xsl:variable>
                                      <!-- colwidths=<xsl:value-of select="$colwidths"/> -->

                                      <fo:table width="95%" table-layout="fixed">

                                              <xsl:choose>
                                                      <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
                                                              <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
                                                      </xsl:when>
                                                      <xsl:when test="normalize-space($key_iso) = 'true'">
                                                              <xsl:attribute name="font-size">10pt</xsl:attribute>

                                                      </xsl:when>
                                              </xsl:choose>
                                              <xsl:choose>
                                                      <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
                                                              <fo:table-column column-width="50%"/>
                                                              <fo:table-column column-width="50%"/>
                                                      </xsl:when>
                                                      <xsl:otherwise>
                                                              <xsl:choose>
                                                                      <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
                                                                              <fo:table-column column-width="60%"/>
                                                                              <fo:table-column column-width="40%"/>
                                                                      </xsl:when> -->
                                                                      <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
                                                                              <fo:table-column column-width="50%"/>
                                                                              <fo:table-column column-width="50%"/>
                                                                      </xsl:when>
                                                                      <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
                                                                              <fo:table-column column-width="40%"/>
                                                                              <fo:table-column column-width="60%"/>
                                                                      </xsl:when>
                                                                      <xsl:otherwise>
                                                                              <xsl:for-each select="xalan:nodeset($colwidths)//column">
                                                                                      <xsl:choose>
                                                                                              <xsl:when test=". = 1 or . = 0">
                                                                                                      <fo:table-column column-width="proportional-column-width(2)"/>
                                                                                              </xsl:when>
                                                                                              <xsl:otherwise>
                                                                                                      <fo:table-column column-width="proportional-column-width({.})"/>
                                                                                              </xsl:otherwise>
                                                                                      </xsl:choose>
                                                                              </xsl:for-each>
                                                                      </xsl:otherwise>
                                                              </xsl:choose>
                                                              <!-- <fo:table-column column-width="15%"/>
                                                              <fo:table-column column-width="85%"/> -->
                                                      </xsl:otherwise>
                                              </xsl:choose>
                                              <fo:table-body>
                                                      <xsl:apply-templates>
                                                              <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
                                                      </xsl:apply-templates>
                                              </fo:table-body>
                                      </fo:table>
                              </fo:block>
                      </fo:block>
              </xsl:if>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']/*[local-name()='note']">
              <xsl:param name="key_iso"/>

              <!-- <tr>
                      <td>NOTE</td>
                      <td>
                              <xsl:apply-templates />
                      </td>
              </tr>
               -->
              <fo:table-row>
                      <fo:table-cell>
                              <fo:block margin-top="6pt">
                                      <xsl:if test="normalize-space($key_iso) = 'true'">
                                              <xsl:attribute name="margin-top">0</xsl:attribute>
                                      </xsl:if>
                                      <xsl:value-of select="$title-note"/>
                              </fo:block>
                      </fo:table-cell>
                      <fo:table-cell>
                              <fo:block>
                                      <xsl:apply-templates/>
                              </fo:block>
                      </fo:table-cell>
              </fo:table-row>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']" mode="dl">
              <tr>
                      <td>
                              <xsl:apply-templates/>
                      </td>
                      <td>

                                      <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>

                      </td>
              </tr>

      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']">
              <xsl:param name="key_iso"/>

              <fo:table-row>
                      <fo:table-cell>

                              <fo:block margin-top="6pt">

                                      <xsl:if test="normalize-space($key_iso) = 'true'">
                                              <xsl:attribute name="margin-top">0</xsl:attribute>

                                      </xsl:if>

                                      <xsl:apply-templates/>

                              </fo:block>
                      </fo:table-cell>
                      <fo:table-cell>
                              <fo:block>

                                              <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>

                              </fo:block>
                      </fo:table-cell>
              </fo:table-row>

      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl_process">
              <xsl:apply-templates/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="process">
              <xsl:apply-templates/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
              <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='em']">
              <fo:inline font-style="italic">
                      <xsl:apply-templates/>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='strong']">
              <fo:inline font-weight="bold">
                      <xsl:apply-templates/>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sup']">
              <fo:inline font-size="80%" vertical-align="super">
                      <xsl:apply-templates/>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sub']">
              <fo:inline font-size="80%" vertical-align="sub">
                      <xsl:apply-templates/>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tt']">
              <fo:inline font-family="Courier" font-size="10pt">                      
                      <xsl:apply-templates/>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='del']">
              <fo:inline font-size="10pt" color="red" text-decoration="line-through">
                      <xsl:apply-templates/>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()[ancestor::*[local-name()='smallcap']]">
              <xsl:variable name="text" select="normalize-space(.)"/>
              <fo:inline font-size="75%">
                              <xsl:if test="string-length($text) &gt; 0">
                                      <xsl:call-template name="recursiveSmallCaps">
                                              <xsl:with-param name="text" select="$text"/>
                                      </xsl:call-template>
                              </xsl:if>
                      </fo:inline> 
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="recursiveSmallCaps">
  <xsl:param name="text"/>
  <xsl:variable name="char" select="substring($text,1,1)"/>
  <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
  <xsl:choose>
    <xsl:when test="$char=$upperCase">
      <fo:inline font-size="{100 div 0.75}%">
        <xsl:value-of select="$upperCase"/>
      </fo:inline>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$upperCase"/>
    </xsl:otherwise>
  </xsl:choose>
  <xsl:if test="string-length($text) &gt; 1">
    <xsl:call-template name="recursiveSmallCaps">
      <xsl:with-param name="text" select="substring($text,2)"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="tokenize">
              <xsl:param name="text"/>
              <xsl:param name="separator" select="' '"/>
              <xsl:choose>
                      <xsl:when test="not(contains($text, $separator))">
                              <word>
                                      <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
                                      <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
                                      <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
                                      <xsl:variable name="len_str">
                                              <xsl:choose>
                                                      <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
                                                              <xsl:value-of select="$len_str_tmp * 1.5"/>
                                                      </xsl:when>
                                                      <xsl:otherwise>
                                                              <xsl:value-of select="$len_str_tmp"/>
                                                      </xsl:otherwise>
                                              </xsl:choose>
                                      </xsl:variable> 

                                      <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
                                              <xsl:message>
                                                      div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
                                                      len_str=<xsl:value-of select="$len_str"/>
                                                      len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
                                              </xsl:message>
                                      </xsl:if> -->
                                      <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
                                      <len_str><xsl:value-of select="$len_str"/></len_str> -->
                                      <xsl:choose>
                                              <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
                                                      <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
                                              </xsl:when>
                                              <xsl:otherwise>
                                                      <xsl:value-of select="$len_str"/>
                                              </xsl:otherwise>
                                      </xsl:choose>
                              </word>
                      </xsl:when>
                      <xsl:otherwise>
                              <word>
                                      <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
                              </word>
                              <xsl:call-template name="tokenize">
                                      <xsl:with-param name="text" select="substring-after($text, $separator)"/>
                              </xsl:call-template>
                      </xsl:otherwise>
              </xsl:choose>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="max_length">
              <xsl:param name="words"/>
              <xsl:for-each select="$words//word">
                              <xsl:sort select="." data-type="number" order="descending"/>
                              <xsl:if test="position()=1">
                                              <xsl:value-of select="."/>
                              </xsl:if>
              </xsl:for-each>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-java">
              <xsl:param name="text" select="."/>
              <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space  -->
              <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces">
              <xsl:param name="text" select="."/>
              <xsl:variable name="zero-space-after-chars">-</xsl:variable>
              <xsl:variable name="zero-space-after-dot">.</xsl:variable>
              <xsl:variable name="zero-space-after-colon">:</xsl:variable>
              <xsl:variable name="zero-space-after-equal">=</xsl:variable>
              <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
              <xsl:variable name="zero-space">​</xsl:variable>
              <xsl:choose>
                      <xsl:when test="contains($text, $zero-space-after-chars)">
                              <xsl:value-of select="substring-before($text, $zero-space-after-chars)"/>
                              <xsl:value-of select="$zero-space-after-chars"/>
                              <xsl:value-of select="$zero-space"/>
                              <xsl:call-template name="add-zero-spaces">
                                      <xsl:with-param name="text" select="substring-after($text, $zero-space-after-chars)"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:when test="contains($text, $zero-space-after-dot)">
                              <xsl:value-of select="substring-before($text, $zero-space-after-dot)"/>
                              <xsl:value-of select="$zero-space-after-dot"/>
                              <xsl:value-of select="$zero-space"/>
                              <xsl:call-template name="add-zero-spaces">
                                      <xsl:with-param name="text" select="substring-after($text, $zero-space-after-dot)"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:when test="contains($text, $zero-space-after-colon)">
                              <xsl:value-of select="substring-before($text, $zero-space-after-colon)"/>
                              <xsl:value-of select="$zero-space-after-colon"/>
                              <xsl:value-of select="$zero-space"/>
                              <xsl:call-template name="add-zero-spaces">
                                      <xsl:with-param name="text" select="substring-after($text, $zero-space-after-colon)"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:when test="contains($text, $zero-space-after-equal)">
                              <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
                              <xsl:value-of select="$zero-space-after-equal"/>
                              <xsl:value-of select="$zero-space"/>
                              <xsl:call-template name="add-zero-spaces">
                                      <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:when test="contains($text, $zero-space-after-underscore)">
                              <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
                              <xsl:value-of select="$zero-space-after-underscore"/>
                              <xsl:value-of select="$zero-space"/>
                              <xsl:call-template name="add-zero-spaces">
                                      <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:otherwise>
                              <xsl:value-of select="$text"/>
                      </xsl:otherwise>
              </xsl:choose>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-equal">
              <xsl:param name="text" select="."/>
              <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
              <xsl:variable name="zero-space-after-equal">=</xsl:variable>
              <xsl:variable name="zero-space">​</xsl:variable>
              <xsl:choose>
                      <xsl:when test="contains($text, $zero-space-after-equals)">
                              <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
                              <xsl:value-of select="$zero-space-after-equals"/>
                              <xsl:value-of select="$zero-space"/>
                              <xsl:call-template name="add-zero-spaces-equal">
                                      <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:when test="contains($text, $zero-space-after-equal)">
                              <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
                              <xsl:value-of select="$zero-space-after-equal"/>
                              <xsl:value-of select="$zero-space"/>
                              <xsl:call-template name="add-zero-spaces-equal">
                                      <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:otherwise>
                              <xsl:value-of select="$text"/>
                      </xsl:otherwise>
              </xsl:choose>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getSimpleTable">
              <xsl:variable name="simple-table">

                      <!-- Step 1. colspan processing -->
                      <xsl:variable name="simple-table-colspan">
                              <tbody>
                                      <xsl:apply-templates mode="simple-table-colspan"/>
                              </tbody>
                      </xsl:variable>

                      <!-- Step 2. rowspan processing -->
                      <xsl:variable name="simple-table-rowspan">
                              <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
                      </xsl:variable>

                      <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>

                      <!-- <xsl:choose>
                              <xsl:when test="current()//*[local-name()='th'][@colspan] or current()//*[local-name()='td'][@colspan] ">

                              </xsl:when>
                              <xsl:otherwise>
                                      <xsl:copy-of select="current()"/>
                              </xsl:otherwise>
                      </xsl:choose> -->
              </xsl:variable>
              <xsl:copy-of select="$simple-table"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
              <xsl:apply-templates mode="simple-table-colspan"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
              <xsl:choose>
                      <xsl:when test="@colspan">
                              <xsl:variable name="td">
                                      <xsl:element name="td">
                                              <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
                                              <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
                                              <xsl:apply-templates mode="simple-table-colspan"/>
                                      </xsl:element>
                              </xsl:variable>
                              <xsl:call-template name="repeatNode">
                                      <xsl:with-param name="count" select="@colspan"/>
                                      <xsl:with-param name="node" select="$td"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:otherwise>
                              <xsl:element name="td">
                                      <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
                                      <xsl:apply-templates mode="simple-table-colspan"/>
                              </xsl:element>
                      </xsl:otherwise>
              </xsl:choose>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']" mode="simple-table-colspan">
              <xsl:element name="tr">
                      <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
                      <xsl:apply-templates mode="simple-table-colspan"/>
              </xsl:element>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-colspan">
              <xsl:copy>
                              <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
              </xsl:copy>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="repeatNode">
              <xsl:param name="count"/>
              <xsl:param name="node"/>

              <xsl:if test="$count &gt; 0">
                      <xsl:call-template name="repeatNode">
                              <xsl:with-param name="count" select="$count - 1"/>
                              <xsl:with-param name="node" select="$node"/>
                      </xsl:call-template>
                      <xsl:copy-of select="$node"/>
              </xsl:if>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-rowspan">
              <xsl:copy>
                              <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
              </xsl:copy>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tbody" mode="simple-table-rowspan">
              <xsl:copy>
                              <xsl:copy-of select="tr[1]"/>
                              <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
                                              <xsl:with-param name="previousRow" select="tr[1]"/>
                              </xsl:apply-templates>
              </xsl:copy>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tr" mode="simple-table-rowspan">
              <xsl:param name="previousRow"/>
              <xsl:variable name="currentRow" select="."/>

              <xsl:variable name="normalizedTDs">
                              <xsl:for-each select="xalan:nodeset($previousRow)//td">
                                              <xsl:choose>
                                                              <xsl:when test="@rowspan &gt; 1">
                                                                              <xsl:copy>
                                                                                              <xsl:attribute name="rowspan">
                                                                                                              <xsl:value-of select="@rowspan - 1"/>
                                                                                              </xsl:attribute>
                                                                                              <xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
                                                                                              <xsl:copy-of select="node()"/>
                                                                              </xsl:copy>
                                                              </xsl:when>
                                                              <xsl:otherwise>
                                                                              <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
                                                              </xsl:otherwise>
                                              </xsl:choose>
                              </xsl:for-each>
              </xsl:variable>

              <xsl:variable name="newRow">
                              <xsl:copy>
                                              <xsl:copy-of select="$currentRow/@*"/>
                                              <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
                              </xsl:copy>
              </xsl:variable>
              <xsl:copy-of select="$newRow"/>

              <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
                              <xsl:with-param name="previousRow" select="$newRow"/>
              </xsl:apply-templates>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getLang">
              <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
              <xsl:choose>
                      <xsl:when test="$language = 'English'">en</xsl:when>
                      <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
              </xsl:choose>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="capitalizeWords">
              <xsl:param name="str"/>
              <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
              <xsl:choose>
                      <xsl:when test="contains($str2, ' ')">
                              <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
                              <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
                              <xsl:value-of select="substring($substr, 2)"/>
                              <xsl:text> </xsl:text>
                              <xsl:call-template name="capitalizeWords">
                                      <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
                              </xsl:call-template>
                      </xsl:when>
                      <xsl:otherwise>
                              <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
                              <xsl:value-of select="substring($str2, 2)"/>
                      </xsl:otherwise>
              </xsl:choose>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="mathml:math">
              <fo:inline font-family="STIX2Math">
                      <fo:instream-foreign-object fox:alt-text="Math"> 
                              <xsl:copy-of select="."/>
                      </fo:instream-foreign-object>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='localityStack']">
              <xsl:for-each select="*[local-name()='locality']">
                      <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
                      <xsl:apply-templates select="."/>
                      <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
              </xsl:for-each>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" name="link">
              <xsl:variable name="target">
                      <xsl:choose>
                              <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
                                      <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
                              </xsl:when>
                              <xsl:otherwise>
                                      <xsl:value-of select="normalize-space(@target)"/>
                              </xsl:otherwise>
                      </xsl:choose>
              </xsl:variable>
              <fo:inline xsl:use-attribute-sets="link-style">
                      <xsl:choose>
                              <xsl:when test="$target = ''">
                                      <xsl:apply-templates/>
                              </xsl:when>
                              <xsl:otherwise>
                                      <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
                                              <xsl:choose>
                                                      <xsl:when test="normalize-space(.) = ''">
                                                              <xsl:value-of select="$target"/>
                                                      </xsl:when>
                                                      <xsl:otherwise>
                                                              <xsl:apply-templates/>
                                                      </xsl:otherwise>
                                              </xsl:choose>
                                      </fo:basic-link>
                              </xsl:otherwise>
                      </xsl:choose>
              </fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sourcecode']" name="sourcecode">
              <fo:block xsl:use-attribute-sets="sourcecode-style">
                      <!-- <xsl:choose>
                              <xsl:when test="@lang = 'en'"></xsl:when>
                              <xsl:otherwise> -->
                                      <xsl:attribute name="white-space">pre</xsl:attribute>
                                      <xsl:attribute name="wrap-option">wrap</xsl:attribute>
                              <!-- </xsl:otherwise>
                      </xsl:choose> -->
                      <xsl:apply-templates/>
              </fo:block>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='bookmark']">
              <fo:inline id="{@id}"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']">
              <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
                      <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
                      <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
              </fo:block>
              <xsl:apply-templates/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
              <fo:inline><xsl:apply-templates/></fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']">
              <fo:block xsl:use-attribute-sets="appendix-example-style">
                      <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
                      <xsl:value-of select="$title-example"/>
                      <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
                                      <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
                              </xsl:if>
                      <xsl:if test="*[local-name()='name']">
                              <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
                      </xsl:if>
              </fo:block>
              <xsl:apply-templates/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
              <fo:inline><xsl:apply-templates/></fo:inline>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'callout']">         
              <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']">
              <xsl:variable name="annotation-id" select="@id"/>
              <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>            
              <fo:block id="{$annotation-id}" white-space="nowrap">                   
                      <fo:inline>                             
                              <xsl:apply-templates>
                                      <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
                              </xsl:apply-templates>
                      </fo:inline>
              </fo:block>             
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']/*[local-name() = 'p']">
              <xsl:param name="callout"/>
              <fo:inline id="{@id}">
                      <!-- for first p in annotation, put <x> -->
                      <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
                      <xsl:apply-templates/>
              </fo:inline>            
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="convertDate">
              <xsl:param name="date"/>
              <xsl:param name="format" select="'short'"/>
              <xsl:variable name="year" select="substring($date, 1, 4)"/>
              <xsl:variable name="month" select="substring($date, 6, 2)"/>
              <xsl:variable name="day" select="substring($date, 9, 2)"/>
              <xsl:variable name="monthStr">
                      <xsl:choose>
                              <xsl:when test="$month = '01'">January</xsl:when>
                              <xsl:when test="$month = '02'">February</xsl:when>
                              <xsl:when test="$month = '03'">March</xsl:when>
                              <xsl:when test="$month = '04'">April</xsl:when>
                              <xsl:when test="$month = '05'">May</xsl:when>
                              <xsl:when test="$month = '06'">June</xsl:when>
                              <xsl:when test="$month = '07'">July</xsl:when>
                              <xsl:when test="$month = '08'">August</xsl:when>
                              <xsl:when test="$month = '09'">September</xsl:when>
                              <xsl:when test="$month = '10'">October</xsl:when>
                              <xsl:when test="$month = '11'">November</xsl:when>
                              <xsl:when test="$month = '12'">December</xsl:when>
                      </xsl:choose>
              </xsl:variable>
              <xsl:variable name="result">
                      <xsl:choose>
                              <xsl:when test="$format = 'short' or $day = ''">
                                      <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
                              </xsl:when>
                              <xsl:otherwise>
                                      <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
                              </xsl:otherwise>
                      </xsl:choose>
              </xsl:variable>
              <xsl:value-of select="$result"/>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeywords">
              <xsl:param name="sorting" select="'true'"/>
              <xsl:param name="charAtEnd" select="'.'"/>
              <xsl:param name="charDelim" select="', '"/>
              <xsl:choose>
                      <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
                              <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
                                      <xsl:sort data-type="text" order="ascending"/>
                                      <xsl:call-template name="insertKeyword">
                                              <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
                                              <xsl:with-param name="charDelim" select="$charDelim"/>
                                      </xsl:call-template>
                              </xsl:for-each>
                      </xsl:when>
                      <xsl:otherwise>
                              <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
                                      <xsl:call-template name="insertKeyword">
                                              <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
                                              <xsl:with-param name="charDelim" select="$charDelim"/>
                                      </xsl:call-template>
                              </xsl:for-each>
                      </xsl:otherwise>
              </xsl:choose>
      </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeyword">
              <xsl:param name="charAtEnd"/>
              <xsl:param name="charDelim"/>
              <xsl:apply-templates/>
              <xsl:choose>
                      <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
                      <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
              </xsl:choose>
      </xsl:template></xsl:stylesheet>