lib/isodoc/itu/itu.recommendation-supplement.xsl in metanorma-itu-1.3.0 vs lib/isodoc/itu/itu.recommendation-supplement.xsl in metanorma-itu-1.3.1

- old
+ new

@@ -116,14 +116,21 @@ <xsl:variable name="isAmendment" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:amendment[@language = $lang])"/> <xsl:variable name="isCorrigendum" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:corrigendum[@language = $lang])"/> <xsl:template match="/"> <xsl:call-template name="namespaceCheck"/> - <fo:root font-family="Times New Roman, STIX Two Math" font-size="12pt" xml:lang="{$lang}"> + <fo:root xsl:use-attribute-sets="root-style"> + <xsl:if test="$lang != 'ar'"> + <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute> + </xsl:if> <xsl:if test="$doctype = 'resolution'"> <xsl:attribute name="font-size">11pt</xsl:attribute> </xsl:if> + <xsl:call-template name="setWritingMode"/> + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute> + </xsl:if> <fo:layout-master-set> <!-- Technical Report first page --> <fo:simple-page-master master-name="TR-first-page" page-width="{$pageWidth}" page-height="{$pageHeight}"> @@ -320,11 +327,11 @@ </fo:flow> </fo:page-sequence> </xsl:if> <!-- cover page --> - <fo:page-sequence master-reference="cover-page"> + <fo:page-sequence master-reference="cover-page" writing-mode="lr-tb"> <xsl:if test="$doctype = 'resolution'"> <xsl:attribute name="force-page-count">no-force</xsl:attribute> </xsl:if> <fo:flow flow-name="xsl-region-body"> @@ -341,11 +348,11 @@ </fo:block> </fo:block-container> <fo:block-container absolute-position="fixed" left="-7mm" top="0" font-size="0"> - <fo:block> + <fo:block text-align="left"> <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Fond-Rec))}" width="43.6mm" content-height="299.2mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Cover Page"/> </fo:block> </fo:block-container> <fo:block-container font-family="Arial"> <fo:table width="100%" table-layout="fixed"> <!-- 175.4mm--> @@ -357,102 +364,125 @@ <fo:table-row height="37.5mm"> <!-- 42.5mm --> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="3"> - <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working --> - <fo:block><xsl:value-of select="$linebreak"/></fo:block> - <xsl:call-template name="addLetterSpacing"> - <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/> - </xsl:call-template> - </fo:block> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working --> + <fo:block><xsl:value-of select="$linebreak"/></fo:block> + <xsl:call-template name="addLetterSpacing"> + <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/> + </xsl:call-template> + </fo:block> + </fo:block-container> </fo:table-cell> </fo:table-row> <fo:table-row> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> <fo:table-cell padding-top="2mm" padding-bottom="-1mm"> - <fo:block font-family="Arial" font-size="36pt" font-weight="bold" margin-top="6pt" letter-spacing="2pt"> <!-- Helvetica for letter-spacing working --> - <xsl:value-of select="substring-before(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/> - </fo:block> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block font-family="Arial" font-size="36pt" font-weight="bold" margin-top="6pt" letter-spacing="2pt"> <!-- Helvetica for letter-spacing working --> + <fo:block> + <xsl:value-of select="substring-before(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/> + </fo:block> + </fo:block> + </fo:block-container> </fo:table-cell> <fo:table-cell padding-top="1mm" number-columns-spanned="2" padding-bottom="-1mm"> - <fo:block font-size="30pt" font-weight="bold" text-align="right" margin-top="12pt" padding="0mm"> - <xsl:choose> - <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'"> - <xsl:value-of select="$doctypeTitle"/> - </xsl:when> - <xsl:when test="$doctype = 'implementers-guide'"> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU-Recommendation']"/> - <xsl:text> </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/> - </xsl:when> - <xsl:when test="$doctype = 'resolution'"/> - <xsl:when test="$doctype = 'recommendation-supplement'"> - <!-- Series L --> - <xsl:variable name="title-series"> - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">series</xsl:with-param> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block font-size="30pt" font-weight="bold" text-align="right" margin-top="12pt" padding="0mm"> + <xsl:choose> + <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'"> + <xsl:value-of select="$doctypeTitle"/> + </xsl:when> + <xsl:when test="$doctype = 'implementers-guide'"> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU-Recommendation']"/> + <xsl:text> </xsl:text> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/> + </xsl:when> + <xsl:when test="$doctype = 'resolution'"/> + <xsl:when test="$doctype = 'recommendation-supplement'"> + <!-- Series L --> + <xsl:variable name="title-series"> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">series</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="capitalize"> + <xsl:with-param name="str" select="$title-series"/> </xsl:call-template> - </xsl:variable> - <xsl:call-template name="capitalize"> - <xsl:with-param name="str" select="$title-series"/> - </xsl:call-template> - <xsl:text> </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type='main']/itu:title[@type='abbrev']"/> - <!-- Ex. Supplement 37 --> - <fo:block font-size="18pt"> - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">doctype_dict.recommendation-supplement</xsl:with-param> - </xsl:call-template> <xsl:text> </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docnumber"/> - </fo:block> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="substring-after(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/> - </xsl:otherwise> - </xsl:choose> - </fo:block> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type='main']/itu:title[@type='abbrev']"/> + <!-- Ex. Supplement 37 --> + <fo:block font-size="18pt"> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">doctype_dict.recommendation-supplement</xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docnumber"/> + </fo:block> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/> + </xsl:otherwise> + </xsl:choose> + </fo:block> + </fo:block-container> </fo:table-cell> </fo:table-row> <fo:table-row height="17.2mm"> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> <fo:table-cell font-size="10pt" number-columns-spanned="2" padding-top="1mm"> - <fo:block> - <xsl:text>TELECOMMUNICATION</xsl:text> - </fo:block> - <fo:block> - <xsl:text>STANDARDIZATION SECTOR</xsl:text> - </fo:block> - <fo:block> - <xsl:text>OF ITU</xsl:text> - </fo:block> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block> + <xsl:text>TELECOMMUNICATION</xsl:text> + </fo:block> + <fo:block> + <xsl:text>STANDARDIZATION SECTOR</xsl:text> + </fo:block> + <fo:block> + <xsl:text>OF ITU</xsl:text> + </fo:block> + </fo:block-container> </fo:table-cell> <fo:table-cell text-align="right"> <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"> - <fo:block font-size="18pt" font-weight="bold"> - <xsl:variable name="title-annex"> - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-annex'"/> - </xsl:call-template> - </xsl:variable> - <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/> - </fo:block> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block font-size="18pt" font-weight="bold"> + <xsl:variable name="title-annex"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-annex'"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/> + </fo:block> + </fo:block-container> </xsl:if> <xsl:if test="$isAmendment != ''"> - <fo:block font-size="18pt" font-weight="bold"> - <xsl:value-of select="$isAmendment"/> - </fo:block> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block font-size="18pt" font-weight="bold"> + <xsl:value-of select="$isAmendment"/> + </fo:block> + </fo:block-container> </xsl:if> <xsl:if test="$isCorrigendum != ''"> - <fo:block font-size="18pt" font-weight="bold"> - <xsl:value-of select="$isCorrigendum"/> - </fo:block> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block font-size="18pt" font-weight="bold"> + <xsl:value-of select="$isCorrigendum"/> + </fo:block> + </fo:block-container> </xsl:if> <fo:block font-size="14pt"> <xsl:choose> <xsl:when test="($doctype = 'technical-report' or $doctype = 'technical-paper') and /itu:itu-standard/itu:bibdata/itu:version/itu:revision-date"> <xsl:text>(</xsl:text> @@ -473,207 +503,218 @@ <fo:table-row height="64mm"> <!-- 59mm --> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm" display-align="after"> - <fo:block padding-bottom="7mm"> - <xsl:if test="$doctype = 'resolution'"> - <fo:block><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting"/></fo:block> - <fo:block> - <xsl:variable name="meeting-place" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-place"/> - <xsl:variable name="meeting-date_from" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:from"/> - <xsl:variable name="meeting-date_from_year" select="substring($meeting-date_from, 1, 4)"/> - <xsl:variable name="meeting-date_to" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:to"/> - <xsl:variable name="meeting-date_to_year" select="substring($meeting-date_to, 1, 4)"/> - - <xsl:variable name="date_format"> - <xsl:choose> - <xsl:when test="$meeting-date_from_year = $meeting-date_to_year">ddMM</xsl:when> - <xsl:otherwise>ddMMyyyy</xsl:otherwise> - </xsl:choose> - </xsl:variable> - <xsl:variable name="meeting-date_from_str"> - <xsl:call-template name="convertDateLocalized"> - <xsl:with-param name="date" select="$meeting-date_from"/> - <xsl:with-param name="format" select="$date_format"/> - </xsl:call-template> - </xsl:variable> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block padding-bottom="7mm"> + <xsl:if test="$doctype = 'resolution'"> + <fo:block><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting"/></fo:block> + <fo:block> + <xsl:variable name="meeting-place" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-place"/> + <xsl:variable name="meeting-date_from" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:from"/> + <xsl:variable name="meeting-date_from_year" select="substring($meeting-date_from, 1, 4)"/> + <xsl:variable name="meeting-date_to" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:to"/> + <xsl:variable name="meeting-date_to_year" select="substring($meeting-date_to, 1, 4)"/> + + <xsl:variable name="date_format"> + <xsl:choose> + <xsl:when test="$meeting-date_from_year = $meeting-date_to_year">ddMM</xsl:when> + <xsl:otherwise>ddMMyyyy</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="meeting-date_from_str"> + <xsl:call-template name="convertDateLocalized"> + <xsl:with-param name="date" select="$meeting-date_from"/> + <xsl:with-param name="format" select="$date_format"/> + </xsl:call-template> + </xsl:variable> - <xsl:variable name="meeting-date_to_str"> - <xsl:call-template name="convertDateLocalized"> - <xsl:with-param name="date" select="$meeting-date_to"/> - <xsl:with-param name="format" select="'ddMMyyyy'"/> - </xsl:call-template> - </xsl:variable> - - <xsl:value-of select="$meeting-place"/> - <xsl:if test="$meeting-place != '' and (normalize-space($meeting-date_from_str) != '' or normalize-space($meeting-date_to_str != ''))"> - <xsl:text>, </xsl:text> - <xsl:value-of select="$meeting-date_from_str"/> - <xsl:if test="normalize-space($meeting-date_from_str) != '' and normalize-space($meeting-date_to_str) != ''"> - <xsl:text> – </xsl:text> - </xsl:if> - <xsl:value-of select="$meeting-date_to_str"/> - </xsl:if> - </fo:block> - </xsl:if> - <fo:block text-transform="uppercase"> - <xsl:variable name="series_title" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title[@type = 'full'])"/> - <xsl:if test="$series_title != ''"> - <xsl:variable name="title"> - <xsl:if test="$doctype != 'resolution'"> - <!-- <xsl:text>Series </xsl:text> --> - <xsl:call-template name="getLocalizedString"> - <xsl:with-param name="key">series</xsl:with-param> + <xsl:variable name="meeting-date_to_str"> + <xsl:call-template name="convertDateLocalized"> + <xsl:with-param name="date" select="$meeting-date_to"/> + <xsl:with-param name="format" select="'ddMMyyyy'"/> </xsl:call-template> - <xsl:text> </xsl:text> + </xsl:variable> + + <xsl:value-of select="$meeting-place"/> + <xsl:if test="$meeting-place != '' and (normalize-space($meeting-date_from_str) != '' or normalize-space($meeting-date_to_str != ''))"> + <xsl:text>, </xsl:text> + <xsl:value-of select="$meeting-date_from_str"/> + <xsl:if test="normalize-space($meeting-date_from_str) != '' and normalize-space($meeting-date_to_str) != ''"> + <xsl:text> – </xsl:text> + </xsl:if> + <xsl:value-of select="$meeting-date_to_str"/> </xsl:if> - <xsl:value-of select="$series_title"/> - </xsl:variable> - <xsl:value-of select="$title"/> + </fo:block> </xsl:if> - </fo:block> - <xsl:choose> - <xsl:when test="$doctype = 'recommendation-supplement'"/> - <xsl:otherwise> - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series"> - <fo:block margin-top="6pt"> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/> - <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''"> - <xsl:text> — </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/> + <fo:block text-transform="uppercase"> + <xsl:variable name="series_title" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title[@type = 'full'])"/> + <xsl:if test="$series_title != ''"> + <xsl:variable name="title"> + <xsl:if test="$doctype != 'resolution'"> + <!-- <xsl:text>Series </xsl:text> --> + <xsl:call-template name="getLocalizedString"> + <xsl:with-param name="key">series</xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> </xsl:if> - </fo:block> + <xsl:value-of select="$series_title"/> + </xsl:variable> + <xsl:value-of select="$title"/> </xsl:if> - </xsl:otherwise> - </xsl:choose> - - </fo:block> + </fo:block> + <xsl:choose> + <xsl:when test="$doctype = 'recommendation-supplement'"/> + <xsl:otherwise> + <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series"> + <fo:block margin-top="6pt"> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/> + <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''"> + <xsl:text> — </xsl:text> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/> + </xsl:if> + </fo:block> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </fo:block> + </fo:block-container> </fo:table-cell> </fo:table-row> <fo:table-row height="40mm"> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> <fo:table-cell font-size="18pt" number-columns-spanned="3"> - <fo:block padding-right="2mm" margin-top="6pt"> - <xsl:if test="not(/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']) and $isAmendment = '' and $isCorrigendum = ''"> - <xsl:attribute name="font-weight">bold</xsl:attribute> - </xsl:if> - <xsl:if test="($doctype = 'technical-report' or $doctype = 'technical-paper') and /itu:itu-standard/itu:bibdata/itu:docnumber"> - <fo:block font-weight="bold"> - <xsl:value-of select="$xSTR-ACRONYM"/> - </fo:block> - </xsl:if> - <xsl:if test="$doctype = 'implementers-guide'"> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/> - <xsl:text> for </xsl:text> - </xsl:if> - <xsl:if test="$doctype = 'resolution'"> - <!-- Resolution 1 --> - <xsl:value-of select="$doctypeTitle"/><xsl:text> </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/> - <xsl:text> – </xsl:text> - </xsl:if> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'main' and @language = 'en']"/> - </fo:block> - <xsl:for-each select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']"> - <fo:block font-weight="bold"> - <xsl:value-of select="."/> - </fo:block> - </xsl:for-each> - <xsl:if test="$isAmendment != ''"> - <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold"> - <xsl:value-of select="$isAmendment"/> - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']"> - <xsl:text>: </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']"/> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block padding-right="2mm" margin-top="6pt"> + <xsl:if test="not(/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']) and $isAmendment = '' and $isCorrigendum = ''"> + <xsl:attribute name="font-weight">bold</xsl:attribute> </xsl:if> - </fo:block> - </xsl:if> - <xsl:if test="$isCorrigendum != ''"> - <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold"> - <xsl:value-of select="$isCorrigendum"/> - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']"> - <xsl:text>: </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']"/> + <xsl:if test="($doctype = 'technical-report' or $doctype = 'technical-paper') and /itu:itu-standard/itu:bibdata/itu:docnumber"> + <fo:block font-weight="bold"> + <xsl:value-of select="$xSTR-ACRONYM"/> + </fo:block> </xsl:if> + <xsl:if test="$doctype = 'implementers-guide'"> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/> + <xsl:text> for </xsl:text> + </xsl:if> + <xsl:if test="$doctype = 'resolution'"> + <!-- Resolution 1 --> + <xsl:value-of select="$doctypeTitle"/><xsl:text> </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/> + <xsl:text> – </xsl:text> + </xsl:if> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'main' and @language = 'en']"/> </fo:block> - </xsl:if> + <xsl:for-each select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']"> + <fo:block font-weight="bold"> + <xsl:value-of select="."/> + </fo:block> + </xsl:for-each> + <xsl:if test="$isAmendment != ''"> + <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold"> + <xsl:value-of select="$isAmendment"/> + <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']"> + <xsl:text>: </xsl:text> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']"/> + </xsl:if> + </fo:block> + </xsl:if> + <xsl:if test="$isCorrigendum != ''"> + <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold"> + <xsl:value-of select="$isCorrigendum"/> + <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']"> + <xsl:text>: </xsl:text> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']"/> + </xsl:if> + </fo:block> + </xsl:if> + </fo:block-container> </fo:table-cell> </fo:table-row> <fo:table-row height="40mm"> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="3"> - <xsl:choose> - <xsl:when test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']"> - <xsl:attribute name="border">0.7mm solid black</xsl:attribute> - <fo:block padding-top="3mm" margin-left="1mm" margin-right="1mm"> - <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']" mode="caution"/> - </fo:block> - </xsl:when> - <xsl:otherwise> - <fo:block> </fo:block> - </xsl:otherwise> - </xsl:choose> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <xsl:choose> + <xsl:when test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']"> + <xsl:attribute name="border">0.7mm solid black</xsl:attribute> + <fo:block padding-top="3mm" margin-left="1mm" margin-right="1mm"> + <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']" mode="caution"/> + </fo:block> + </xsl:when> + <xsl:otherwise> + <fo:block> </fo:block> + </xsl:otherwise> + </xsl:choose> + </fo:block-container> </fo:table-cell> </fo:table-row> <fo:table-row height="25mm"> <fo:table-cell> <fo:block> </fo:block> </fo:table-cell> <fo:table-cell number-columns-spanned="3"> - <fo:block font-size="16pt" margin-top="3pt"> - <xsl:if test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']"> - <xsl:attribute name="margin-top">6pt</xsl:attribute> - <xsl:if test="$doctype = 'recommendation-supplement'"> - <xsl:attribute name="margin-top">12pt</xsl:attribute> - </xsl:if> - </xsl:if> - - <xsl:choose> - <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'"> - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage"> - <xsl:call-template name="capitalizeWords"> - <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:status/itu:stage"/> - </xsl:call-template> - <xsl:text> </xsl:text> + <fo:block-container> + <xsl:call-template name="setWritingMode"/> + <fo:block font-size="16pt" margin-top="3pt"> + <xsl:if test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']"> + <xsl:attribute name="margin-top">6pt</xsl:attribute> + <xsl:if test="$doctype = 'recommendation-supplement'"> + <xsl:attribute name="margin-top">12pt</xsl:attribute> </xsl:if> - <xsl:value-of select="$doctypeTitle"/> - <xsl:text>  </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU']"/> - </xsl:when> - <xsl:when test="$doctype = 'implementers-guide'"/> - <xsl:when test="$doctype = 'resolution'"/> - <xsl:when test="$doctype = 'recommendation-supplement'"> - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage = 'draft'">Draft </xsl:if> - <xsl:text>ITU-</xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:editorialgroup/itu:bureau"/><xsl:text> </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement']"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$doctypeTitle"/> - <xsl:text>  </xsl:text> - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"/> - <xsl:text>-</xsl:text> - </xsl:if> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:bureau"/> - <xsl:text>  </xsl:text> - <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/> - </xsl:otherwise> - </xsl:choose> - - <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"> - <xsl:variable name="title-annex"> - <xsl:call-template name="getTitle"> - <xsl:with-param name="name" select="'title-annex'"/> - </xsl:call-template> - </xsl:variable> - <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/> - </xsl:if> - </fo:block> + </xsl:if> + + <xsl:choose> + <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'"> + <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage"> + <xsl:call-template name="capitalizeWords"> + <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:status/itu:stage"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select="$doctypeTitle"/> + <xsl:text>  </xsl:text> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU']"/> + </xsl:when> + <xsl:when test="$doctype = 'implementers-guide'"/> + <xsl:when test="$doctype = 'resolution'"/> + <xsl:when test="$doctype = 'recommendation-supplement'"> + <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage = 'draft'">Draft </xsl:if> + <xsl:text>ITU-</xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:editorialgroup/itu:bureau"/><xsl:text> </xsl:text> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement']"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$doctypeTitle"/> + <xsl:text>  </xsl:text> + <xsl:if test="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"/> + <xsl:text>-</xsl:text> + </xsl:if> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:bureau"/> + <xsl:text>  </xsl:text> + <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"> + <xsl:variable name="title-annex"> + <xsl:call-template name="getTitle"> + <xsl:with-param name="name" select="'title-annex'"/> + </xsl:call-template> + </xsl:variable> + <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/> + </xsl:if> + </fo:block> + </fo:block-container> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </fo:block-container> @@ -752,11 +793,11 @@ <fo:block margin-top="6pt" text-align="center" font-weight="bold"> <xsl:call-template name="getLocalizedString"> <xsl:with-param name="key">table_of_contents</xsl:with-param> </xsl:call-template> </fo:block> - <fo:block margin-top="6pt" text-align="right" font-weight="bold"> + <fo:block margin-top="6pt" text-align="end" font-weight="bold"> <xsl:call-template name="getLocalizedString"> <xsl:with-param name="key">Page.sg</xsl:with-param> </xsl:call-template> </fo:block> @@ -823,11 +864,11 @@ </xsl:variable> <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always"> <xsl:value-of select="$title-list-tables"/> </fo:block> - <fo:block margin-top="6pt" text-align="right" font-weight="bold" keep-with-next="always"> + <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always"> <xsl:call-template name="getLocalizedString"> <xsl:with-param name="key">Page.sg</xsl:with-param> </xsl:call-template> </fo:block> @@ -855,11 +896,11 @@ <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always"> <xsl:value-of select="$title-list-figures"/> </fo:block> - <fo:block margin-top="6pt" text-align="right" font-weight="bold" keep-with-next="always"> + <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always"> <xsl:call-template name="getLocalizedString"> <xsl:with-param name="key">Page.sg</xsl:with-param> </xsl:call-template> </fo:block> @@ -1154,16 +1195,23 @@ </xsl:if> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="@class='supertitle'">center</xsl:when> - <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when> + <!-- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when> --> + <xsl:when test="@align"><xsl:call-template name="setAlignment"/></xsl:when> <xsl:when test="ancestor::*[1][local-name() = 'td']/@align"> - <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/> + <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/> --> + <xsl:call-template name="setAlignment"> + <xsl:with-param name="align" select="ancestor::*[1][local-name() = 'td']/@align"/> + </xsl:call-template> </xsl:when> <xsl:when test="ancestor::*[1][local-name() = 'th']/@align"> - <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/> + <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/> --> + <xsl:call-template name="setAlignment"> + <xsl:with-param name="align" select="ancestor::*[1][local-name() = 'th']/@align"/> + </xsl:call-template> </xsl:when> <xsl:otherwise>justify</xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:apply-templates/> @@ -1373,10 +1421,11 @@ </xsl:variable> <xsl:variable name="text-align"> <xsl:choose> <xsl:when test="$level = 1 and $doctype = 'resolution'">center</xsl:when> + <xsl:when test="$lang = 'ar'">start</xsl:when> <xsl:otherwise>left</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:element name="{$element-name}"> @@ -1663,23 +1712,29 @@ <xsl:call-template name="getListItemFormat"/> </fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()"> <fo:block-container> + <xsl:variable name="attribute-margin"> + <xsl:choose> + <xsl:when test="$lang = 'ar'">margin-right</xsl:when> + <xsl:otherwise>margin-left</xsl:otherwise> + </xsl:choose> + </xsl:variable> <xsl:if test="../preceding-sibling::*[1][local-name() = 'title']"> - <xsl:attribute name="margin-left">18mm</xsl:attribute> + <xsl:attribute name="{$attribute-margin}">18mm</xsl:attribute> </xsl:if> <xsl:if test="local-name(..) = 'ul'"> - <xsl:attribute name="margin-left">7mm</xsl:attribute><!-- 15mm --> + <xsl:attribute name="{$attribute-margin}">7mm</xsl:attribute><!-- 15mm --> <xsl:if test="ancestor::itu:table"> - <xsl:attribute name="margin-left">4.5mm</xsl:attribute> + <xsl:attribute name="{$attribute-margin}">4.5mm</xsl:attribute> </xsl:if> <!-- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1"> <xsl:attribute name="margin-left">7mm</xsl:attribute> </xsl:if> --> </xsl:if> - <fo:block-container margin-left="0mm"> + <fo:block-container margin-left="0mm" margin-right="0mm"> <fo:block> <xsl:apply-templates/> <xsl:apply-templates select=".//itu:note" mode="process"/> </fo:block> </fo:block-container> @@ -1754,24 +1809,12 @@ <xsl:template match="itu:formula" mode="process"> <xsl:call-template name="formula"/> </xsl:template> + - <xsl:template match="mathml:math" priority="2"> - <fo:inline font-family="STIX Two Math" font-size="11pt"> - <xsl:variable name="mathml"> - <xsl:apply-templates select="." mode="mathml"/> - </xsl:variable> - <fo:instream-foreign-object fox:alt-text="Math"> - <!-- <xsl:copy-of select="."/> --> - <xsl:copy-of select="xalan:nodeset($mathml)"/> - </fo:instream-foreign-object> - </fo:inline> - </xsl:template> - - <xsl:template match="itu:references[@normative='true']"> <fo:block id="{@id}"> <xsl:apply-templates/> </fo:block> </xsl:template> @@ -1791,14 +1834,14 @@ <fo:table table-layout="fixed" width="100%" display-align="after"> <fo:table-column column-width="10%"/> <fo:table-column column-width="90%"/> <fo:table-body> <fo:table-row> - <fo:table-cell text-align="left" padding-bottom="8mm"> + <fo:table-cell text-align="start" padding-bottom="8mm"> <fo:block><fo:page-number/></fo:block> </fo:table-cell> - <fo:table-cell font-weight="bold" text-align="left" padding-bottom="8mm"> + <fo:table-cell font-weight="bold" text-align="start" padding-bottom="8mm"> <fo:block><xsl:value-of select="$footer-text"/></fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> @@ -1809,14 +1852,14 @@ <fo:table table-layout="fixed" width="100%" display-align="after"> <fo:table-column column-width="90%"/> <fo:table-column column-width="10%"/> <fo:table-body> <fo:table-row> - <fo:table-cell font-weight="bold" text-align="right" padding-bottom="8mm"> + <fo:table-cell font-weight="bold" text-align="end" padding-bottom="8mm"> <fo:block><xsl:value-of select="$footer-text"/></fo:block> </fo:table-cell> - <fo:table-cell text-align="right" padding-bottom="8mm" padding-right="2mm"> + <fo:table-cell text-align="end" padding-bottom="8mm" padding-right="2mm"> <fo:block><fo:page-number/></fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> @@ -1841,11 +1884,11 @@ <xsl:template name="formatDate"> <xsl:param name="date"/> <xsl:variable name="year" select="substring($date, 1, 4)"/> <xsl:variable name="month" select="substring($date, 6, 2)"/> <xsl:if test="$month != '' and $year != ''"> - <xsl:text>(</xsl:text><xsl:value-of select="$month"/>/<xsl:value-of select="$year"/><xsl:text>)</xsl:text> + <xsl:value-of select="$LRM"/><xsl:text>(</xsl:text><xsl:value-of select="$month"/>/<xsl:value-of select="$year"/><xsl:text>)</xsl:text><xsl:value-of select="$LRM"/> </xsl:if> </xsl:template> <xsl:template name="formatMeetingDate"> <xsl:param name="date"/> @@ -2039,10 +2082,14 @@ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style"> + + <xsl:attribute name="font-family">Times New Roman, STIX Two Math</xsl:attribute> + <xsl:attribute name="font-size">12pt</xsl:attribute> + </xsl:attribute-set><xsl:attribute-set name="link-style"> </xsl:attribute-set><xsl:attribute-set name="sourcecode-style"> @@ -2359,17 +2406,31 @@ </xsl:attribute-set><xsl:attribute-set name="deprecates-style"> </xsl:attribute-set><xsl:attribute-set name="definition-style"> - </xsl:attribute-set><xsl:attribute-set name="add-style"> + </xsl:attribute-set><xsl:variable name="color-added-text"> + <xsl:text>rgb(0, 255, 0)</xsl:text> + </xsl:variable><xsl:attribute-set name="add-style"> <xsl:attribute name="color">red</xsl:attribute> <xsl:attribute name="text-decoration">underline</xsl:attribute> - </xsl:attribute-set><xsl:attribute-set name="del-style"> - <xsl:attribute name="color">red</xsl:attribute> + <!-- <xsl:attribute name="color">black</xsl:attribute> + <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute> + <xsl:attribute name="padding-top">1mm</xsl:attribute> + <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> --> + </xsl:attribute-set><xsl:variable name="color-deleted-text"> + <xsl:text>red</xsl:text> + </xsl:variable><xsl:attribute-set name="del-style"> + <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> <xsl:attribute name="text-decoration">line-through</xsl:attribute> - </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents"> + </xsl:attribute-set><xsl:attribute-set name="mathml-style"> + <xsl:attribute name="font-family">STIX Two Math</xsl:attribute> + + + <xsl:attribute name="font-size">11pt</xsl:attribute> + + </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents"> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/> @@ -2410,22 +2471,23 @@ </xsl:template><xsl:template 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 match="*[local-name()='table']" name="table"> + <xsl:variable name="table-preamble"> + + <fo:block space-before="18pt"> </fo:block> + + + </xsl:variable> + <xsl:variable name="table"> <xsl:variable name="simple-table"> <xsl:call-template name="getSimpleTable"/> </xsl:variable> - - <fo:block space-before="18pt"> </fo:block> - - - - <!-- <xsl:if test="$namespace = 'bipm'"> <fo:block>&#xA0;</fo:block> </xsl:if> --> <!-- $namespace = 'iso' or --> @@ -2436,11 +2498,11 @@ <xsl:call-template name="fn_name_display"/> - <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/> + <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"> @@ -2455,12 +2517,10 @@ </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:if test="not(*[local-name()='colgroup']/*[local-name()='col'])"> <xsl:call-template name="calculate-column-widths"> <xsl:with-param name="cols-count" select="$cols-count"/> <xsl:with-param name="table" select="$simple-table"/> @@ -2484,10 +2544,11 @@ <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"> <xsl:attribute name="font-size">10pt</xsl:attribute> @@ -2522,10 +2583,11 @@ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute> <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute> + <attribute name="margin-left">0mm</attribute> <attribute name="margin-right">0mm</attribute> @@ -2615,12 +2677,13 @@ </fo:block-container> </xsl:variable> + <xsl:variable name="isAdded" select="@added"/> + <xsl:variable name="isDeleted" select="@deleted"/> - <xsl:choose> <xsl:when test="@width"> <!-- centered table when table name is centered (see table-name-style) --> @@ -2629,22 +2692,44 @@ <fo:table-column column-width="{@width}"/> <fo:table-column column-width="proportional-column-width(1)"/> <fo:table-body> <fo:table-row> <fo:table-cell column-number="2"> - <fo:block><xsl:copy-of select="$table"/></fo:block> + <xsl:copy-of select="$table-preamble"/> + <fo:block> + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <xsl:copy-of select="$table"/> + </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </xsl:when> <xsl:otherwise> - <xsl:copy-of select="$table"/> + <xsl:choose> + <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'"> + <xsl:copy-of select="$table-preamble"/> + <fo:block> + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <xsl:copy-of select="$table"/> + </fo:block> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$table-preamble"/> + <xsl:copy-of select="$table"/> + </xsl:otherwise> + </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation"> <xsl:if test="normalize-space() != ''"> @@ -2701,11 +2786,11 @@ </width> </xsl:for-each> </xsl:when> <xsl:otherwise> - <xsl:for-each select="xalan:nodeset($table)//tr"> + <xsl:for-each select="xalan:nodeset($table)/*/tr"> <xsl:variable name="td_text"> <xsl:apply-templates select="td[$curr-col]" mode="td_text"/> <!-- <xsl:if test="$namespace = 'bipm'"> <xsl:for-each select="*[local-name()='td'][$curr-col]//*[local-name()='math']"> @@ -3049,11 +3134,12 @@ </xsl:template><xsl:template match="*[local-name()='th']"> <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center"> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="@align"> - <xsl:value-of select="@align"/> + <xsl:call-template name="setAlignment"/> + <!-- <xsl:value-of select="@align"/> --> </xsl:when> <xsl:otherwise>center</xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -3069,10 +3155,13 @@ + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -3100,15 +3189,19 @@ </xsl:template><xsl:template match="*[local-name()='td']"> <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm"> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="@align"> - <xsl:value-of select="@align"/> + <xsl:call-template name="setAlignment"/> + <!-- <xsl:value-of select="@align"/> --> </xsl:when> <xsl:otherwise>left</xsl:otherwise> </xsl:choose> </xsl:attribute> + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> <xsl:if test="ancestor::*[local-name()='preface']"> <xsl:attribute name="border">solid black 0pt</xsl:attribute> </xsl:if> @@ -3121,10 +3214,13 @@ + <xsl:if test=".//*[local-name() = 'table']"> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + </xsl:if> <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> <xsl:value-of select="@colspan"/> </xsl:attribute> </xsl:if> @@ -3264,17 +3360,17 @@ <xsl:value-of select="substring-before(name(/*), '-')"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> --> - <xsl:element name="{$ns}:table"> + <!-- <xsl:element name="{$ns}:table"> --> <xsl:for-each select="*[local-name() = 'dl'][1]"> <tbody> <xsl:apply-templates mode="dl"/> </tbody> </xsl:for-each> - </xsl:element> + <!-- </xsl:element> --> </xsl:variable> <xsl:call-template name="calculate-column-widths"> <xsl:with-param name="cols-count" select="2"/> <xsl:with-param name="table" select="$html-table"/> @@ -3364,10 +3460,12 @@ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']"> <fo:inline> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='dl']"> + <xsl:variable name="isAdded" select="@added"/> + <xsl:variable name="isDeleted" select="@deleted"/> <fo:block-container> <xsl:if test="not(ancestor::*[local-name() = 'quote'])"> <xsl:attribute name="margin-left">0mm</xsl:attribute> </xsl:if> @@ -3380,10 +3478,16 @@ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:if> + + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <fo:block-container> <xsl:attribute name="margin-left">0mm</xsl:attribute> <xsl:attribute name="margin-right">0mm</xsl:attribute> @@ -3496,15 +3600,15 @@ <xsl:value-of select="substring-before(name(/*), '-')"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> --> - <xsl:element name="{$ns}:table"> + <!-- <xsl:element name="{$ns}:table"> --> <tbody> <xsl:apply-templates mode="dl"/> </tbody> - </xsl:element> + <!-- </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"/> @@ -3778,13 +3882,75 @@ </xsl:template><xsl:template match="*[local-name()='underline']"> <fo:inline text-decoration="underline"> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='add']"> - <fo:inline xsl:use-attribute-sets="add-style"> - <xsl:apply-templates/> - </fo:inline> + <xsl:choose> + <xsl:when test="@amendment"> + <fo:inline> + <xsl:call-template name="insertTag"> + <xsl:with-param name="kind">A</xsl:with-param> + <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param> + </xsl:call-template> + <xsl:apply-templates/> + <xsl:call-template name="insertTag"> + <xsl:with-param name="type">closing</xsl:with-param> + <xsl:with-param name="kind">A</xsl:with-param> + <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param> + </xsl:call-template> + </fo:inline> + </xsl:when> + <xsl:when test="@corrigenda"> + <fo:inline> + <xsl:call-template name="insertTag"> + <xsl:with-param name="kind">C</xsl:with-param> + <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param> + </xsl:call-template> + <xsl:apply-templates/> + <xsl:call-template name="insertTag"> + <xsl:with-param name="type">closing</xsl:with-param> + <xsl:with-param name="kind">C</xsl:with-param> + <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param> + </xsl:call-template> + </fo:inline> + </xsl:when> + <xsl:otherwise> + <fo:inline xsl:use-attribute-sets="add-style"> + <xsl:apply-templates/> + </fo:inline> + </xsl:otherwise> + </xsl:choose> + + </xsl:template><xsl:template name="insertTag"> + <xsl:param name="type"/> + <xsl:param name="kind"/> + <xsl:param name="value"/> + <xsl:variable name="add_width" select="string-length($value) * 20"/> + <xsl:variable name="maxwidth" select="60 + $add_width"/> + <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" --> + <!-- <xsl:attribute name="width">7mm</xsl:attribute> + <xsl:attribute name="content-height">100%</xsl:attribute> --> + <xsl:attribute name="height">5mm</xsl:attribute> + <xsl:attribute name="content-width">100%</xsl:attribute> + <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute> + <xsl:attribute name="scaling">uniform</xsl:attribute> + <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80"> + <g> + <xsl:if test="$type = 'closing'"> + <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute> + </xsl:if> + <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/> + <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/> + </g> + <text font-family="Arial" x="15" y="57" font-size="40pt"> + <xsl:if test="$type = 'closing'"> + <xsl:attribute name="x">25</xsl:attribute> + </xsl:if> + <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan> + </text> + </svg> + </fo:instream-foreign-object> </xsl:template><xsl:template match="*[local-name()='del']"> <fo:inline xsl:use-attribute-sets="del-style"> <xsl:apply-templates/> </fo:inline> </xsl:template><xsl:template match="*[local-name()='hi']"> @@ -4123,17 +4289,27 @@ </xsl:template><xsl:template name="capitalize"> <xsl:param name="str"/> <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/> <xsl:value-of select="substring($str, 2)"/> </xsl:template><xsl:template match="mathml:math"> - <fo:inline font-family="STIX Two Math"> <!-- --> + <xsl:variable name="isAdded" select="@added"/> + <xsl:variable name="isDeleted" select="@deleted"/> + + <fo:inline xsl:use-attribute-sets="mathml-style"> + + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <xsl:variable name="mathml"> <xsl:apply-templates select="." mode="mathml"/> </xsl:variable> <fo:instream-foreign-object fox:alt-text="Math"> + <!-- <xsl:copy-of select="."/> --> <xsl:copy-of select="xalan:nodeset($mathml)"/> </fo:instream-foreign-object> </fo:inline> </xsl:template><xsl:template match="@*|node()" mode="mathml"> @@ -4381,12 +4557,19 @@ <xsl:text>.</xsl:text> </xsl:if> --> </fo:inline> </xsl:if> </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure"> + <xsl:variable name="isAdded" select="@added"/> + <xsl:variable name="isDeleted" select="@deleted"/> <fo:block-container id="{@id}"> + <xsl:call-template name="setTrackChangesStyles"> + <xsl:with-param name="isAdded" select="$isAdded"/> + <xsl:with-param name="isDeleted" select="$isDeleted"/> + </xsl:call-template> + <fo:block> <xsl:apply-templates/> </fo:block> <xsl:call-template name="fn_display_figure"/> <xsl:for-each select="*[local-name() = 'note']"> @@ -4402,10 +4585,12 @@ </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']"> <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style"> <xsl:apply-templates/> </fo:block> </xsl:template><xsl:template match="*[local-name() = 'image']"> + <xsl:variable name="isAdded" select="../@added"/> + <xsl:variable name="isDeleted" select="../@deleted"/> <xsl:choose> <xsl:when test="ancestor::*[local-name() = 'title']"> <fo:inline padding-left="1mm" padding-right="1mm"> <xsl:variable name="src"> <xsl:call-template name="image_src"/> @@ -4417,11 +4602,30 @@ <fo:block xsl:use-attribute-sets="image-style"> <xsl:variable name="src"> <xsl:call-template name="image_src"/> </xsl:variable> - <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/> + + <xsl:choose> + <xsl:when test="$isDeleted = 'true'"> + <!-- enclose in svg --> + <fo:instream-foreign-object fox:alt-text="Image {@alt}"> + <xsl:attribute name="width">100%</xsl:attribute> + <xsl:attribute name="content-height">100%</xsl:attribute> + <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute> + <xsl:attribute name="scaling">uniform</xsl:attribute> + + + <xsl:apply-templates select="." mode="cross_image"/> + + </fo:instream-foreign-object> + </xsl:when> + <xsl:otherwise> + <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/> + </xsl:otherwise> + </xsl:choose> + </fo:block> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="image_src"> <xsl:choose> @@ -4433,10 +4637,59 @@ </xsl:when> <xsl:otherwise> <xsl:value-of select="@src"/> </xsl:otherwise> </xsl:choose> + </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image"> + <xsl:choose> + <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]"> + <xsl:variable name="src"> + <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/> + </xsl:variable> + <xsl:variable name="width" select="document($src)/@width"/> + <xsl:variable name="height" select="document($src)/@height"/> + <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1"> + <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/> + </svg> + </xsl:when> + <xsl:when test="not(starts-with(@src, 'data:'))"> + <xsl:variable name="src"> + <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/> + </xsl:variable> + <xsl:variable name="file" select="java:java.io.File.new(@src)"/> + <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/> + <xsl:variable name="width" select="java:getWidth($bufferedImage)"/> + <xsl:variable name="height" select="java:getHeight($bufferedImage)"/> + <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1"> + <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/> + </svg> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/> + <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/> + <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/> + <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/> + <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/> + <xsl:variable name="width" select="java:getWidth($bufferedImage)"/> + <!-- width=<xsl:value-of select="$width"/> --> + <xsl:variable name="height" select="java:getHeight($bufferedImage)"/> + <!-- height=<xsl:value-of select="$height"/> --> + <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1"> + <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/> + <xsl:call-template name="svg_cross"> + <xsl:with-param name="width" select="$width"/> + <xsl:with-param name="height" select="$height"/> + </xsl:call-template> + </svg> + </xsl:otherwise> + </xsl:choose> + + </xsl:template><xsl:template name="svg_cross"> + <xsl:param name="width"/> + <xsl:param name="height"/> + <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/> + <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/> </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents"> <xsl:apply-templates mode="contents"/> <xsl:text> </xsl:text> </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks"> <xsl:apply-templates mode="bookmarks"/> @@ -4975,18 +5228,19 @@ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation"> <xsl:variable name="element"> block + <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if> </xsl:variable> <xsl:choose> <xsl:when test="ancestor::*[local-name() = 'appendix']"> <fo:inline> <xsl:apply-templates/> </fo:inline> </xsl:when> - <xsl:when test="normalize-space($element) = 'block'"> + <xsl:when test="contains(normalize-space($element), 'block')"> <fo:block xsl:use-attribute-sets="example-name-style"> <xsl:apply-templates/> </fo:block> </xsl:when> <xsl:otherwise> @@ -5191,11 +5445,12 @@ <xsl:with-param name="count" select="$padding-right"/> </xsl:call-template> </fo:inline> </xsl:when> <xsl:otherwise> - <fo:inline padding-right="{$padding-right}mm">​</fo:inline> + <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable> + <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline> </xsl:otherwise> </xsl:choose> </xsl:template><xsl:template name="insertNonBreakSpaces"> <xsl:param name="count"/> @@ -5910,6 +6165,46 @@ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/> </xsl:when> <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise> </xsl:choose> + </xsl:template><xsl:template name="setTrackChangesStyles"> + <xsl:param name="isAdded"/> + <xsl:param name="isDeleted"/> + <xsl:choose> + <xsl:when test="local-name() = 'math'"> + <xsl:if test="$isAdded = 'true'"> + <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute> + </xsl:if> + <xsl:if test="$isDeleted = 'true'"> + <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$isAdded = 'true'"> + <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute> + <xsl:attribute name="padding">2mm</xsl:attribute> + </xsl:if> + <xsl:if test="$isDeleted = 'true'"> + <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute> + <xsl:if test="local-name() = 'table'"> + <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute> + </xsl:if> + <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> --> + <xsl:attribute name="padding">2mm</xsl:attribute> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode"> + <xsl:if test="$lang = 'ar'"> + <xsl:attribute name="writing-mode">rl-tb</xsl:attribute> + </xsl:if> + </xsl:template><xsl:template name="setAlignment"> + <xsl:param name="align" select="normalize-space(@align)"/> + <xsl:choose> + <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when> + <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when> + <xsl:when test="$align != ''"> + <xsl:value-of select="$align"/> + </xsl:when> + </xsl:choose> </xsl:template></xsl:stylesheet> \ No newline at end of file