lib/isodoc/ogc/ogc.white-paper.xsl in metanorma-ogc-1.2.15 vs lib/isodoc/ogc/ogc.white-paper.xsl in metanorma-ogc-1.2.16
- old
+ new
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ogc="https://www.metanorma.org/ns/ogc" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
<xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
<xsl:param name="svg_images"/>
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
<xsl:variable name="images" select="document($svg_images)"/>
<xsl:variable name="pageWidth" select="'215.9mm'"/>
<xsl:variable name="pageHeight" select="'279.4mm'"/>
@@ -103,11 +104,13 @@
<fo:region-end region-name="right" extent="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
- <xsl:call-template name="addPDFUAmeta"/>
+ <fo:declarations>
+ <xsl:call-template name="addPDFUAmeta"/>
+ </fo:declarations>
<xsl:call-template name="addBookmarks">
<xsl:with-param name="contents" select="$contents"/>
</xsl:call-template>
@@ -1196,10 +1199,11 @@
+
<xsl:attribute name="margin-bottom">14pt</xsl:attribute>
@@ -1842,11 +1846,19 @@
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
<xsl:value-of select="@target"/>
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
- <xsl:variable name="math_text" select="normalize-space(.)"/>
+ <xsl:variable name="mathml">
+ <xsl:for-each select="*">
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
+ <xsl:copy-of select="."/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
</xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
<xsl:param name="cols-count"/>
<!-- font-weight="bold" -->
<fo:table-header>
@@ -2818,10 +2830,14 @@
</fo:inline>
</xsl:template><xsl:template match="*[local-name()='del']">
<fo:inline font-size="10pt" color="red" text-decoration="line-through">
<xsl:apply-templates/>
</fo:inline>
+ </xsl:template><xsl:template match="*[local-name()='hi']">
+ <fo:inline background-color="yellow">
+ <xsl:apply-templates/>
+ </fo:inline>
</xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
<xsl:variable name="text" select="normalize-space(.)"/>
<fo:inline font-size="75%">
<xsl:if test="string-length($text) > 0">
<xsl:call-template name="recursiveSmallCaps">
@@ -3158,10 +3174,11 @@
<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">
@@ -3176,11 +3193,11 @@
</xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
<xsl:copy>
<xsl:apply-templates select="@*|node()" mode="mathml"/>
</xsl:copy>
<mathml:mspace width="0.5ex"/>
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template 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>
@@ -3210,12 +3227,10 @@
</xsl:choose>
</fo:basic-link>
</xsl:otherwise>
</xsl:choose>
</fo:inline>
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
- <fo:inline id="{@id}"/>
</xsl:template><xsl:template match="*[local-name()='appendix']">
<fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
<xsl:apply-templates select="*[local-name()='title']" mode="process"/>
</fo:block>
<xsl:apply-templates/>
@@ -3424,10 +3439,11 @@
</fo:block-container>
</xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
<fo:block id="{@id}">
<xsl:apply-templates/>
</fo:block>
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
</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']">
@@ -4026,14 +4042,15 @@
</fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
-
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
<xsl:variable name="element">
block
+
</xsl:variable>
<xsl:choose>
<xsl:when test="normalize-space($element) = 'block'">
<fo:block xsl:use-attribute-sets="example-p-style">
@@ -4133,36 +4150,54 @@
</fo:basic-link>
</xsl:template><xsl:template match="*[local-name() = 'author']">
<xsl:text>— </xsl:text>
<xsl:apply-templates/>
</xsl:template><xsl:template match="*[local-name() = 'eref']">
- <fo:inline xsl:use-attribute-sets="eref-style">
- <xsl:if test="@type = 'footnote'">
-
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
- <xsl:attribute name="font-size">80%</xsl:attribute>
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
- <xsl:attribute name="vertical-align">super</xsl:attribute>
-
-
- </xsl:if>
-
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
-
- <xsl:if test="@type = 'inline'">
-
- <xsl:attribute name="color">blue</xsl:attribute>
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
-
-
-
- </xsl:if>
-
-
- <xsl:apply-templates/>
- </fo:basic-link>
- </fo:inline>
+
+ <xsl:variable name="bibitemid">
+ <xsl:choose>
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="normalize-space($bibitemid) != ''">
+ <fo:inline xsl:use-attribute-sets="eref-style">
+ <xsl:if test="@type = 'footnote'">
+
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
+ <xsl:attribute name="font-size">80%</xsl:attribute>
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
+
+
+ </xsl:if>
+
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
+ <xsl:if test="normalize-space(@citeas) = ''">
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></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:apply-templates/>
+ </fo:basic-link>
+
+ </fo:inline>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:inline><xsl:apply-templates/></fo:inline>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template><xsl:template match="*[local-name() = 'tab']">
<!-- zero-space char -->
<xsl:variable name="depth">
<xsl:call-template name="getLevel">
<xsl:with-param name="depth" select="../@depth"/>
@@ -4345,10 +4380,157 @@
<fo:block>
<xsl:apply-templates select="." mode="ul_ol"/>
</fo:block>
</xsl:otherwise>
</xsl:choose>
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
+ <bookmark><xsl:value-of select="@id"/></bookmark>
+ </xsl:for-each>
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
+ </xsl:copy>
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
+ <xsl:variable name="id">
+ <xsl:call-template name="generateIndexXrefId"/>
+ </xsl:variable>
+ <xsl:copy> <!-- add id to xref -->
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id"/>
+ </xsl:attribute>
+ <xsl:apply-templates mode="index_add_id"/>
+ </xsl:copy>
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
+ <xsl:if test="@to">
+ <xsl:value-of select="$dash"/>
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
+ <xsl:attribute name="id">
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
+ </xsl:attribute>
+ <xsl:apply-templates mode="index_add_id"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
+ </xsl:copy>
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
+ <xsl:copy>
+ <xsl:apply-templates select="@*" mode="index_update"/>
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
+ </xsl:copy>
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
+ <xsl:param name="element"/>
+ <xsl:param name="remove" select="'false'"/>
+ <xsl:param name="target"/>
+ <!-- <node></node> -->
+ <xsl:choose>
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
+ <!-- skip text (i.e. remove it) and process next element -->
+ <!-- [removed_<xsl:value-of select="."/>] -->
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="self::text()">
+ <xsl:value-of select="."/>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
+ </xsl:when>
+ <xsl:when test="self::* and local-name(.) = 'xref'">
+ <xsl:variable name="id" select="@id"/>
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
+
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
+
+ <xsl:choose>
+ <!-- 2nd pass -->
+ <!-- if page is equal to page for next and page is not the end of range -->
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
+ <!-- [removed_xref] -->
+
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
+ <xsl:with-param name="remove">true</xsl:with-param>
+ <xsl:with-param name="target">
+ <xsl:choose>
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
+ <!-- remove xref -->
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
+ <xsl:with-param name="remove">true</xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="xref_copy">
+ <xsl:with-param name="target" select="$target"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="self::* and local-name(.) = 'ul'">
+ <!-- ul -->
+ <xsl:apply-templates select="." mode="index_update"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="." mode="xref_copy">
+ <xsl:with-param name="target" select="$target"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
+ <xsl:param name="target"/>
+ <xsl:copy>
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
+ </xsl:copy>
+ </xsl:template><xsl:template name="generateIndexXrefId">
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
+
+ <xsl:variable name="docid">
+ <xsl:call-template name="getDocumentId"/>
+ </xsl:variable>
+ <xsl:variable name="item_number">
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
+ </xsl:variable>
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
+ <xsl:apply-templates/>
+ <fo:block>
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
+ <fo:block> </fo:block>
+ </xsl:if>
+ </fo:block>
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
+ <xsl:apply-templates/>
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
+ <fo:inline id="{@id}"/>
</xsl:template><xsl:template match="*[local-name() = 'errata']">
<!-- <row>
<date>05-07-2013</date>
<type>Editorial</type>
<change>Changed CA-9 Priority Code from P1 to P2 in <xref target="tabled2"/>.</change>
@@ -4701,73 +4883,71 @@
</xsl:choose>
</xsl:template><xsl:template name="addPDFUAmeta">
<xsl:variable name="lang">
<xsl:call-template name="getLang"/>
</xsl:variable>
- <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:variable name="title">
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
-
-
-
-
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
-
-
-
- </xsl:for-each>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="normalize-space($title) != ''">
- <xsl:value-of select="$title"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text> </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </dc:title>
- <dc:creator>
+ <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:variable name="title">
<xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
- <xsl:if test="position() != last()">; </xsl:if>
- </xsl:for-each>
+
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
- </xsl:for-each>
- </dc:creator>
- <dc:description>
- <xsl:variable name="abstract">
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//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>
+
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="normalize-space($title) != ''">
+ <xsl:value-of select="$title"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dc:title>
+ <dc:creator>
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
+
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
+ <xsl:if test="position() != last()">; </xsl:if>
+ </xsl:for-each>
+
+
+
+ </xsl:for-each>
+ </dc:creator>
+ <dc:description>
+ <xsl:variable name="abstract">
+
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//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>
</xsl:template><xsl:template name="getId">
<xsl:choose>
<xsl:when test="../@id">
<xsl:value-of select="../@id"/>
</xsl:when>
\ No newline at end of file