metanorma-ogc 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9fa70d6fdbc72921c0981d6afaadbdfd358a37c74f84f7bae86e75bbca1d089
4
- data.tar.gz: ef441a2182e40e3605395584d4afee319a1a9e725f092f4db9661e1be2641e08
3
+ metadata.gz: c844c9413112ce478961eaee4dc1d9095cb45f7a9037e5fb2a017aa14df2570a
4
+ data.tar.gz: b18b7340a94b1ca58ae3e1acc4531fb27c64f65077a523ce725c5f0672beb9dc
5
5
  SHA512:
6
- metadata.gz: a5e6a4a9bd68c5b4d45950c68ca316c9460dff1e8f874ebfba9c43d27eb19920cf16384fb687f55c6f5c78d8329902eba231ebdeda988462d67f6d910e127529
7
- data.tar.gz: de1fc5ecc2a852c251857cb852c0195f0ce396ca0c8fc7c3e0db701678d5d5d7b9a049666e453f5a7e3bf586f4a7e750187cb24d6885a19578fada4bf0effc3c
6
+ metadata.gz: d1322f1463bcf357d6528a2db5c3ce2e8b1f2b34123aab899896afb99c8036d47396b892085676222b466602a26656ae903d9cea1857fe9c730b0d39567b254c
7
+ data.tar.gz: d85779466d2a1f7f973b47888520a1c633ed45b0afb07d0f2cc78ec13e5c21807ca76e8486a15535b4126a831abdfa238e7cd1b51837339582d3b5150b4bdb2b
@@ -12,8 +12,9 @@ module Asciidoctor
12
12
 
13
13
  def corporate_author(node, xml)
14
14
  return unless node.attr("submitting-organizations")
15
- csv_split(HTMLEntities.new.decode(node.attr("submitting-organizations")),
16
- ";")&.each do |org|
15
+
16
+ csv_split(HTMLEntities.new
17
+ .decode(node.attr("submitting-organizations")), ";")&.each do |org|
17
18
  xml.contributor do |c|
18
19
  c.role **{ type: "author" }
19
20
  c.organization do |a|
@@ -37,6 +38,7 @@ module Asciidoctor
37
38
 
38
39
  def ogc_editor(node, xml)
39
40
  return unless node.attr("editor")
41
+
40
42
  xml.contributor do |c|
41
43
  c.role **{ type: "editor" }
42
44
  c.person do |p|
@@ -69,6 +71,7 @@ module Asciidoctor
69
71
 
70
72
  def metadata_committee(node, xml)
71
73
  return unless node.attr("committee")
74
+
72
75
  xml.editorialgroup do |a|
73
76
  a.committee(node.attr("committee") || "technical")
74
77
  node.attr("subcommittee") and
@@ -84,9 +87,11 @@ module Asciidoctor
84
87
 
85
88
  def externalid(node)
86
89
  return node.attr("external-id") if node.attr("external-id")
90
+
87
91
  d = doctype(node)
88
92
  a = node.attr("abbrev")
89
- return unless d and a
93
+ return unless d && a
94
+
90
95
  url = "http://www.opengis.net/doc/#{IsoDoc::Ogc::DOCTYPE_ABBR[d]}/#{a}"
91
96
  v = (node.attr("edition") || node.attr("version")) and url += "/#{v}"
92
97
  url
@@ -107,7 +112,7 @@ module Asciidoctor
107
112
  if doctype(node) == "engineering-report"
108
113
  "http://www.opengis.net/doc/PER/t14-#{node.attr('referenceurlid')}"
109
114
  else
110
- node.attr('referenceurlid')
115
+ node.attr("referenceurlid")
111
116
  end
112
117
  end
113
118
 
@@ -125,9 +130,9 @@ module Asciidoctor
125
130
 
126
131
  def metadata_date(node, xml)
127
132
  super
128
- ogc_date(node, xml, "submissiondate", "received" )
129
- ogc_date(node, xml, "publicationdate", "published" )
130
- ogc_date(node, xml, "approvaldate", "issued" )
133
+ ogc_date(node, xml, "submissiondate", "received")
134
+ ogc_date(node, xml, "publicationdate", "published")
135
+ ogc_date(node, xml, "approvaldate", "issued")
131
136
  end
132
137
 
133
138
  def ogc_date(node, xml, ogcname, metanormaname)
@@ -139,27 +144,30 @@ module Asciidoctor
139
144
  end
140
145
 
141
146
  def metadata_version(node, xml)
142
- node.set_attr("edition", node.attr("version"), false) if node.attr("version")
147
+ node.attr("version") and
148
+ node.set_attr("edition", node.attr("version"), false)
143
149
  super
144
150
  end
145
151
 
146
152
  def metadata_subdoctype(node, xml)
147
- s = node.attr("docsubtype")
153
+ s = node.attr("docsubtype")
148
154
  s1 = ::IsoDoc::Ogc::DOCSUBTYPE_ABBR.invert[s] and s = s1
149
155
  case doctype(node)
150
156
  when "standard"
151
157
  unless %w{conceptual-model conceptual-model-and-encoding
152
158
  conceptual-model-and-implementation encoding extension
153
159
  implementation profile profile-with-extension}.include? s
154
- @log.add("Document Attributes", nil, "'#{s}' is not a permitted subtype of Standard: "\
155
- "reverting to 'implementation'")
160
+ @log.add("Document Attributes", nil,
161
+ "'#{s}' is not a permitted subtype of Standard: "\
162
+ "reverting to 'implementation'")
156
163
  s = "implementation"
157
164
  end
158
165
  when "best-practice"
159
166
  unless %w{general encoding extension profile
160
167
  profile-with-extension}.include? s
161
- @log.add("Document Attributes", nil, "'#{s}' is not a permitted subtype of Standard: "\
162
- "reverting to 'implementation'")
168
+ @log.add("Document Attributes", nil,
169
+ "'#{s}' is not a permitted subtype of Standard: "\
170
+ "reverting to 'implementation'")
163
171
  s = "general"
164
172
  end
165
173
  end
@@ -1620,6 +1620,7 @@
1620
1620
  </xsl:choose>
1621
1621
  </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">
1622
1622
 
1623
+
1623
1624
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1624
1625
 
1625
1626
 
@@ -2002,13 +2003,25 @@
2002
2003
  <xsl:attribute name="space-after">6pt</xsl:attribute>
2003
2004
 
2004
2005
 
2005
- </xsl:attribute-set><xsl:attribute-set name="add-style">
2006
+ </xsl:attribute-set><xsl:variable name="color-added-text">
2007
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
2008
+ </xsl:variable><xsl:attribute-set name="add-style">
2006
2009
  <xsl:attribute name="color">red</xsl:attribute>
2007
2010
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2008
- </xsl:attribute-set><xsl:attribute-set name="del-style">
2009
- <xsl:attribute name="color">red</xsl:attribute>
2011
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2012
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2013
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2014
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2015
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
2016
+ <xsl:text>red</xsl:text>
2017
+ </xsl:variable><xsl:attribute-set name="del-style">
2018
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2010
2019
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2011
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2020
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
2021
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2022
+
2023
+
2024
+ </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">
2012
2025
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2013
2026
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2014
2027
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2053,18 +2066,19 @@
2053
2066
  <xsl:call-template name="add-zero-spaces-java"/>
2054
2067
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2055
2068
 
2069
+ <xsl:variable name="table-preamble">
2070
+
2071
+
2072
+ <fo:block> </fo:block>
2073
+
2074
+ </xsl:variable>
2075
+
2056
2076
  <xsl:variable name="table">
2057
2077
 
2058
2078
  <xsl:variable name="simple-table">
2059
2079
  <xsl:call-template name="getSimpleTable"/>
2060
2080
  </xsl:variable>
2061
2081
 
2062
-
2063
-
2064
-
2065
- <fo:block> </fo:block>
2066
-
2067
-
2068
2082
  <!-- <xsl:if test="$namespace = 'bipm'">
2069
2083
  <fo:block>&#xA0;</fo:block>
2070
2084
  </xsl:if> -->
@@ -2079,7 +2093,7 @@
2079
2093
 
2080
2094
 
2081
2095
 
2082
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2096
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2083
2097
 
2084
2098
  <!-- <xsl:variable name="cols-count">
2085
2099
  <xsl:choose>
@@ -2098,8 +2112,6 @@
2098
2112
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2099
2113
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2100
2114
 
2101
-
2102
-
2103
2115
  <xsl:variable name="colwidths">
2104
2116
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2105
2117
  <xsl:call-template name="calculate-column-widths">
@@ -2127,6 +2139,7 @@
2127
2139
  </xsl:choose>
2128
2140
  </xsl:variable>
2129
2141
 
2142
+
2130
2143
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2131
2144
 
2132
2145
 
@@ -2172,6 +2185,7 @@
2172
2185
 
2173
2186
 
2174
2187
 
2188
+
2175
2189
  <attribute name="margin-left">0mm</attribute>
2176
2190
  <attribute name="margin-right">0mm</attribute>
2177
2191
 
@@ -2263,7 +2277,8 @@
2263
2277
  </fo:block-container>
2264
2278
  </xsl:variable>
2265
2279
 
2266
-
2280
+ <xsl:variable name="isAdded" select="@added"/>
2281
+ <xsl:variable name="isDeleted" select="@deleted"/>
2267
2282
 
2268
2283
  <xsl:choose>
2269
2284
  <xsl:when test="@width">
@@ -2272,12 +2287,42 @@
2272
2287
 
2273
2288
 
2274
2289
 
2275
- <xsl:copy-of select="$table"/>
2290
+ <xsl:choose>
2291
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
2292
+ <xsl:copy-of select="$table-preamble"/>
2293
+ <fo:block>
2294
+ <xsl:call-template name="setTrackChangesStyles">
2295
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2296
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2297
+ </xsl:call-template>
2298
+ <xsl:copy-of select="$table"/>
2299
+ </fo:block>
2300
+ </xsl:when>
2301
+ <xsl:otherwise>
2302
+ <xsl:copy-of select="$table-preamble"/>
2303
+ <xsl:copy-of select="$table"/>
2304
+ </xsl:otherwise>
2305
+ </xsl:choose>
2276
2306
 
2277
2307
 
2278
2308
  </xsl:when>
2279
2309
  <xsl:otherwise>
2280
- <xsl:copy-of select="$table"/>
2310
+ <xsl:choose>
2311
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
2312
+ <xsl:copy-of select="$table-preamble"/>
2313
+ <fo:block>
2314
+ <xsl:call-template name="setTrackChangesStyles">
2315
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2316
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2317
+ </xsl:call-template>
2318
+ <xsl:copy-of select="$table"/>
2319
+ </fo:block>
2320
+ </xsl:when>
2321
+ <xsl:otherwise>
2322
+ <xsl:copy-of select="$table-preamble"/>
2323
+ <xsl:copy-of select="$table"/>
2324
+ </xsl:otherwise>
2325
+ </xsl:choose>
2281
2326
  </xsl:otherwise>
2282
2327
  </xsl:choose>
2283
2328
 
@@ -2338,7 +2383,7 @@
2338
2383
  </xsl:for-each>
2339
2384
  </xsl:when>
2340
2385
  <xsl:otherwise>
2341
- <xsl:for-each select="xalan:nodeset($table)//tr">
2386
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2342
2387
  <xsl:variable name="td_text">
2343
2388
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2344
2389
 
@@ -2694,7 +2739,8 @@
2694
2739
  <xsl:attribute name="text-align">
2695
2740
  <xsl:choose>
2696
2741
  <xsl:when test="@align">
2697
- <xsl:value-of select="@align"/>
2742
+ <xsl:call-template name="setAlignment"/>
2743
+ <!-- <xsl:value-of select="@align"/> -->
2698
2744
  </xsl:when>
2699
2745
  <xsl:otherwise>center</xsl:otherwise>
2700
2746
  </xsl:choose>
@@ -2712,6 +2758,9 @@
2712
2758
 
2713
2759
 
2714
2760
 
2761
+ <xsl:if test="$lang = 'ar'">
2762
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2763
+ </xsl:if>
2715
2764
  <xsl:if test="@colspan">
2716
2765
  <xsl:attribute name="number-columns-spanned">
2717
2766
  <xsl:value-of select="@colspan"/>
@@ -2743,11 +2792,15 @@
2743
2792
  <xsl:attribute name="text-align">
2744
2793
  <xsl:choose>
2745
2794
  <xsl:when test="@align">
2746
- <xsl:value-of select="@align"/>
2795
+ <xsl:call-template name="setAlignment"/>
2796
+ <!-- <xsl:value-of select="@align"/> -->
2747
2797
  </xsl:when>
2748
2798
  <xsl:otherwise>left</xsl:otherwise>
2749
2799
  </xsl:choose>
2750
2800
  </xsl:attribute>
2801
+ <xsl:if test="$lang = 'ar'">
2802
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2803
+ </xsl:if>
2751
2804
 
2752
2805
 
2753
2806
 
@@ -2761,6 +2814,9 @@
2761
2814
 
2762
2815
 
2763
2816
 
2817
+ <xsl:if test=".//*[local-name() = 'table']">
2818
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2819
+ </xsl:if>
2764
2820
  <xsl:if test="@colspan">
2765
2821
  <xsl:attribute name="number-columns-spanned">
2766
2822
  <xsl:value-of select="@colspan"/>
@@ -2894,13 +2950,13 @@
2894
2950
  </xsl:choose>
2895
2951
  </xsl:variable>
2896
2952
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2897
- <xsl:element name="{$ns}:table">
2953
+ <!-- <xsl:element name="{$ns}:table"> -->
2898
2954
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2899
2955
  <tbody>
2900
2956
  <xsl:apply-templates mode="dl"/>
2901
2957
  </tbody>
2902
2958
  </xsl:for-each>
2903
- </xsl:element>
2959
+ <!-- </xsl:element> -->
2904
2960
  </xsl:variable>
2905
2961
 
2906
2962
  <xsl:call-template name="calculate-column-widths">
@@ -2998,6 +3054,8 @@
2998
3054
  <xsl:apply-templates/>
2999
3055
  </fo:inline>
3000
3056
  </xsl:template><xsl:template match="*[local-name()='dl']">
3057
+ <xsl:variable name="isAdded" select="@added"/>
3058
+ <xsl:variable name="isDeleted" select="@deleted"/>
3001
3059
  <fo:block-container>
3002
3060
 
3003
3061
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3014,6 +3072,12 @@
3014
3072
  </xsl:attribute>
3015
3073
 
3016
3074
  </xsl:if>
3075
+
3076
+ <xsl:call-template name="setTrackChangesStyles">
3077
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3078
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3079
+ </xsl:call-template>
3080
+
3017
3081
  <fo:block-container>
3018
3082
 
3019
3083
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3121,11 +3185,11 @@
3121
3185
  </xsl:choose>
3122
3186
  </xsl:variable>
3123
3187
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3124
- <xsl:element name="{$ns}:table">
3188
+ <!-- <xsl:element name="{$ns}:table"> -->
3125
3189
  <tbody>
3126
3190
  <xsl:apply-templates mode="dl"/>
3127
3191
  </tbody>
3128
- </xsl:element>
3192
+ <!-- </xsl:element> -->
3129
3193
  </xsl:variable>
3130
3194
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3131
3195
  <xsl:variable name="colwidths">
@@ -3398,9 +3462,71 @@
3398
3462
  <xsl:apply-templates/>
3399
3463
  </fo:inline>
3400
3464
  </xsl:template><xsl:template match="*[local-name()='add']">
3401
- <fo:inline xsl:use-attribute-sets="add-style">
3402
- <xsl:apply-templates/>
3403
- </fo:inline>
3465
+ <xsl:choose>
3466
+ <xsl:when test="@amendment">
3467
+ <fo:inline>
3468
+ <xsl:call-template name="insertTag">
3469
+ <xsl:with-param name="kind">A</xsl:with-param>
3470
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3471
+ </xsl:call-template>
3472
+ <xsl:apply-templates/>
3473
+ <xsl:call-template name="insertTag">
3474
+ <xsl:with-param name="type">closing</xsl:with-param>
3475
+ <xsl:with-param name="kind">A</xsl:with-param>
3476
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3477
+ </xsl:call-template>
3478
+ </fo:inline>
3479
+ </xsl:when>
3480
+ <xsl:when test="@corrigenda">
3481
+ <fo:inline>
3482
+ <xsl:call-template name="insertTag">
3483
+ <xsl:with-param name="kind">C</xsl:with-param>
3484
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3485
+ </xsl:call-template>
3486
+ <xsl:apply-templates/>
3487
+ <xsl:call-template name="insertTag">
3488
+ <xsl:with-param name="type">closing</xsl:with-param>
3489
+ <xsl:with-param name="kind">C</xsl:with-param>
3490
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3491
+ </xsl:call-template>
3492
+ </fo:inline>
3493
+ </xsl:when>
3494
+ <xsl:otherwise>
3495
+ <fo:inline xsl:use-attribute-sets="add-style">
3496
+ <xsl:apply-templates/>
3497
+ </fo:inline>
3498
+ </xsl:otherwise>
3499
+ </xsl:choose>
3500
+
3501
+ </xsl:template><xsl:template name="insertTag">
3502
+ <xsl:param name="type"/>
3503
+ <xsl:param name="kind"/>
3504
+ <xsl:param name="value"/>
3505
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3506
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3507
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3508
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3509
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3510
+ <xsl:attribute name="height">5mm</xsl:attribute>
3511
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3512
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3513
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3514
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3515
+ <g>
3516
+ <xsl:if test="$type = 'closing'">
3517
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3518
+ </xsl:if>
3519
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3520
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3521
+ </g>
3522
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3523
+ <xsl:if test="$type = 'closing'">
3524
+ <xsl:attribute name="x">25</xsl:attribute>
3525
+ </xsl:if>
3526
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3527
+ </text>
3528
+ </svg>
3529
+ </fo:instream-foreign-object>
3404
3530
  </xsl:template><xsl:template match="*[local-name()='del']">
3405
3531
  <fo:inline xsl:use-attribute-sets="del-style">
3406
3532
  <xsl:apply-templates/>
@@ -3743,13 +3869,23 @@
3743
3869
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3744
3870
  <xsl:value-of select="substring($str, 2)"/>
3745
3871
  </xsl:template><xsl:template match="mathml:math">
3746
- <fo:inline font-family="STIX Two Math"> <!-- -->
3872
+ <xsl:variable name="isAdded" select="@added"/>
3873
+ <xsl:variable name="isDeleted" select="@deleted"/>
3874
+
3875
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3876
+
3877
+
3878
+ <xsl:call-template name="setTrackChangesStyles">
3879
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3880
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3881
+ </xsl:call-template>
3747
3882
 
3748
3883
  <xsl:variable name="mathml">
3749
3884
  <xsl:apply-templates select="." mode="mathml"/>
3750
3885
  </xsl:variable>
3751
3886
  <fo:instream-foreign-object fox:alt-text="Math">
3752
3887
 
3888
+
3753
3889
  <!-- <xsl:copy-of select="."/> -->
3754
3890
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3755
3891
  </fo:instream-foreign-object>
@@ -4001,8 +4137,15 @@
4001
4137
  </fo:inline>
4002
4138
  </xsl:if>
4003
4139
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4140
+ <xsl:variable name="isAdded" select="@added"/>
4141
+ <xsl:variable name="isDeleted" select="@deleted"/>
4004
4142
  <fo:block-container id="{@id}">
4005
4143
 
4144
+ <xsl:call-template name="setTrackChangesStyles">
4145
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4146
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4147
+ </xsl:call-template>
4148
+
4006
4149
  <fo:block>
4007
4150
  <xsl:apply-templates/>
4008
4151
  </fo:block>
@@ -4022,6 +4165,8 @@
4022
4165
  <xsl:apply-templates/>
4023
4166
  </fo:block>
4024
4167
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4168
+ <xsl:variable name="isAdded" select="../@added"/>
4169
+ <xsl:variable name="isDeleted" select="../@deleted"/>
4025
4170
  <xsl:choose>
4026
4171
  <xsl:when test="ancestor::*[local-name() = 'title']">
4027
4172
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -4037,7 +4182,26 @@
4037
4182
  <xsl:variable name="src">
4038
4183
  <xsl:call-template name="image_src"/>
4039
4184
  </xsl:variable>
4040
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4185
+
4186
+ <xsl:choose>
4187
+ <xsl:when test="$isDeleted = 'true'">
4188
+ <!-- enclose in svg -->
4189
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
4190
+ <xsl:attribute name="width">100%</xsl:attribute>
4191
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4192
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4193
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4194
+
4195
+
4196
+ <xsl:apply-templates select="." mode="cross_image"/>
4197
+
4198
+ </fo:instream-foreign-object>
4199
+ </xsl:when>
4200
+ <xsl:otherwise>
4201
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4202
+ </xsl:otherwise>
4203
+ </xsl:choose>
4204
+
4041
4205
  </fo:block>
4042
4206
  </xsl:otherwise>
4043
4207
  </xsl:choose>
@@ -4053,6 +4217,55 @@
4053
4217
  <xsl:value-of select="@src"/>
4054
4218
  </xsl:otherwise>
4055
4219
  </xsl:choose>
4220
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
4221
+ <xsl:choose>
4222
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4223
+ <xsl:variable name="src">
4224
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4225
+ </xsl:variable>
4226
+ <xsl:variable name="width" select="document($src)/@width"/>
4227
+ <xsl:variable name="height" select="document($src)/@height"/>
4228
+ <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">
4229
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4230
+ </svg>
4231
+ </xsl:when>
4232
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4233
+ <xsl:variable name="src">
4234
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4235
+ </xsl:variable>
4236
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
4237
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
4238
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4239
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4240
+ <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">
4241
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4242
+ </svg>
4243
+ </xsl:when>
4244
+ <xsl:otherwise>
4245
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
4246
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
4247
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
4248
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
4249
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
4250
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4251
+ <!-- width=<xsl:value-of select="$width"/> -->
4252
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4253
+ <!-- height=<xsl:value-of select="$height"/> -->
4254
+ <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">
4255
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
4256
+ <xsl:call-template name="svg_cross">
4257
+ <xsl:with-param name="width" select="$width"/>
4258
+ <xsl:with-param name="height" select="$height"/>
4259
+ </xsl:call-template>
4260
+ </svg>
4261
+ </xsl:otherwise>
4262
+ </xsl:choose>
4263
+
4264
+ </xsl:template><xsl:template name="svg_cross">
4265
+ <xsl:param name="width"/>
4266
+ <xsl:param name="height"/>
4267
+ <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; "/>
4268
+ <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; "/>
4056
4269
  </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">
4057
4270
  <xsl:apply-templates mode="contents"/>
4058
4271
  <xsl:text> </xsl:text>
@@ -4646,6 +4859,7 @@
4646
4859
  <xsl:variable name="element">
4647
4860
 
4648
4861
  inline
4862
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4649
4863
  </xsl:variable>
4650
4864
  <xsl:choose>
4651
4865
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4653,7 +4867,7 @@
4653
4867
  <xsl:apply-templates/>
4654
4868
  </fo:inline>
4655
4869
  </xsl:when>
4656
- <xsl:when test="normalize-space($element) = 'block'">
4870
+ <xsl:when test="contains(normalize-space($element), 'block')">
4657
4871
  <fo:block xsl:use-attribute-sets="example-name-style">
4658
4872
  <xsl:apply-templates/>
4659
4873
  </fo:block>
@@ -4872,7 +5086,8 @@
4872
5086
  </fo:inline>
4873
5087
  </xsl:when>
4874
5088
  <xsl:otherwise>
4875
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
5089
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
5090
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4876
5091
  </xsl:otherwise>
4877
5092
  </xsl:choose>
4878
5093
 
@@ -5727,4 +5942,44 @@
5727
5942
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5728
5943
  </xsl:choose>
5729
5944
 
5945
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5946
+ <xsl:param name="isAdded"/>
5947
+ <xsl:param name="isDeleted"/>
5948
+ <xsl:choose>
5949
+ <xsl:when test="local-name() = 'math'">
5950
+ <xsl:if test="$isAdded = 'true'">
5951
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5952
+ </xsl:if>
5953
+ <xsl:if test="$isDeleted = 'true'">
5954
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5955
+ </xsl:if>
5956
+ </xsl:when>
5957
+ <xsl:otherwise>
5958
+ <xsl:if test="$isAdded = 'true'">
5959
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5960
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5961
+ </xsl:if>
5962
+ <xsl:if test="$isDeleted = 'true'">
5963
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5964
+ <xsl:if test="local-name() = 'table'">
5965
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5966
+ </xsl:if>
5967
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5968
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5969
+ </xsl:if>
5970
+ </xsl:otherwise>
5971
+ </xsl:choose>
5972
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5973
+ <xsl:if test="$lang = 'ar'">
5974
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5975
+ </xsl:if>
5976
+ </xsl:template><xsl:template name="setAlignment">
5977
+ <xsl:param name="align" select="normalize-space(@align)"/>
5978
+ <xsl:choose>
5979
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5980
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5981
+ <xsl:when test="$align != ''">
5982
+ <xsl:value-of select="$align"/>
5983
+ </xsl:when>
5984
+ </xsl:choose>
5730
5985
  </xsl:template></xsl:stylesheet>