metanorma-ogc 1.0.3 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +10 -10
  3. data/.github/workflows/ubuntu.yml +25 -11
  4. data/.github/workflows/windows.yml +11 -12
  5. data/README.adoc +3 -2
  6. data/lib/asciidoctor/ogc/biblio.rng +144 -49
  7. data/lib/asciidoctor/ogc/boilerplate.xml +37 -69
  8. data/lib/asciidoctor/ogc/converter.rb +6 -11
  9. data/lib/asciidoctor/ogc/isodoc.rng +49 -5
  10. data/lib/asciidoctor/ogc/ogc.rng +0 -4
  11. data/lib/isodoc/ogc/base_convert.rb +13 -112
  12. data/lib/isodoc/ogc/biblio.rb +13 -2
  13. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +2 -6
  14. data/lib/isodoc/ogc/html/htmlstyle.scss +11 -1
  15. data/lib/isodoc/ogc/html/scripts.html +14 -27
  16. data/lib/isodoc/ogc/html/word_ogc_titlepage.html +13 -4
  17. data/lib/isodoc/ogc/html_convert.rb +1 -0
  18. data/lib/isodoc/ogc/i18n-en.yaml +3 -0
  19. data/lib/isodoc/ogc/metadata.rb +1 -31
  20. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +3387 -0
  21. data/lib/isodoc/ogc/ogc.best-practice.xsl +3387 -0
  22. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +3387 -0
  23. data/lib/isodoc/ogc/ogc.community-practice.xsl +3387 -0
  24. data/lib/isodoc/ogc/ogc.community-standard.xsl +3387 -0
  25. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +3387 -0
  26. data/lib/isodoc/ogc/ogc.engineering-report.xsl +3387 -0
  27. data/lib/isodoc/ogc/ogc.other.xsl +3387 -0
  28. data/lib/isodoc/ogc/ogc.policy.xsl +3387 -0
  29. data/lib/isodoc/ogc/ogc.reference-model.xsl +3387 -0
  30. data/lib/isodoc/ogc/ogc.release-notes.xsl +3387 -0
  31. data/lib/isodoc/ogc/ogc.standard.xsl +3387 -0
  32. data/lib/isodoc/ogc/ogc.test-suite.xsl +3387 -0
  33. data/lib/isodoc/ogc/ogc.user-guide.xsl +3387 -0
  34. data/lib/isodoc/ogc/ogc.white-paper.xsl +3387 -0
  35. data/lib/isodoc/ogc/pdf_convert.rb +18 -77
  36. data/lib/isodoc/ogc/reqt.rb +74 -114
  37. data/lib/isodoc/ogc/reqt_xref.rb +96 -0
  38. data/lib/isodoc/ogc/sections.rb +111 -0
  39. data/lib/isodoc/ogc/word_convert.rb +17 -11
  40. data/lib/metanorma/ogc/processor.rb +8 -0
  41. data/lib/metanorma/ogc/version.rb +1 -1
  42. data/metanorma-ogc.gemspec +1 -1
  43. metadata +21 -5
  44. data/lib/isodoc/ogc/html/scripts.pdf.html +0 -72
@@ -3,7 +3,7 @@ module IsoDoc
3
3
  module BaseConvert
4
4
  def std_bibitem_entry(list, b, ordinal, biblio)
5
5
  list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
6
- prefix_bracketed_ref(ref, ordinal) if biblio
6
+ prefix_bracketed_ref(ref, "[#{ordinal}]") if biblio
7
7
  standard_citation(ref, b)
8
8
  end
9
9
  end
@@ -91,7 +91,8 @@ module IsoDoc
91
91
  c = extract_city(b)
92
92
  y = extract_year(b)
93
93
  out << "#{pub_abbrev}: " if pub_abbrev
94
- out << render_identifier(bibitem_ref_code(b))
94
+ id = render_identifier(inline_bibitem_ref_code(b))
95
+ out << id[1] if id[1]
95
96
  out << ", "
96
97
  out.i do |i|
97
98
  iso_title(b)&.children&.each { |n| parse(n, i) }
@@ -104,6 +105,16 @@ module IsoDoc
104
105
  out << "(#{y})." if y
105
106
  end
106
107
  end
108
+
109
+ def inline_bibitem_ref_code(b)
110
+ id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
111
+ "or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
112
+ id ||= b.at(ns("./docidentifier[not(@type = 'metanorma')]"))
113
+ return [nil, id, nil] if id
114
+ id = Nokogiri::XML::Node.new("docidentifier", b.document)
115
+ id << "(NO ID)"
116
+ [nil, id, nil]
117
+ end
107
118
  end
108
119
  end
109
120
  end
@@ -95,7 +95,8 @@
95
95
 
96
96
  <div class="docstage-box">
97
97
  <table>
98
- <tr><th>Document type:</th><th>OGC {{doctype}}</th></tr>
98
+ <tr><td>Document number:</td><td>{{docnumber}}</td></tr>
99
+ <tr><td>Document type:</td><td>OGC {{doctype}}</td></tr>
99
100
  <tr><td align="right">Document subtype:</td><td align="right">{{docsubtype}}</td></tr>
100
101
  <tr><td align="right">Document stage:</td><td align="right">{{stage}}</td></tr>
101
102
  <tr><td align="right">Document language:</td><td align="right">{{doclanguage}}</td></tr>
@@ -105,11 +106,6 @@
105
106
  <div class="info-section">
106
107
  <div class="copyright">
107
108
  <div id="boilerplate-copyright-destination"/>
108
- {% if doctype == "Standard" or doctype == "Community Standard" %}
109
- <div class="contact-info">
110
- <div id="boilerplate-contact-destination"/>
111
- </div>
112
- {% endif %}
113
109
  </div>
114
110
 
115
111
  <div class="rule"></div>
@@ -135,7 +135,10 @@ nav {
135
135
  }
136
136
 
137
137
  .document-type-band {
138
- @include docBand($order: 2, $textLength: 150px, $offset: 180px);
138
+ @include docBand($order: 2, $offset: 180px);
139
+ .document-type {
140
+ top: 20px;
141
+ }
139
142
  }
140
143
 
141
144
  #governance-band p.document-type {
@@ -295,6 +298,13 @@ table {
295
298
  font-weight: 400;
296
299
  }
297
300
  }
301
+ .docstage-box {
302
+ table,
303
+ table th,
304
+ table td {
305
+ border: none
306
+ }
307
+ }
298
308
 
299
309
  table.recommendtest {
300
310
  @include table($border: none !important);
@@ -1,24 +1,8 @@
1
1
  <script>
2
- //TOC generation
3
- $('#toc').toc({
4
- 'selectors': toclevel(), //elements to use as headings
5
- 'container': 'main', //element to find all selectors in
6
- 'smoothScrolling': true, //enable or disable smooth scrolling on click
7
- 'prefix': 'toc', //prefix for anchor tags and class names
8
- 'onHighlight': function(el) {}, //called when a new section is highlighted
9
- 'highlightOnScroll': true, //add class to heading that is currently in focus
10
- 'highlightOffset': 100, //offset to trigger the next headline
11
- 'anchorName': function(i, heading, prefix) { //custom function for anchor name
12
- return prefix+i;
13
- },
14
- 'headerText': function(i, heading, $heading) { //custom function building the header-item text
15
- return $heading.text();
16
- },
17
- 'itemClass': function(i, heading, $heading, prefix) { // custom function for item class
18
- return $heading[0].tagName.toLowerCase();
19
- }
20
- });
21
-
2
+ $("#toc").on('click', 'li', function(e) {
3
+ $(this).parent().find('li.toc-active').removeClass('toc-active');
4
+ $(this).addClass('toc-active');
5
+ });
22
6
  </script>
23
7
 
24
8
  <script>
@@ -58,13 +42,16 @@ $('#toggle').on('click', function(){
58
42
  </script>
59
43
 
60
44
  <script>
61
- /**
62
- * AnchorJS - v4.1.0 - 2017-09-20
63
- * https://github.com/bryanbraun/anchorjs
64
- * Copyright (c) 2017 Bryan Braun; Licensed MIT
65
- */
66
- !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function e(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64}function t(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}function i(){if(null===document.head.querySelector("style.anchorjs")){var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"], style'))?document.head.appendChild(e):document.head.insertBefore(e,A),e.sheet.insertRule(" .anchorjs-link { opacity: 0; text-decoration: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }",e.sheet.cssRules.length),e.sheet.insertRule(" *:hover > .anchorjs-link, .anchorjs-link:focus { opacity: 1; }",e.sheet.cssRules.length),e.sheet.insertRule(" [data-anchorjs-icon]::after { content: attr(data-anchorjs-icon); }",e.sheet.cssRules.length),e.sheet.insertRule(' @font-face { font-family: "anchorjs-icons"; src: url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype"); }',e.sheet.cssRules.length)}}this.options=A||{},this.elements=[],e(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var n,o,s,a,r,c,h,l,u,d,f,p=[];if(e(this.options),"touch"===(f=this.options.visible)&&(f=this.isTouchDevice()?"always":"hover"),A||(A="h2, h3, h4, h5, h6"),0===(n=t(A)).length)return this;for(i(),o=document.querySelectorAll("[id]"),s=[].map.call(o,function(A){return A.id}),r=0;r<n.length;r++)if(this.hasAnchorJSLink(n[r]))p.push(r);else{if(n[r].hasAttribute("id"))a=n[r].getAttribute("id");else if(n[r].hasAttribute("data-anchor-id"))a=n[r].getAttribute("data-anchor-id");else{u=l=this.urlify(n[r].textContent),h=0;do{void 0!==c&&(u=l+"-"+h),c=s.indexOf(u),h+=1}while(-1!==c);c=void 0,s.push(u),n[r].setAttribute("id",u),a=u}a.replace(/-/g," "),(d=document.createElement("a")).className="anchorjs-link "+this.options.class,d.href="#"+a,d.setAttribute("aria-label",this.options.ariaLabel),d.setAttribute("data-anchorjs-icon",this.options.icon),"always"===f&&(d.style.opacity="1"),""===this.options.icon&&(d.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(d.style.lineHeight="inherit")),"left"===this.options.placement?(d.style.position="absolute",d.style.marginLeft="-1em",d.style.paddingRight="0.5em",n[r].insertBefore(d,n[r].firstChild)):(d.style.paddingLeft="0.375em",n[r].appendChild(d))}for(r=0;r<p.length;r++)n.splice(p[r]-r,1);return this.elements=this.elements.concat(n),this},this.remove=function(A){for(var e,i,n=t(A),o=0;o<n.length;o++)(i=n[o].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(n[o]))&&this.elements.splice(e,1),n[o].removeChild(i));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){var t=/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\]/g;return this.options.truncate||e(this.options),A.trim().replace(/\'/gi,"").replace(t,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&(" "+A.firstChild.className+" ").indexOf(" anchorjs-link ")>-1,t=A.lastChild&&(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ")>-1;return e||t||!1}}}); </script>
67
-
45
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
46
+ //
47
+ // AnchorJS - v4.2.2 - 2020-04-20
48
+ // https://www.bryanbraun.com/anchorjs/
49
+ // Copyright (c) 2020 Bryan Braun; Licensed MIT
50
+ //
51
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
52
+ !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
53
+ // @license-end
54
+ </script>
68
55
  <script>
69
56
  /*
70
57
  $(document).ready(function() {
@@ -36,7 +36,7 @@ style='mso-no-proof:yes;font-size:10.0pt'>Editor: {{ editors | join: ", " }}
36
36
  {% endif %}
37
37
 
38
38
  <p class="MsoNormal" align="center" style='text-align:center;line-height:18.0pt;margin-bottom:0.0pt'><b
39
- style='mso-bidi-font-weight:normal'><span lang="EN-GB" style='font-size:24.0pt'>OGC {{ doctitle }}</span>
39
+ style='mso-bidi-font-weight:normal'><span lang="EN-GB" style='font-size:24.0pt'>{{ doctitle }}</span>
40
40
  </b></p>
41
41
 
42
42
  <p class="MsoNormal" style='margin-top:100.0pt'><span lang="EN-GB"><o:p>&nbsp;</o:p></span></p>
@@ -55,6 +55,17 @@ page;mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'>
55
55
  <tr>
56
56
  <td valign=top align=left style='padding-top:7.1pt;padding-right:7.1pt;
57
57
  padding-bottom:7.1pt;padding-left:7.1pt'>
58
+ <p class=zzCover align=left style='margin-bottom:0cm;margin-bottom:.0001pt;
59
+ text-align:left;mso-hyphenate:none;tab-stops:99.0pt;mso-element:frame;
60
+ mso-element-frame-hspace:7.1pt;mso-element-frame-vspace:7.1pt;mso-element-wrap:
61
+ auto;mso-element-anchor-vertical:page;mso-element-anchor-horizontal:page;
62
+ mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'><span
63
+ lang=EN-GB style='font-size:10.0pt;mso-color-alt:windowtext;font-weight:normal'>Document
64
+ number:&nbsp;&nbsp;&nbsp;<span style='mso-tab-count:1'>         </span><span
65
+ class=SpellE><span lang=EN-GB
66
+ style='font-size:10.0pt;font-weight:normal'>{{ docnumber }}</span><span lang=EN-GB style='font-size:10.0pt;
67
+ mso-color-alt:windowtext;font-weight:normal'><o:p></o:p></span></p>
68
+
58
69
  <p class=zzCover align=left style='margin-bottom:0cm;margin-bottom:.0001pt;
59
70
  text-align:left;mso-hyphenate:none;tab-stops:99.0pt;mso-element:frame;
60
71
  mso-element-frame-hspace:7.1pt;mso-element-frame-vspace:7.1pt;mso-element-wrap:
@@ -66,7 +77,6 @@ page;mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'>
66
77
  style='font-size:10.0pt;font-weight:normal'>{{ doctype }}</span><span lang=EN-GB style='font-size:10.0pt;
67
78
  mso-color-alt:windowtext;font-weight:normal'><o:p></o:p></span></p>
68
79
 
69
- {% if docsubstatus %}
70
80
  <p class=zzCover align=left style='margin-bottom:0cm;margin-bottom:.0001pt;
71
81
  text-align:left;mso-hyphenate:none;tab-stops:99.0pt;mso-element:frame;
72
82
  mso-element-frame-hspace:7.1pt;mso-element-frame-vspace:7.1pt;mso-element-wrap:
@@ -74,7 +84,6 @@ page;mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'>
74
84
  mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'><span
75
85
  lang=EN-GB style='font-size:10.0pt;mso-color-alt:windowtext;font-weight:normal'>Document
76
86
  subtype:&nbsp;&nbsp;&nbsp;<span style='mso-tab-count:1'>    </span>{{ docsubstatus }}<o:p></o:p></span></p>
77
- {% endif %}
78
87
 
79
88
  <p class=zzCover align=left style='margin-bottom:0cm;margin-bottom:.0001pt;
80
89
  text-align:left;mso-hyphenate:none;tab-stops:99.0pt;mso-element:frame;
@@ -89,7 +98,7 @@ page;mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'>
89
98
  auto;mso-element-anchor-vertical:page;mso-element-anchor-horizontal:page;
90
99
  mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'><span
91
100
  lang=EN-GB style='font-size:10.0pt;mso-color-alt:windowtext;font-weight:normal'>Document
92
- language:&nbsp;<span style='mso-tab-count:1'>    </span>{{ language }}</span><span
101
+ language:&nbsp;<span style='mso-tab-count:1'>    </span>{{ doclanguage }}</span><span
93
102
  lang=EN-GB style='font-size:8.0pt;mso-bidi-font-size:10.0pt;mso-color-alt:
94
103
  windowtext'><o:p></o:p></span></p>
95
104
  </td>
@@ -12,6 +12,7 @@ module IsoDoc
12
12
  class HtmlConvert < IsoDoc::HtmlConvert
13
13
  def initialize(options)
14
14
  @libdir = File.dirname(__FILE__)
15
+ @reqtlabels = {}
15
16
  super
16
17
  end
17
18
 
@@ -5,3 +5,6 @@ permissiontest: Permission Test
5
5
  recommendationclass: Recommendation Class
6
6
  requirementclass: Requirement Class
7
7
  permissionclass: Permission Class
8
+ abstracttest: Abstract Test
9
+ conformanceclass: Conformance Class
10
+ example: Example
@@ -54,6 +54,7 @@ module IsoDoc
54
54
  set(:authors, extract_person_names(authors))
55
55
  editors = isoxml.xpath(ns("//bibdata/contributor[role/@type = 'editor']/person"))
56
56
  set(:editors, extract_person_names(editors))
57
+ agency(isoxml)
57
58
  end
58
59
 
59
60
  def docid(isoxml, _out)
@@ -61,48 +62,17 @@ module IsoDoc
61
62
  set(:externalid, isoxml&.at(ns("//bibdata/docidentifier[@type = 'ogc-external']"))&.text)
62
63
  end
63
64
 
64
- def keywords(isoxml, _out)
65
- keywords = []
66
- isoxml.xpath(ns("//bibdata/keyword | //bibdata/ext/keyword")).each do |kw|
67
- keywords << kw.text
68
- end
69
- set(:keywords, keywords)
70
- end
71
-
72
65
  def unpublished(status)
73
66
  !%w(published deprecated retired).include?(status.downcase)
74
67
  end
75
68
 
76
69
  def version(isoxml, _out)
77
70
  super
78
- revdate = get[:revdate]
79
- set(:revdate_monthyear, monthyr(revdate))
80
71
  set(:edition, isoxml&.at(ns("//bibdata/edition"))&.text)
81
72
  lg = ISO_639.find_by_code(isoxml&.at(ns("//bibdata/language"))&.text)
82
73
  set(:doclanguage, lg ? lg[3] : "English")
83
74
  end
84
75
 
85
- MONTHS = {
86
- "01": "January",
87
- "02": "February",
88
- "03": "March",
89
- "04": "April",
90
- "05": "May",
91
- "06": "June",
92
- "07": "July",
93
- "08": "August",
94
- "09": "September",
95
- "10": "October",
96
- "11": "November",
97
- "12": "December",
98
- }.freeze
99
-
100
- def monthyr(isodate)
101
- m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)/.match isodate
102
- return isodate unless m && m[:yr] && m[:mo]
103
- return "#{MONTHS[m[:mo].to_sym]} #{m[:yr]}"
104
- end
105
-
106
76
  def url(xml, _out)
107
77
  super
108
78
  a = xml.at(ns("//bibdata/uri[@type = 'previous']")) and set(:previousuri, a.text)
@@ -0,0 +1,3387 @@
1
+ <?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" version="1.0">
2
+
3
+ <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
+
5
+ <xsl:variable name="pageWidth" select="'210mm'"/>
6
+ <xsl:variable name="pageHeight" select="'297mm'"/>
7
+
8
+
9
+
10
+ <xsl:variable name="debug">false</xsl:variable>
11
+
12
+ <xsl:variable name="copyright">
13
+ <xsl:text>© Open Geospatial Consortium </xsl:text>
14
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:copyright/ogc:from"/>
15
+ <xsl:text> – All rights reserved</xsl:text>
16
+ </xsl:variable>
17
+ <xsl:variable name="copyright_short">
18
+ <xsl:text>© </xsl:text>
19
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:copyright/ogc:from"/>
20
+ <xsl:text> </xsl:text>
21
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor/ogc:organization/ogc:name"/>
22
+ </xsl:variable>
23
+
24
+ <xsl:variable name="doctitle" select="/ogc:ogc-standard/ogc:bibdata/ogc:title[@language = 'en']"/>
25
+
26
+ <xsl:variable name="doctype">
27
+ <xsl:call-template name="capitalizeWords">
28
+ <xsl:with-param name="str" select="/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:doctype"/>
29
+ </xsl:call-template>
30
+ </xsl:variable>
31
+
32
+ <xsl:variable name="header">
33
+ <xsl:text>Open Geospatial Consortium </xsl:text>
34
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:docidentifier[@type = 'ogc-internal']"/>
35
+ <xsl:text>:</xsl:text>
36
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:copyright/ogc:from"/>
37
+ </xsl:variable>
38
+
39
+ <xsl:variable name="contents">
40
+ <contents>
41
+
42
+
43
+ <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
44
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract" mode="contents"/>
45
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1]" mode="contents">
46
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + 1"/>
47
+ </xsl:apply-templates>
48
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="contents">
49
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + count (/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1])+ 1"/>
50
+ </xsl:apply-templates>
51
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="contents"/>
52
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name" mode="contents">
53
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + count (/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1])+ count(/ogc:ogc-standard/ogc:preface/ogc:foreword) + 1"/>
54
+ </xsl:apply-templates>
55
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters" mode="contents">
56
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + count (/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1])+ count(/ogc:ogc-standard/ogc:preface/ogc:foreword) + count(/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name) + 1"/>
57
+ </xsl:apply-templates>
58
+
59
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']" mode="contents">
60
+ <xsl:with-param name="sectionNum" select="'1'"/>
61
+ </xsl:apply-templates>
62
+
63
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']" mode="contents">
64
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + 1"/>
65
+ </xsl:apply-templates>
66
+
67
+ <!-- Normative references -->
68
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']" mode="contents">
69
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + 1"/>
70
+ </xsl:apply-templates>
71
+
72
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms" mode="contents"> <!-- Terms and definitions -->
73
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + count(/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']) + 1"/>
74
+ </xsl:apply-templates>
75
+
76
+
77
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/*[local-name() != 'terms' and not(@id='_scope') and not(@id='conformance') and not(@id='_conformance')]" mode="contents">
78
+ <xsl:with-param name="sectionNumSkew" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + count(/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']) + count(/ogc:ogc-standard/ogc:sections/ogc:terms)"/>
79
+ </xsl:apply-templates>
80
+
81
+
82
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex" mode="contents"/>
83
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id != '_normative_references' and @id != '_references']" mode="contents"/> <!-- [position() &gt; 1] -->
84
+
85
+
86
+ </contents>
87
+ </xsl:variable>
88
+
89
+ <xsl:variable name="lang">
90
+ <xsl:call-template name="getLang"/>
91
+ </xsl:variable>
92
+
93
+ <xsl:template match="/">
94
+ <xsl:message>INFO: Document namespace: '<xsl:value-of select="namespace-uri(/*)"/>'</xsl:message>
95
+ <fo:root font-family="Times New Roman, STIX2Math, HanSans" font-size="10.5pt" xml:lang="{$lang}">
96
+ <fo:layout-master-set>
97
+ <!-- Cover page -->
98
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
99
+ <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
100
+ <fo:region-before region-name="cover-page-header" extent="23.5mm"/>
101
+ <fo:region-after extent="10mm"/>
102
+ <fo:region-start extent="19mm"/>
103
+ <fo:region-end extent="19mm"/>
104
+ </fo:simple-page-master>
105
+
106
+ <!-- Document pages -->
107
+ <!-- Preface odd pages -->
108
+ <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
109
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
110
+ <fo:region-before region-name="header-odd" extent="17mm"/>
111
+ <fo:region-after region-name="footer-odd" extent="10mm"/>
112
+ <fo:region-start region-name="left-region" extent="19mm"/>
113
+ <fo:region-end region-name="right-region" extent="19mm"/>
114
+ </fo:simple-page-master>
115
+ <!-- Preface even pages -->
116
+ <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
117
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
118
+ <fo:region-before region-name="header-even" extent="17mm"/>
119
+ <fo:region-after region-name="footer-even" extent="10mm"/>
120
+ <fo:region-start region-name="left-region" extent="19mm"/>
121
+ <fo:region-end region-name="right-region" extent="19mm"/>
122
+ </fo:simple-page-master>
123
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
124
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
125
+ <fo:region-before region-name="header" extent="17mm"/>
126
+ <fo:region-after region-name="footer" extent="10mm"/>
127
+ <fo:region-start region-name="left" extent="19mm"/>
128
+ <fo:region-end region-name="right" extent="19mm"/>
129
+ </fo:simple-page-master>
130
+ <fo:page-sequence-master master-name="preface">
131
+ <fo:repeatable-page-master-alternatives>
132
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
133
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-preface"/>
134
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-preface"/>
135
+ </fo:repeatable-page-master-alternatives>
136
+ </fo:page-sequence-master>
137
+
138
+ <!-- Document odd pages -->
139
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
140
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
141
+ <fo:region-before region-name="header-odd" extent="17mm"/>
142
+ <fo:region-after region-name="footer-odd" extent="10mm"/>
143
+ <fo:region-start region-name="left-region" extent="19mm"/>
144
+ <fo:region-end region-name="right-region" extent="19mm"/>
145
+ </fo:simple-page-master>
146
+ <!-- Document even pages -->
147
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
148
+ <fo:region-body margin-top="17mm" margin-bottom="9mm" margin-left="19mm" margin-right="19mm"/>
149
+ <fo:region-before region-name="header-even" extent="17mm"/>
150
+ <fo:region-after region-name="footer-even" extent="10mm"/>
151
+ <fo:region-start region-name="left-region" extent="19mm"/>
152
+ <fo:region-end region-name="right-region" extent="19mm"/>
153
+ </fo:simple-page-master>
154
+ <fo:page-sequence-master master-name="document">
155
+ <fo:repeatable-page-master-alternatives>
156
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
157
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
158
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
159
+ </fo:repeatable-page-master-alternatives>
160
+ </fo:page-sequence-master>
161
+
162
+ </fo:layout-master-set>
163
+
164
+ <fo:declarations>
165
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
166
+ <pdf:dictionary type="normal" key="ViewerPreferences">
167
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
168
+ </pdf:dictionary>
169
+ </pdf:catalog>
170
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
171
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
172
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
173
+ <!-- Dublin Core properties go here -->
174
+ <dc:title>
175
+ <xsl:choose>
176
+ <xsl:when test="$doctitle != ''">
177
+ <xsl:value-of select="$doctitle"/>
178
+ </xsl:when>
179
+ <xsl:otherwise>
180
+ <xsl:text> </xsl:text>
181
+ </xsl:otherwise>
182
+ </xsl:choose>
183
+ </dc:title>
184
+ <dc:creator/>
185
+ <dc:description>
186
+ <xsl:variable name="abstract">
187
+ <xsl:copy-of select="/ogc:ogc-standard/ogc:bibdata/ogc:abstract//text()"/>
188
+ </xsl:variable>
189
+ <xsl:value-of select="normalize-space($abstract)"/>
190
+ </dc:description>
191
+ <pdf:Keywords>
192
+ <xsl:call-template name="insertKeywords"/>
193
+ </pdf:Keywords>
194
+ </rdf:Description>
195
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
196
+ <!-- XMP properties go here -->
197
+ <xmp:CreatorTool/>
198
+ </rdf:Description>
199
+ </rdf:RDF>
200
+ </x:xmpmeta>
201
+ </fo:declarations>
202
+
203
+ <!-- Cover Page -->
204
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
205
+ <fo:static-content flow-name="xsl-footnote-separator">
206
+ <fo:block>
207
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
208
+ </fo:block>
209
+ </fo:static-content>
210
+ <fo:static-content flow-name="cover-page-header" font-size="10pt">
211
+ <fo:block-container height="23.5mm" display-align="before">
212
+ <fo:block padding-top="12.5mm">
213
+ <xsl:value-of select="$copyright"/>
214
+ </fo:block>
215
+ </fo:block-container>
216
+ </fo:static-content>
217
+
218
+ <fo:flow flow-name="xsl-region-body">
219
+
220
+ <fo:block text-align="right" font-size="10pt">
221
+ <!-- CC/FDS 18011:2018 -->
222
+ <fo:block font-size="18pt" font-weight="bold" margin-bottom="10pt">
223
+ <xsl:text>Open Geospatial Consortium </xsl:text>
224
+ </fo:block>
225
+ <fo:block line-height="115%">
226
+ <fo:block margin-bottom="12pt">
227
+ <xsl:text>Submission Date: </xsl:text>
228
+ <xsl:choose>
229
+ <xsl:when test="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'received']/ogc:on">
230
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'received']/ogc:on"/>
231
+ </xsl:when>
232
+ <xsl:otherwise>XXX</xsl:otherwise>
233
+ </xsl:choose>
234
+ <xsl:text> </xsl:text>
235
+ </fo:block>
236
+ <fo:block margin-bottom="12pt">
237
+ <xsl:text>Approval Date: </xsl:text>
238
+ <xsl:choose>
239
+ <xsl:when test="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'issued']/ogc:on">
240
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'issued']/ogc:on"/>
241
+ </xsl:when>
242
+ <xsl:otherwise>XXX</xsl:otherwise>
243
+ </xsl:choose>
244
+ <xsl:text> </xsl:text>
245
+ </fo:block>
246
+ <fo:block margin-bottom="12pt">
247
+ <xsl:text>Publication Date: </xsl:text>
248
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:date[@type = 'published']/ogc:on"/><xsl:text> </xsl:text>
249
+ </fo:block>
250
+ <fo:block margin-bottom="12pt">
251
+ <xsl:text>External identifier of this OGC® document: </xsl:text>
252
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:docidentifier[@type='ogc-external']"/><xsl:text> </xsl:text>
253
+ </fo:block>
254
+ <fo:block margin-bottom="12pt">
255
+ <xsl:text>Internal reference number of this OGC® document: </xsl:text>
256
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:docidentifier[@type='ogc-internal']"/><xsl:text> </xsl:text>
257
+ </fo:block>
258
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:uri[not(@type)]"/>
259
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:edition"/>
260
+
261
+ <fo:block margin-bottom="12pt">
262
+ <xsl:text>Category: </xsl:text>
263
+ <xsl:value-of select="$doctype"/>
264
+ <xsl:text> </xsl:text>
265
+ </fo:block>
266
+ <fo:block margin-bottom="12pt">
267
+ <xsl:text>Editor: </xsl:text>
268
+ <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='editor']/ogc:person/ogc:name/ogc:completename">
269
+ <xsl:value-of select="."/>
270
+ <xsl:if test="position() != last()">, </xsl:if>
271
+ </xsl:for-each>
272
+ <xsl:text> </xsl:text>
273
+ </fo:block>
274
+ </fo:block>
275
+ </fo:block>
276
+ <fo:block font-size="24pt" font-weight="bold" text-align="center" margin-top="15pt" line-height="115%">
277
+ <xsl:text>OGC </xsl:text><xsl:value-of select="$doctitle"/>
278
+ </fo:block>
279
+ <fo:block margin-bottom="12pt"> </fo:block>
280
+ <!-- Copyright notice -->
281
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:copyright-statement"/>
282
+
283
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:legal-statement"/>
284
+
285
+ <fo:block-container absolute-position="fixed" left="14mm" top="250mm" font-size="10pt">
286
+ <fo:table table-layout="fixed" width="100%">
287
+ <fo:table-column column-width="35mm"/>
288
+ <fo:table-column column-width="70mm"/>
289
+ <fo:table-body>
290
+ <fo:table-row height="9mm">
291
+ <fo:table-cell>
292
+ <fo:block>Document type: </fo:block>
293
+ </fo:table-cell>
294
+ <fo:table-cell>
295
+ <fo:block line-height-shift-adjustment="disregard-shifts">OGC<fo:inline font-size="65%" vertical-align="super">®</fo:inline><xsl:text> </xsl:text><xsl:value-of select="$doctype"/></fo:block>
296
+ </fo:table-cell>
297
+ </fo:table-row>
298
+ <fo:table-row height="9mm">
299
+ <fo:table-cell>
300
+ <fo:block>Document stage: </fo:block>
301
+ </fo:table-cell>
302
+ <fo:table-cell>
303
+ <fo:block>
304
+ <xsl:variable name="stage" select="/ogc:ogc-standard/ogc:bibdata/ogc:status/ogc:stage"/>
305
+ <xsl:value-of select="translate(substring($stage, 1, 1), $lower, $upper)"/>
306
+ <xsl:value-of select="substring($stage, 2)"/>
307
+ </fo:block>
308
+ </fo:table-cell>
309
+ </fo:table-row>
310
+ <fo:table-row height="9mm">
311
+ <fo:table-cell>
312
+ <fo:block>Document language: </fo:block>
313
+ </fo:table-cell>
314
+ <fo:table-cell>
315
+ <fo:block><xsl:value-of select="$lang"/></fo:block>
316
+ </fo:table-cell>
317
+ </fo:table-row>
318
+ </fo:table-body>
319
+ </fo:table>
320
+ </fo:block-container>
321
+
322
+ </fo:flow>
323
+ </fo:page-sequence>
324
+ <!-- End Cover Page -->
325
+
326
+
327
+ <!-- Copyright, Content, Foreword, etc. pages -->
328
+ <fo:page-sequence master-reference="preface" initial-page-number="2" format="i" force-page-count="end-on-even"> <!-- -->
329
+ <fo:static-content flow-name="xsl-footnote-separator">
330
+ <fo:block>
331
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
332
+ </fo:block>
333
+ </fo:static-content>
334
+ <xsl:call-template name="insertHeaderFooter"/>
335
+ <fo:flow flow-name="xsl-region-body">
336
+
337
+ <xsl:if test="$debug = 'true'">
338
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
339
+ DEBUG
340
+ contents=<!-- <xsl:copy-of select="xalan:nodeset($contents)"/> -->
341
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
342
+ </xsl:if>
343
+
344
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:license-statement"/>
345
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:feedback-statement"/>
346
+
347
+ <fo:block break-after="page"/>
348
+ <fo:block> </fo:block>
349
+ <fo:block break-after="page"/>
350
+
351
+ <fo:block-container font-weight="bold" line-height="115%">
352
+ <fo:block font-size="14pt" margin-top="2pt" margin-bottom="15.5pt">Contents</fo:block>
353
+
354
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true' and @level &lt;= 2]"><!-- skip clause from preface [not(@level = 2 and starts-with(@section, '0'))] -->
355
+
356
+ <fo:block>
357
+ <xsl:if test="@level = 1">
358
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
359
+ </xsl:if>
360
+ <fo:list-block>
361
+ <xsl:attribute name="provisional-distance-between-starts">
362
+ <xsl:choose>
363
+ <!-- skip 0 section without subsections -->
364
+ <xsl:when test="@section != '' and not(@display-section = 'false')">8mm</xsl:when>
365
+ <xsl:otherwise>0mm</xsl:otherwise>
366
+ </xsl:choose>
367
+ </xsl:attribute>
368
+ <fo:list-item>
369
+ <fo:list-item-label end-indent="label-end()">
370
+ <fo:block>
371
+ <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
372
+ <xsl:value-of select="@section"/><xsl:text>.</xsl:text>
373
+ </xsl:if>
374
+ </fo:block>
375
+ </fo:list-item-label>
376
+ <fo:list-item-body start-indent="body-start()">
377
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
378
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
379
+ <xsl:if test="@section and @display-section = 'false' and not(@section = '0')">
380
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
381
+ </xsl:if>
382
+ <xsl:if test="@addon != ''">
383
+ <xsl:text>(</xsl:text><xsl:value-of select="@addon"/><xsl:text>)</xsl:text>
384
+ </xsl:if>
385
+ <xsl:text> </xsl:text><xsl:value-of select="text()"/>
386
+ <fo:inline keep-together.within-line="always">
387
+ <fo:leader leader-pattern="dots"/>
388
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
389
+ </fo:inline>
390
+ </fo:basic-link>
391
+ </fo:block>
392
+ </fo:list-item-body>
393
+ </fo:list-item>
394
+ </fo:list-block>
395
+ </fo:block>
396
+ </xsl:for-each>
397
+
398
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
399
+ <fo:block font-size="12pt"> </fo:block>
400
+ <fo:block font-size="12pt"> </fo:block>
401
+ <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt">List of Tables</fo:block>
402
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table']">
403
+ <fo:block text-align-last="justify" margin-top="6pt">
404
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
405
+ <xsl:value-of select="@section"/>
406
+ <xsl:if test="text() != ''">
407
+ <xsl:text> — </xsl:text>
408
+ <xsl:value-of select="text()"/>
409
+ </xsl:if>
410
+ <xsl:text> </xsl:text>
411
+ <fo:inline keep-together.within-line="always">
412
+ <fo:leader leader-pattern="dots"/>
413
+ <fo:page-number-citation ref-id="{@id}"/>
414
+ </fo:inline>
415
+ </fo:basic-link>
416
+ </fo:block>
417
+ </xsl:for-each>
418
+ </xsl:if>
419
+
420
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
421
+ <fo:block font-size="12pt"> </fo:block>
422
+ <fo:block font-size="12pt"> </fo:block>
423
+ <fo:block font-size="14pt" font-weight="bold" space-before="48pt" margin-bottom="15.5pt">List of Figures</fo:block>
424
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
425
+ <fo:block text-align-last="justify" margin-top="6pt">
426
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
427
+ <xsl:value-of select="@section"/>
428
+ <xsl:if test="text() != ''">
429
+ <xsl:text> — </xsl:text>
430
+ <xsl:value-of select="text()"/>
431
+ </xsl:if>
432
+ <xsl:text> </xsl:text>
433
+ <fo:inline keep-together.within-line="always">
434
+ <fo:leader leader-pattern="dots"/>
435
+ <fo:page-number-citation ref-id="{@id}"/>
436
+ </fo:inline>
437
+ </fo:basic-link>
438
+ </fo:block>
439
+ </xsl:for-each>
440
+ </xsl:if>
441
+
442
+ </fo:block-container>
443
+
444
+
445
+ <!-- Abstract, Keywords, Preface, Submitting Organizations, Submitters -->
446
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:abstract" mode="abstract"/>
447
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1]">
448
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + 1"/>
449
+ </xsl:apply-templates>
450
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:foreword" mode="preface">
451
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + count (/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1])+ 1"/>
452
+ </xsl:apply-templates>
453
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:introduction" mode="introduction"/>
454
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name">
455
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + count (/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1])+ count(/ogc:ogc-standard/ogc:preface/ogc:foreword) + 1"/>
456
+ </xsl:apply-templates>
457
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:preface/ogc:submitters">
458
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:preface/ogc:abstract) + count (/ogc:ogc-standard/ogc:bibdata/ogc:keyword[1])+ count(/ogc:ogc-standard/ogc:preface/ogc:foreword) + count(/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author'][1]/ogc:organization/ogc:name) + 1"/>
459
+ </xsl:apply-templates>
460
+
461
+
462
+ </fo:flow>
463
+ </fo:page-sequence>
464
+
465
+
466
+ <!-- Document Pages -->
467
+ <fo:page-sequence master-reference="document" initial-page-number="1" format="1" force-page-count="no-force">
468
+ <fo:static-content flow-name="xsl-footnote-separator">
469
+ <fo:block>
470
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
471
+ </fo:block>
472
+ </fo:static-content>
473
+ <xsl:call-template name="insertHeaderFooter">
474
+ <xsl:with-param name="pagenum-font-weight">bold</xsl:with-param>
475
+ </xsl:call-template>
476
+ <fo:flow flow-name="xsl-region-body">
477
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt">
478
+ <xsl:value-of select="$doctitle"/>
479
+ </fo:block>
480
+
481
+ <fo:block line-height="125%">
482
+
483
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']">
484
+ <xsl:with-param name="sectionNum" select="'1'"/>
485
+ </xsl:apply-templates>
486
+
487
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']">
488
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + 1"/>
489
+ </xsl:apply-templates>
490
+
491
+ <!-- Normative references -->
492
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']">
493
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + 1"/>
494
+ </xsl:apply-templates>
495
+
496
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/ogc:terms"> <!-- Terms and definitions -->
497
+ <xsl:with-param name="sectionNum" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + count(/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']) + 1"/>
498
+ </xsl:apply-templates>
499
+
500
+
501
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:sections/*[local-name() != 'terms' and not(@id='_scope') and not(@id='conformance') and not(@id='_conformance')]">
502
+ <xsl:with-param name="sectionNumSkew" select="count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='_scope']) + count(/ogc:ogc-standard/ogc:sections/ogc:clause[@id='conformance' or @id='_conformance']) + count(/ogc:ogc-standard/ogc:bibliography/ogc:references[@id = '_normative_references' or @id = '_references']) + count(/ogc:ogc-standard/ogc:sections/ogc:terms)"/>
503
+ </xsl:apply-templates>
504
+
505
+
506
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:annex"/>
507
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibliography/ogc:references[@id != '_normative_references' and @id != '_references']"/> <!-- [position() &gt; 1] -->
508
+
509
+ </fo:block>
510
+ </fo:flow>
511
+ </fo:page-sequence>
512
+
513
+ <!-- End Document Pages -->
514
+
515
+ </fo:root>
516
+ </xsl:template>
517
+
518
+ <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
519
+ <xsl:template match="node()">
520
+ <xsl:param name="sectionNum"/>
521
+ <xsl:param name="sectionNumSkew"/>
522
+ <xsl:apply-templates>
523
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
524
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
525
+ </xsl:apply-templates>
526
+ </xsl:template>
527
+
528
+ <!-- ============================= -->
529
+ <!-- CONTENTS -->
530
+ <!-- ============================= -->
531
+ <xsl:template match="node()" mode="contents">
532
+ <xsl:param name="sectionNum"/>
533
+ <xsl:param name="sectionNumSkew"/>
534
+ <xsl:apply-templates mode="contents">
535
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
536
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
537
+ </xsl:apply-templates>
538
+ </xsl:template>
539
+
540
+
541
+ <!-- calculate main section number (1,2,3) and pass it deep into templates -->
542
+ <!-- it's necessary, because there is itu:bibliography/itu:references from other section, but numbering should be sequental -->
543
+ <xsl:template match="ogc:ogc-standard/ogc:sections/*" mode="contents">
544
+ <xsl:param name="sectionNum"/>
545
+ <xsl:param name="sectionNumSkew" select="0"/>
546
+ <xsl:variable name="sectionNum_">
547
+ <xsl:choose>
548
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
549
+ <xsl:when test="$sectionNumSkew != 0">
550
+ <xsl:variable name="number"><xsl:number count="ogc:sections/ogc:clause[not(@id='_scope') and not(@id='conformance') and not(@id='_conformance')]"/></xsl:variable> <!-- * ogc:sections/ogc:clause | ogc:sections/ogc:terms -->
551
+ <xsl:value-of select="$number + $sectionNumSkew"/>
552
+ </xsl:when>
553
+ <xsl:otherwise>
554
+ <xsl:number count="*"/>
555
+ </xsl:otherwise>
556
+ </xsl:choose>
557
+ </xsl:variable>
558
+ <xsl:apply-templates mode="contents">
559
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
560
+ </xsl:apply-templates>
561
+ </xsl:template>
562
+ <xsl:template match="ogc:ogc-standard/ogc:sections/ogc:terms" mode="contents">
563
+ <xsl:param name="sectionNum"/>
564
+ <xsl:param name="sectionNumSkew" select="0"/>
565
+ <xsl:variable name="sectionNum_">
566
+ <xsl:choose>
567
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
568
+ <xsl:when test="$sectionNumSkew != 0">
569
+ <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!-- ogc:sections/ogc:clause | ogc:sections/ogc:terms -->
570
+ <xsl:value-of select="$number + $sectionNumSkew"/>
571
+ </xsl:when>
572
+ <xsl:otherwise>
573
+ <xsl:number count="*"/>
574
+ </xsl:otherwise>
575
+ </xsl:choose>
576
+ </xsl:variable>
577
+ <xsl:apply-templates mode="contents">
578
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
579
+ </xsl:apply-templates>
580
+ </xsl:template>
581
+
582
+
583
+ <!-- Any node with title element - clause, definition, annex,... -->
584
+ <xsl:template match="ogc:title | ogc:preferred" mode="contents">
585
+ <xsl:param name="sectionNum"/>
586
+ <xsl:variable name="id">
587
+ <xsl:call-template name="getId"/>
588
+ </xsl:variable>
589
+
590
+ <xsl:variable name="level">
591
+ <xsl:call-template name="getLevel"/>
592
+ </xsl:variable>
593
+
594
+ <xsl:variable name="section">
595
+ <xsl:call-template name="getSection">
596
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
597
+ </xsl:call-template>
598
+ </xsl:variable>
599
+
600
+ <xsl:variable name="display">
601
+ <xsl:choose>
602
+ <xsl:when test="ancestor::ogc:bibitem">false</xsl:when>
603
+ <xsl:when test="ancestor::ogc:term">false</xsl:when>
604
+ <xsl:when test="ancestor::ogc:annex and $level &gt;= 3">false</xsl:when>
605
+ <xsl:when test="$level &lt;= 3">true</xsl:when>
606
+ <xsl:otherwise>false</xsl:otherwise>
607
+ </xsl:choose>
608
+ </xsl:variable>
609
+
610
+ <xsl:variable name="display-section">
611
+ <xsl:choose>
612
+ <xsl:when test="ancestor::ogc:annex and $level &gt;= 2">true</xsl:when>
613
+ <xsl:when test="ancestor::ogc:annex">false</xsl:when>
614
+ <xsl:when test="$section = '0'">false</xsl:when>
615
+ <xsl:otherwise>true</xsl:otherwise>
616
+ </xsl:choose>
617
+ </xsl:variable>
618
+
619
+ <xsl:variable name="type">
620
+ <xsl:value-of select="local-name(..)"/>
621
+ </xsl:variable>
622
+
623
+ <xsl:variable name="root">
624
+ <xsl:choose>
625
+ <xsl:when test="ancestor::ogc:annex">annex</xsl:when>
626
+ <xsl:when test="ancestor::ogc:clause">clause</xsl:when>
627
+ <xsl:when test="ancestor::ogc:terms">terms</xsl:when>
628
+ </xsl:choose>
629
+ </xsl:variable>
630
+
631
+ <item id="{$id}" level="{$level}" section="{$section}" display-section="{$display-section}" display="{$display}" type="{$type}" root="{$root}">
632
+ <xsl:attribute name="addon">
633
+ <xsl:if test="local-name(..) = 'annex'"><xsl:value-of select="../@obligation"/></xsl:if>
634
+ </xsl:attribute>
635
+ <xsl:apply-templates/>
636
+ </item>
637
+
638
+ <xsl:apply-templates mode="contents">
639
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
640
+ </xsl:apply-templates>
641
+
642
+ </xsl:template>
643
+
644
+ <xsl:template match="ogc:ogc-standard/ogc:preface/*" mode="contents">
645
+ <xsl:param name="sectionNum" select="'1'"/>
646
+ <xsl:variable name="section">
647
+ <xsl:number format="i" value="$sectionNum"/>
648
+ </xsl:variable>
649
+ <xsl:variable name="id">
650
+ <xsl:choose>
651
+ <xsl:when test="@id">
652
+ <xsl:value-of select="@id"/>
653
+ </xsl:when>
654
+ <xsl:otherwise>
655
+ <xsl:value-of select="local-name()"/>
656
+ </xsl:otherwise>
657
+ </xsl:choose>
658
+ </xsl:variable>
659
+ <xsl:if test="not(ogc:title)">
660
+ <item id="{$id}" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
661
+ <xsl:if test="local-name() = 'foreword'">
662
+ <xsl:attribute name="display">false</xsl:attribute>
663
+ </xsl:if>
664
+ <xsl:choose>
665
+ <xsl:when test="not(ogc:title)">
666
+ <xsl:variable name="name" select="local-name()"/>
667
+ <xsl:value-of select="translate(substring($name, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($name, 2)"/>
668
+ </xsl:when>
669
+ <xsl:otherwise>
670
+ <xsl:value-of select="ogc:title"/>
671
+ </xsl:otherwise>
672
+ </xsl:choose>
673
+ </item>
674
+ </xsl:if>
675
+ <xsl:apply-templates mode="contents">
676
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
677
+ </xsl:apply-templates>
678
+ </xsl:template>
679
+
680
+ <!-- Keywords -->
681
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:keyword" mode="contents">
682
+ <xsl:param name="sectionNum" select="'1'"/>
683
+ <xsl:variable name="section">
684
+ <xsl:number format="i" value="$sectionNum"/>
685
+ </xsl:variable>
686
+ <item id="keywords" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
687
+ <xsl:text>Keywords</xsl:text>
688
+ </item>
689
+ </xsl:template>
690
+ <!-- Submitting Organizations -->
691
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:organization/ogc:name" mode="contents">
692
+ <xsl:param name="sectionNum" select="'1'"/>
693
+ <xsl:variable name="section">
694
+ <xsl:number format="i" value="$sectionNum"/>
695
+ </xsl:variable>
696
+ <item id="submitting_orgs" level="1" section="{$section}" display-section="true" display="true" type="abstract" root="preface">
697
+ <xsl:text>Submitting Organizations</xsl:text>
698
+ </item>
699
+ </xsl:template>
700
+
701
+ <xsl:template match="ogc:figure" mode="contents">
702
+ <xsl:param name="sectionNum"/>
703
+ <item level="" id="{@id}" type="figure">
704
+ <xsl:attribute name="section">
705
+ <xsl:text>Figure </xsl:text>
706
+ <xsl:choose>
707
+ <xsl:when test="ancestor::ogc:annex">
708
+ <xsl:choose>
709
+ <xsl:when test="count(//ogc:annex) = 1">
710
+ <xsl:value-of select="/ogc:nist-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/><xsl:number format="-1" level="any" count="ogc:annex//ogc:figure"/>
711
+ </xsl:when>
712
+ <xsl:otherwise>
713
+ <xsl:number format="A.1-1" level="multiple" count="ogc:annex | ogc:figure"/>
714
+ </xsl:otherwise>
715
+ </xsl:choose>
716
+ </xsl:when>
717
+ <xsl:when test="ancestor::ogc:figure">
718
+ <xsl:for-each select="parent::*[1]">
719
+ <xsl:number format="1" level="any" count="ogc:figure[not(parent::ogc:figure)]"/>
720
+ </xsl:for-each>
721
+ <xsl:number format="-a" count="ogc:figure"/>
722
+ </xsl:when>
723
+ <xsl:otherwise>
724
+ <xsl:number format="1" level="any" count="ogc:figure[not(parent::ogc:figure)] | ogc:sourcecode[not(@unnumbered = 'true') and not(ancestor::ogc:example)]"/>
725
+ <!-- <xsl:number format="1.1-1" level="multiple" count="ogc:annex | ogc:figure"/> -->
726
+ </xsl:otherwise>
727
+ </xsl:choose>
728
+ </xsl:attribute>
729
+ <xsl:value-of select="ogc:name"/>
730
+ </item>
731
+ </xsl:template>
732
+
733
+
734
+
735
+ <xsl:template match="ogc:table[not(@unnumbered='true')]" mode="contents">
736
+ <xsl:param name="sectionNum"/>
737
+ <xsl:variable name="annex-id" select="ancestor::ogc:annex/@id"/>
738
+ <item level="" id="{@id}" display="false" type="table">
739
+ <xsl:attribute name="section">
740
+ <xsl:text>Table </xsl:text>
741
+ <xsl:choose>
742
+ <xsl:when test="ancestor::*[local-name()='executivesummary']">
743
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered='true')]"/>
744
+ </xsl:when>
745
+ <xsl:when test="ancestor::*[local-name()='annex']">
746
+ <xsl:number format="A-" count="ogc:annex"/>
747
+ <xsl:number format="1" level="any" count="ogc:table[ancestor::ogc:annex[@id = $annex-id]][not(@unnumbered='true')]"/>
748
+ </xsl:when>
749
+ <xsl:otherwise>
750
+ <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table'][not(@unnumbered='true')] | *[local-name()='preface']//*[local-name()='table'][not(@unnumbered='true')]"/>
751
+ </xsl:otherwise>
752
+ </xsl:choose>
753
+ </xsl:attribute>
754
+ <xsl:value-of select="ogc:name/text()"/>
755
+ </item>
756
+ </xsl:template>
757
+
758
+
759
+
760
+ <xsl:template match="ogc:formula" mode="contents">
761
+ <item level="" id="{@id}" display="false">
762
+ <xsl:attribute name="section">
763
+ <xsl:text>Formula (</xsl:text><xsl:number format="A.1" level="multiple" count="ogc:annex | ogc:formula"/><xsl:text>)</xsl:text>
764
+ </xsl:attribute>
765
+ </item>
766
+ </xsl:template>
767
+
768
+ <xsl:template match="ogc:fn" mode="contents"/>
769
+ <!-- ============================= -->
770
+ <!-- ============================= -->
771
+
772
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:uri[not(@type)]">
773
+ <fo:block margin-bottom="12pt">
774
+ <xsl:text>URL for this OGC® document: </xsl:text>
775
+ <xsl:value-of select="."/><xsl:text> </xsl:text>
776
+ </fo:block>
777
+ </xsl:template>
778
+
779
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
780
+ <fo:block margin-bottom="12pt">
781
+ <xsl:text>Version: </xsl:text>
782
+ <xsl:value-of select="."/><xsl:text> </xsl:text>
783
+ </fo:block>
784
+ </xsl:template>
785
+
786
+ <xsl:template match="ogc:license-statement//ogc:title">
787
+ <fo:block text-align="center" font-weight="bold" margin-top="4pt">
788
+ <xsl:apply-templates/>
789
+ </fo:block>
790
+ </xsl:template>
791
+
792
+ <xsl:template match="ogc:license-statement//ogc:p">
793
+ <fo:block font-size="8pt" margin-top="14pt" line-height="115%">
794
+ <xsl:if test="following-sibling::ogc:p">
795
+ <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
796
+ </xsl:if>
797
+ <xsl:apply-templates/>
798
+ </fo:block>
799
+ </xsl:template>
800
+
801
+ <xsl:template match="ogc:feedback-statement">
802
+ <fo:block margin-top="12pt" margin-bottom="12pt">
803
+ <xsl:apply-templates select="ogc:clause[1]"/>
804
+ </fo:block>
805
+ </xsl:template>
806
+
807
+ <xsl:template match="ogc:copyright-statement//ogc:title">
808
+ <fo:block font-weight="bold" text-align="center">
809
+ <xsl:apply-templates/>
810
+ </fo:block>
811
+ </xsl:template>
812
+ <xsl:template match="ogc:copyright-statement//ogc:p">
813
+ <fo:block margin-bottom="12pt">
814
+ <xsl:if test="not(following-sibling::p)">
815
+ <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
816
+ </xsl:if>
817
+ <xsl:attribute name="text-align">
818
+ <xsl:choose>
819
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
820
+ <xsl:otherwise>left</xsl:otherwise>
821
+ </xsl:choose>
822
+ </xsl:attribute>
823
+ <xsl:apply-templates/>
824
+ </fo:block>
825
+ </xsl:template>
826
+
827
+ <xsl:template match="ogc:legal-statement">
828
+ <fo:block-container border="0.5pt solid black" margin-bottom="12pt" margin-left="-2mm" margin-right="-2mm">
829
+ <fo:block-container margin-left="0mm" margin-right="0mm">
830
+ <fo:block margin-left="2mm" margin-right="2mm">
831
+ <xsl:apply-templates/>
832
+ </fo:block>
833
+ </fo:block-container>
834
+ </fo:block-container>
835
+ </xsl:template>
836
+
837
+
838
+ <xsl:template match="ogc:legal-statement//ogc:title">
839
+ <fo:block text-align="center" font-weight="bold" padding-top="2mm" margin-bottom="6pt">
840
+ <xsl:apply-templates/>
841
+ </fo:block>
842
+ </xsl:template>
843
+
844
+ <xsl:template match="ogc:legal-statement//ogc:p">
845
+ <fo:block margin-bottom="6pt">
846
+ <xsl:if test="not(following-sibling::ogc:p)">
847
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
848
+ </xsl:if>
849
+ <xsl:attribute name="text-align">
850
+ <xsl:choose>
851
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
852
+ <xsl:otherwise>left</xsl:otherwise>
853
+ </xsl:choose>
854
+ </xsl:attribute>
855
+ <xsl:apply-templates/>
856
+ </fo:block>
857
+ </xsl:template>
858
+
859
+
860
+ <!-- Introduction -->
861
+ <xsl:template match="ogc:ogc-standard/ogc:preface/ogc:introduction" mode="introduction">
862
+ <fo:block break-after="page"/>
863
+ <xsl:apply-templates select="current()"/>
864
+ </xsl:template>
865
+ <!-- Abstract -->
866
+ <xsl:template match="ogc:ogc-standard/ogc:preface/ogc:abstract" mode="abstract">
867
+ <fo:block break-after="page"/>
868
+ <xsl:apply-templates select="current()"/>
869
+ </xsl:template>
870
+ <!-- Preface -->
871
+ <xsl:template match="ogc:ogc-standard/ogc:preface/ogc:foreword" mode="preface">
872
+ <xsl:param name="sectionNum"/>
873
+ <fo:block break-after="page"/>
874
+ <xsl:apply-templates select="current()">
875
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
876
+ </xsl:apply-templates>
877
+ </xsl:template>
878
+ <!-- Abstract, Preface -->
879
+ <xsl:template match="ogc:ogc-standard/ogc:preface/*">
880
+ <xsl:param name="sectionNum" select="'1'"/>
881
+ <xsl:if test="not(ogc:title)">
882
+ <xsl:variable name="id">
883
+ <xsl:choose>
884
+ <xsl:when test="@id">
885
+ <xsl:value-of select="@id"/>
886
+ </xsl:when>
887
+ <xsl:otherwise>
888
+ <xsl:value-of select="local-name()"/>
889
+ </xsl:otherwise>
890
+ </xsl:choose>
891
+ </xsl:variable>
892
+ <fo:block id="{$id}" font-size="13pt" font-weight="bold" margin-bottom="12pt" color="rgb(14, 26, 133)">
893
+ <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
894
+ <xsl:variable name="name" select="local-name()"/>
895
+ <xsl:value-of select="translate(substring($name, 1, 1), $lower, $upper)"/><xsl:value-of select="substring($name, 2)"/>
896
+ </fo:block>
897
+ </xsl:if>
898
+ <xsl:apply-templates/>
899
+ </xsl:template>
900
+ <!-- Keywords -->
901
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
902
+ <xsl:param name="sectionNum" select="'1'"/>
903
+ <fo:block id="keywords" font-size="13pt" font-weight="bold" margin-top="13.5pt" margin-bottom="12pt" color="rgb(14, 26, 133)">
904
+ <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="2mm"> </fo:inline>
905
+ <xsl:text>Keywords</xsl:text>
906
+ </fo:block>
907
+ <fo:block margin-bottom="12pt">The following are keywords to be used by search engines and document catalogues.</fo:block>
908
+ <fo:block margin-bottom="12pt">
909
+ <xsl:call-template name="insertKeywords">
910
+ <xsl:with-param name="sorting">no</xsl:with-param>
911
+ <xsl:with-param name="charAtEnd"/>
912
+ </xsl:call-template>
913
+ <!-- <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:keyword">
914
+ <xsl:value-of select="."/>
915
+ <xsl:if test="position() != last()">, </xsl:if>
916
+ </xsl:for-each> -->
917
+ </fo:block>
918
+ </xsl:template>
919
+ <!-- Submitting Organizations -->
920
+ <xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:organization/ogc:name">
921
+ <xsl:param name="sectionNum" select="'1'"/>
922
+ <fo:block id="submitting_orgs" font-size="13pt" font-weight="bold" color="rgb(14, 26, 133)" margin-top="13.5pt" margin-bottom="12pt">
923
+ <xsl:number format="i." value="$sectionNum"/><fo:inline padding-right="3mm"> </fo:inline>
924
+ <xsl:text>Submitting Organizations</xsl:text>
925
+ </fo:block>
926
+ <fo:block margin-bottom="12pt">The following organizations submitted this Document to the Open Geospatial Consortium (OGC):</fo:block>
927
+ <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt" line-height="115%">
928
+ <xsl:for-each select="/ogc:ogc-standard/ogc:bibdata/ogc:contributor[ogc:role/@type='author']/ogc:organization/ogc:name">
929
+ <fo:list-item>
930
+ <fo:list-item-label end-indent="label-end()">
931
+ <fo:block>—</fo:block>
932
+ </fo:list-item-label>
933
+ <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
934
+ <fo:block>
935
+ <xsl:apply-templates/>
936
+ </fo:block>
937
+ </fo:list-item-body>
938
+ </fo:list-item>
939
+ </xsl:for-each>
940
+ </fo:list-block>
941
+ </xsl:template>
942
+
943
+
944
+ <!-- clause, terms, clause, ...-->
945
+ <xsl:template match="ogc:ogc-standard/ogc:sections/*">
946
+ <xsl:param name="sectionNum"/>
947
+ <xsl:param name="sectionNumSkew" select="0"/>
948
+ <fo:block>
949
+ <xsl:variable name="pos"><xsl:number count="ogc:sections/ogc:clause[not(@id='_scope') and not(@id='conformance') and not(@id='_conformance')]"/></xsl:variable> <!-- | ogc:sections/ogc:terms -->
950
+ <xsl:if test="$pos &gt;= 2">
951
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
952
+ </xsl:if>
953
+ <xsl:variable name="sectionNum_">
954
+ <xsl:choose>
955
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
956
+ <xsl:when test="$sectionNumSkew != 0">
957
+ <xsl:variable name="number"><xsl:number count="ogc:sections/ogc:clause[not(@id='_scope') and not(@id='conformance') and not(@id='_conformance')]"/></xsl:variable> <!-- | ogc:sections/ogc:terms -->
958
+ <xsl:value-of select="$number + $sectionNumSkew"/>
959
+ </xsl:when>
960
+ <xsl:otherwise>
961
+ <xsl:number count="*"/>
962
+ </xsl:otherwise>
963
+ </xsl:choose>
964
+ </xsl:variable>
965
+ <xsl:if test="not(ogc:title)">
966
+ <fo:block margin-top="3pt" margin-bottom="12pt">
967
+ <xsl:value-of select="$sectionNum_"/><xsl:number format=".1 " level="multiple" count="ogc:clause[not(@id='_scope') and not(@id='conformance') and not(@id='_conformance')]"/>
968
+ </fo:block>
969
+ </xsl:if>
970
+ <xsl:apply-templates>
971
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
972
+ </xsl:apply-templates>
973
+ </fo:block>
974
+ </xsl:template>
975
+
976
+
977
+
978
+ <xsl:template match="ogc:clause//ogc:clause[not(ogc:title)]">
979
+ <xsl:param name="sectionNum"/>
980
+ <xsl:variable name="section">
981
+ <xsl:call-template name="getSection">
982
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
983
+ </xsl:call-template>
984
+ </xsl:variable>
985
+
986
+ <fo:block margin-top="3pt">
987
+ <fo:inline font-weight="bold" padding-right="3mm">
988
+ <xsl:value-of select="$section"/>
989
+ </fo:inline>
990
+ <xsl:apply-templates>
991
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
992
+ <xsl:with-param name="inline" select="'true'"/>
993
+ </xsl:apply-templates>
994
+ </fo:block>
995
+ </xsl:template>
996
+
997
+
998
+ <xsl:template match="ogc:title">
999
+ <xsl:param name="sectionNum"/>
1000
+
1001
+ <xsl:variable name="parent-name" select="local-name(..)"/>
1002
+ <xsl:variable name="references_num_current">
1003
+ <xsl:number level="any" count="ogc:references"/>
1004
+ </xsl:variable>
1005
+
1006
+ <xsl:variable name="id">
1007
+ <xsl:call-template name="getId"/>
1008
+ </xsl:variable>
1009
+
1010
+ <xsl:variable name="level">
1011
+ <xsl:call-template name="getLevel"/>
1012
+ </xsl:variable>
1013
+
1014
+ <xsl:variable name="section">
1015
+ <xsl:call-template name="getSection">
1016
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1017
+ </xsl:call-template>
1018
+ </xsl:variable>
1019
+
1020
+ <xsl:variable name="font-size">
1021
+ <xsl:choose>
1022
+ <xsl:when test="ancestor::ogc:preface and $level &gt;= 2">12pt</xsl:when>
1023
+ <xsl:when test="ancestor::ogc:preface">13pt</xsl:when>
1024
+ <xsl:when test="$level = 1">13pt</xsl:when>
1025
+ <xsl:when test="$level = 2 and ancestor::ogc:terms">11pt</xsl:when>
1026
+ <xsl:when test="$level = 2">12pt</xsl:when>
1027
+ <xsl:when test="$level &gt;= 3">11pt</xsl:when>
1028
+ <xsl:otherwise>16pt</xsl:otherwise>
1029
+ </xsl:choose>
1030
+ </xsl:variable>
1031
+
1032
+ <xsl:variable name="element-name">
1033
+ <xsl:choose>
1034
+ <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
1035
+ <xsl:otherwise>fo:block</xsl:otherwise>
1036
+ </xsl:choose>
1037
+ </xsl:variable>
1038
+
1039
+ <xsl:variable name="color" select="'rgb(14, 26, 133)'"/>
1040
+
1041
+ <xsl:choose>
1042
+ <xsl:when test="$parent-name = 'annex'">
1043
+ <fo:block id="{$id}" font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always" color="{$color}">
1044
+ <xsl:value-of select="$section"/>
1045
+ <xsl:if test=" ../@obligation">
1046
+ <xsl:value-of select="$linebreak"/>
1047
+ <fo:inline font-weight="normal">(<xsl:value-of select="../@obligation"/>)</fo:inline>
1048
+ </xsl:if>
1049
+ <xsl:value-of select="$linebreak"/>
1050
+ <xsl:apply-templates/>
1051
+ </fo:block>
1052
+ </xsl:when>
1053
+ <xsl:otherwise>
1054
+ <xsl:element name="{$element-name}">
1055
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
1056
+ <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
1057
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1058
+ <xsl:attribute name="space-before">13.5pt</xsl:attribute>
1059
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1060
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1061
+ <xsl:attribute name="color"><xsl:value-of select="$color"/></xsl:attribute>
1062
+ <xsl:if test="$section != ''">
1063
+ <xsl:if test="$section != '0'">
1064
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1065
+ <xsl:choose>
1066
+ <xsl:when test="$level &gt;= 5"/>
1067
+ <xsl:when test="$level &gt;= 4">
1068
+ <fo:inline padding-right="4mm"> </fo:inline>
1069
+ </xsl:when>
1070
+ <xsl:when test="$level &gt;= 3 and ancestor::ogc:terms">
1071
+ <fo:inline padding-right="2mm"> </fo:inline>
1072
+ </xsl:when>
1073
+ <xsl:when test="$level &gt;= 2">
1074
+ <fo:inline padding-right="3mm"> </fo:inline>
1075
+ </xsl:when>
1076
+ <xsl:when test="$level = 1">
1077
+ <fo:inline padding-right="3mm"> </fo:inline>
1078
+ </xsl:when>
1079
+ <xsl:otherwise>
1080
+ <fo:inline padding-right="1mm"> </fo:inline>
1081
+ </xsl:otherwise>
1082
+ </xsl:choose>
1083
+ </xsl:if>
1084
+ </xsl:if>
1085
+ <xsl:apply-templates/>
1086
+ </xsl:element>
1087
+ </xsl:otherwise>
1088
+ </xsl:choose>
1089
+
1090
+ </xsl:template>
1091
+
1092
+
1093
+ <xsl:template match="ogc:p">
1094
+ <xsl:param name="inline" select="'false'"/>
1095
+ <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
1096
+ <xsl:variable name="element-name">
1097
+ <xsl:choose>
1098
+ <xsl:when test="$inline = 'true'">fo:inline</xsl:when>
1099
+ <xsl:when test="../@inline-header = 'true' and $previous-element = 'title'">fo:inline</xsl:when> <!-- first paragraph after inline title -->
1100
+ <xsl:when test="local-name(..) = 'admonition'">fo:inline</xsl:when>
1101
+ <xsl:otherwise>fo:block</xsl:otherwise>
1102
+ </xsl:choose>
1103
+ </xsl:variable>
1104
+ <xsl:element name="{$element-name}">
1105
+ <xsl:attribute name="id">
1106
+ <xsl:value-of select="@id"/>
1107
+ </xsl:attribute>
1108
+ <xsl:attribute name="text-align">
1109
+ <xsl:choose>
1110
+ <!-- <xsl:when test="ancestor::ogc:preface">justify</xsl:when> -->
1111
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1112
+ <xsl:otherwise>left</xsl:otherwise><!-- justify -->
1113
+ </xsl:choose>
1114
+ </xsl:attribute>
1115
+ <xsl:attribute name="space-after">
1116
+ <xsl:choose>
1117
+ <xsl:when test="ancestor::ogc:li">0pt</xsl:when>
1118
+ <xsl:otherwise>12pt</xsl:otherwise>
1119
+ </xsl:choose>
1120
+ </xsl:attribute>
1121
+ <xsl:attribute name="line-height">115%</xsl:attribute>
1122
+ <xsl:apply-templates/>
1123
+ </xsl:element>
1124
+ <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
1125
+ <fo:block margin-bottom="12pt">
1126
+ <xsl:if test="ancestor::ogc:annex">
1127
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
1128
+ </xsl:if>
1129
+ <xsl:value-of select="$linebreak"/>
1130
+ </fo:block>
1131
+ </xsl:if>
1132
+ <xsl:if test="$inline = 'true'">
1133
+ <fo:block> </fo:block>
1134
+ </xsl:if>
1135
+ </xsl:template>
1136
+
1137
+ <!--
1138
+ <fn reference="1">
1139
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
1140
+ </fn>
1141
+ -->
1142
+ <xsl:template match="ogc:title/ogc:fn | ogc:p/ogc:fn[not(ancestor::ogc:table)]" priority="2">
1143
+ <fo:footnote keep-with-previous.within-line="always">
1144
+ <xsl:variable name="number" select="@reference"/>
1145
+
1146
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
1147
+ <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
1148
+ <xsl:value-of select="$number"/><!-- + count(//ogc:bibitem/ogc:note) -->
1149
+ </fo:basic-link>
1150
+ </fo:inline>
1151
+ <fo:footnote-body>
1152
+ <fo:block font-size="10pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" color="black" text-align="justify">
1153
+ <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
1154
+ <xsl:value-of select="$number "/><!-- + count(//ogc:bibitem/ogc:note) -->
1155
+ </fo:inline>
1156
+ <xsl:for-each select="ogc:p">
1157
+ <xsl:apply-templates/>
1158
+ </xsl:for-each>
1159
+ </fo:block>
1160
+ </fo:footnote-body>
1161
+ </fo:footnote>
1162
+ </xsl:template>
1163
+
1164
+ <xsl:template match="ogc:fn/ogc:p">
1165
+ <fo:block>
1166
+ <xsl:apply-templates/>
1167
+ </fo:block>
1168
+ </xsl:template>
1169
+
1170
+ <xsl:template match="ogc:review">
1171
+ <!-- comment 2019-11-29 -->
1172
+ <!-- <fo:block font-weight="bold">Review:</fo:block>
1173
+ <xsl:apply-templates /> -->
1174
+ </xsl:template>
1175
+
1176
+ <xsl:template match="text()">
1177
+ <xsl:value-of select="."/>
1178
+ </xsl:template>
1179
+
1180
+
1181
+ <xsl:template match="ogc:image"> <!-- only for without outer figure -->
1182
+ <fo:block margin-top="12pt" margin-bottom="6pt">
1183
+ <fo:external-graphic src="{@src}" width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- content-width="75%" -->
1184
+ </fo:block>
1185
+ </xsl:template>
1186
+
1187
+ <xsl:template match="ogc:figure">
1188
+ <xsl:variable name="title">
1189
+ <xsl:text>Figure </xsl:text>
1190
+ </xsl:variable>
1191
+
1192
+ <fo:block-container id="{@id}">
1193
+ <fo:block>
1194
+ <xsl:apply-templates/>
1195
+ </fo:block>
1196
+ <xsl:call-template name="fn_display_figure"/>
1197
+ <xsl:for-each select="ogc:note//ogc:p">
1198
+ <xsl:call-template name="note"/>
1199
+ </xsl:for-each>
1200
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="6pt" keep-with-previous="always">
1201
+
1202
+ <xsl:choose>
1203
+ <xsl:when test="ancestor::ogc:annex">
1204
+ <xsl:choose>
1205
+ <xsl:when test="local-name(..) = 'figure'">
1206
+ <xsl:number format="a) "/>
1207
+ </xsl:when>
1208
+ <xsl:otherwise>
1209
+ <xsl:value-of select="$title"/><xsl:number format="A.1-1" level="multiple" count="ogc:annex | ogc:figure"/>
1210
+ </xsl:otherwise>
1211
+ </xsl:choose>
1212
+
1213
+ </xsl:when>
1214
+ <xsl:otherwise>
1215
+ <xsl:value-of select="$title"/><xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1216
+ </xsl:otherwise>
1217
+ </xsl:choose>
1218
+ <xsl:if test="ogc:name">
1219
+ <xsl:if test="not(local-name(..) = 'figure')">
1220
+ <xsl:text> — </xsl:text>
1221
+ </xsl:if>
1222
+ <xsl:value-of select="ogc:name"/>
1223
+ </xsl:if>
1224
+ </fo:block>
1225
+ </fo:block-container>
1226
+ </xsl:template>
1227
+
1228
+ <xsl:template match="ogc:figure/ogc:name"/>
1229
+ <xsl:template match="ogc:figure/ogc:fn"/>
1230
+ <xsl:template match="ogc:figure/ogc:note"/>
1231
+
1232
+
1233
+ <xsl:template match="ogc:figure/ogc:image">
1234
+ <fo:block text-align="center">
1235
+ <fo:external-graphic src="{@src}" width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- content-width="75%" -->
1236
+ </fo:block>
1237
+ </xsl:template>
1238
+
1239
+
1240
+ <xsl:template match="ogc:bibitem">
1241
+ <fo:block id="{@id}" margin-bottom="12pt" start-indent="12mm" text-indent="-12mm" line-height="115%">
1242
+ <xsl:if test=".//ogc:fn">
1243
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
1244
+ </xsl:if>
1245
+ <xsl:choose>
1246
+ <xsl:when test="ogc:formattedref">
1247
+ <xsl:apply-templates select="ogc:formattedref"/>
1248
+ </xsl:when>
1249
+ <xsl:otherwise>
1250
+ <xsl:for-each select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1251
+ <xsl:apply-templates/>
1252
+ <xsl:if test="position() != last()">, </xsl:if>
1253
+ <xsl:if test="position() = last()">: </xsl:if>
1254
+ </xsl:for-each>
1255
+ <!-- ogc:docidentifier -->
1256
+ <xsl:if test="ogc:docidentifier">
1257
+ <xsl:value-of select="ogc:docidentifier/@type"/><xsl:text> </xsl:text>
1258
+ <xsl:value-of select="ogc:docidentifier"/>
1259
+ </xsl:if>
1260
+ <xsl:apply-templates select="ogc:note"/>
1261
+ <xsl:if test="ogc:docidentifier">, </xsl:if>
1262
+ <fo:inline font-style="italic">
1263
+ <xsl:choose>
1264
+ <xsl:when test="ogc:title[@type = 'main' and @language = 'en']">
1265
+ <xsl:value-of select="ogc:title[@type = 'main' and @language = 'en']"/><xsl:text>. </xsl:text>
1266
+ </xsl:when>
1267
+ <xsl:otherwise>
1268
+ <xsl:value-of select="ogc:title"/><xsl:text>. </xsl:text>
1269
+ </xsl:otherwise>
1270
+ </xsl:choose>
1271
+ </fo:inline>
1272
+ <xsl:for-each select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1273
+ <xsl:apply-templates/>
1274
+ <xsl:if test="position() != last()">, </xsl:if>
1275
+ </xsl:for-each>
1276
+ <xsl:if test="ogc:date[@type='published']/ogc:on">
1277
+ <xsl:text>(</xsl:text><xsl:value-of select="ogc:date[@type='published']/ogc:on"/><xsl:text>)</xsl:text>
1278
+ </xsl:if>
1279
+ </xsl:otherwise>
1280
+ </xsl:choose>
1281
+ </fo:block>
1282
+ </xsl:template>
1283
+
1284
+
1285
+ <xsl:template match="ogc:bibitem/ogc:note">
1286
+ <fo:footnote>
1287
+ <xsl:variable name="number">
1288
+ <xsl:choose>
1289
+ <xsl:when test="ancestor::ogc:references[preceding-sibling::ogc:references]">
1290
+ <xsl:number level="any" count="ogc:references[preceding-sibling::ogc:references]//ogc:bibitem/ogc:note"/>
1291
+ </xsl:when>
1292
+ <xsl:otherwise>
1293
+ <xsl:number level="any" count="ogc:bibitem/ogc:note"/>
1294
+ </xsl:otherwise>
1295
+ </xsl:choose>
1296
+ </xsl:variable>
1297
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% baseline-shift="35%" -->
1298
+ <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
1299
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1300
+ </fo:basic-link>
1301
+ </fo:inline>
1302
+ <fo:footnote-body>
1303
+ <fo:block font-size="10pt" margin-bottom="12pt" start-indent="0pt">
1304
+ <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
1305
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
1306
+ </fo:inline>
1307
+ <xsl:apply-templates/>
1308
+ </fo:block>
1309
+ </fo:footnote-body>
1310
+ </fo:footnote>
1311
+ </xsl:template>
1312
+
1313
+
1314
+
1315
+ <xsl:template match="ogc:ul | ogc:ol">
1316
+ <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt" line-height="115%">
1317
+ <xsl:if test="ancestor::ogc:ul | ancestor::ogc:ol">
1318
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1319
+ </xsl:if>
1320
+ <xsl:if test="following-sibling::*[1][local-name() = 'ul' or local-name() = 'ol']">
1321
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1322
+ </xsl:if>
1323
+ <xsl:apply-templates/>
1324
+ </fo:list-block>
1325
+ </xsl:template>
1326
+
1327
+ <xsl:template match="ogc:li">
1328
+ <fo:list-item>
1329
+ <fo:list-item-label end-indent="label-end()">
1330
+ <fo:block>
1331
+ <xsl:choose>
1332
+ <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
1333
+ <xsl:otherwise> <!-- for ordered lists -->
1334
+ <xsl:choose>
1335
+ <xsl:when test="../@type = 'arabic'">
1336
+ <xsl:number format="a)"/>
1337
+ </xsl:when>
1338
+ <xsl:when test="../@type = 'alphabet'">
1339
+ <xsl:number format="1)"/>
1340
+ </xsl:when>
1341
+ <xsl:when test="../@type = 'alphabet_upper'">
1342
+ <xsl:number format="A)"/>
1343
+ </xsl:when>
1344
+
1345
+ <xsl:when test="../@type = 'roman'">
1346
+ <xsl:number format="i)"/>
1347
+ </xsl:when>
1348
+ <xsl:otherwise>
1349
+ <xsl:number format="1)"/>
1350
+ </xsl:otherwise>
1351
+ </xsl:choose>
1352
+ </xsl:otherwise>
1353
+ </xsl:choose>
1354
+ </fo:block>
1355
+ </fo:list-item-label>
1356
+ <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1357
+ <xsl:apply-templates/>
1358
+ </fo:list-item-body>
1359
+ </fo:list-item>
1360
+ </xsl:template>
1361
+
1362
+ <xsl:template match="ogc:ul/ogc:note | ogc:ol/ogc:note">
1363
+ <fo:list-item font-size="10pt">
1364
+ <fo:list-item-label><fo:block/></fo:list-item-label>
1365
+ <fo:list-item-body>
1366
+ <xsl:apply-templates/>
1367
+ </fo:list-item-body>
1368
+ </fo:list-item>
1369
+ </xsl:template>
1370
+
1371
+
1372
+ <xsl:template match="ogc:preferred">
1373
+ <xsl:param name="sectionNum"/>
1374
+ <xsl:variable name="section">
1375
+ <xsl:call-template name="getSection">
1376
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1377
+ </xsl:call-template>
1378
+ </xsl:variable>
1379
+ <xsl:variable name="level">
1380
+ <xsl:call-template name="getLevel"/>
1381
+ </xsl:variable>
1382
+ <xsl:variable name="font-size">
1383
+ <xsl:choose>
1384
+ <xsl:when test="$level &gt;= 2">11pt</xsl:when>
1385
+ <xsl:otherwise>12pt</xsl:otherwise>
1386
+ </xsl:choose>
1387
+ </xsl:variable>
1388
+ <fo:block font-size="{$font-size}">
1389
+ <fo:block font-weight="bold" keep-with-next="always">
1390
+ <fo:inline id="{../@id}">
1391
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1392
+ </fo:inline>
1393
+ </fo:block>
1394
+ <fo:block font-weight="bold" keep-with-next="always" line-height="1">
1395
+ <xsl:apply-templates/>
1396
+ </fo:block>
1397
+ </fo:block>
1398
+ </xsl:template>
1399
+
1400
+ <xsl:template match="ogc:admitted">
1401
+ <fo:block font-size="11pt">
1402
+ <xsl:apply-templates/>
1403
+ </fo:block>
1404
+ </xsl:template>
1405
+
1406
+ <xsl:template match="ogc:deprecates">
1407
+ <fo:block>DEPRECATED: <xsl:apply-templates/></fo:block>
1408
+ </xsl:template>
1409
+
1410
+ <xsl:template match="ogc:definition[preceding-sibling::ogc:domain]">
1411
+ <xsl:apply-templates/>
1412
+ </xsl:template>
1413
+ <xsl:template match="ogc:definition[preceding-sibling::ogc:domain]/ogc:p">
1414
+ <fo:inline> <xsl:apply-templates/></fo:inline>
1415
+ <fo:block> </fo:block>
1416
+ </xsl:template>
1417
+
1418
+ <xsl:template match="ogc:definition">
1419
+ <fo:block space-after="6pt">
1420
+ <xsl:apply-templates/>
1421
+ </fo:block>
1422
+ </xsl:template>
1423
+
1424
+ <xsl:template match="ogc:termsource">
1425
+ <fo:block margin-bottom="12pt" keep-with-previous="always">
1426
+ <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1427
+ <fo:basic-link internal-destination="{ogc:origin/@bibitemid}" fox:alt-text="{ogc:origin/@citeas}">
1428
+ <xsl:text>[SOURCE: </xsl:text>
1429
+ <fo:inline color="blue" text-decoration="underline">
1430
+ <xsl:value-of select="ogc:origin/@citeas"/>
1431
+
1432
+ <xsl:apply-templates select="ogc:origin/ogc:localityStack"/>
1433
+
1434
+ </fo:inline>
1435
+ </fo:basic-link>
1436
+ <xsl:apply-templates select="ogc:modification"/>
1437
+ <xsl:text>]</xsl:text>
1438
+ </fo:block>
1439
+ </xsl:template>
1440
+
1441
+ <xsl:template match="ogc:modification">
1442
+ <xsl:text>, modified — </xsl:text>
1443
+ <xsl:apply-templates/>
1444
+ </xsl:template>
1445
+ <xsl:template match="ogc:modification/ogc:p">
1446
+ <fo:inline><xsl:apply-templates/></fo:inline>
1447
+ </xsl:template>
1448
+
1449
+ <xsl:template match="ogc:termnote">
1450
+ <fo:block font-size="10pt" margin-bottom="12pt">
1451
+ <xsl:text>Note </xsl:text>
1452
+ <xsl:number/>
1453
+ <xsl:text> to entry: </xsl:text>
1454
+ <xsl:apply-templates/>
1455
+ </fo:block>
1456
+ </xsl:template>
1457
+
1458
+ <xsl:template match="ogc:termnote/ogc:p">
1459
+ <fo:inline><xsl:apply-templates/></fo:inline>
1460
+ </xsl:template>
1461
+
1462
+ <xsl:template match="ogc:domain">
1463
+ <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline>
1464
+ </xsl:template>
1465
+
1466
+
1467
+ <xsl:template match="ogc:termexample">
1468
+ <fo:block font-size="10pt" margin-bottom="12pt">
1469
+ <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
1470
+ <xsl:apply-templates/>
1471
+ </fo:block>
1472
+ </xsl:template>
1473
+
1474
+ <xsl:template match="ogc:termexample/ogc:p">
1475
+ <fo:inline><xsl:apply-templates/></fo:inline>
1476
+ </xsl:template>
1477
+
1478
+
1479
+ <xsl:template match="ogc:annex">
1480
+ <fo:block break-after="page"/>
1481
+ <xsl:apply-templates/>
1482
+ </xsl:template>
1483
+
1484
+
1485
+ <!-- [position() &gt; 1] -->
1486
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']">
1487
+ <fo:block break-after="page"/>
1488
+ <fo:block line-height="120%">
1489
+ <xsl:apply-templates/>
1490
+ </fo:block>
1491
+ </xsl:template>
1492
+
1493
+
1494
+ <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1495
+ <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem"> [position() &gt; 1] -->
1496
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem">
1497
+ <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
1498
+ <fo:list-item>
1499
+ <fo:list-item-label end-indent="label-end()">
1500
+ <fo:block>
1501
+ <fo:inline id="{@id}">
1502
+ <xsl:number format="[1]"/>
1503
+ </fo:inline>
1504
+ </fo:block>
1505
+ </fo:list-item-label>
1506
+ <fo:list-item-body start-indent="body-start()">
1507
+ <fo:block>
1508
+
1509
+ <xsl:if test="not(ogc:formattedref)">
1510
+ <xsl:choose>
1511
+ <xsl:when test="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:abbreviation">
1512
+ <xsl:for-each select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:abbreviation">
1513
+ <xsl:value-of select="."/>
1514
+ <xsl:if test="position() != last()">/</xsl:if>
1515
+ </xsl:for-each>
1516
+ <xsl:text>: </xsl:text>
1517
+ </xsl:when>
1518
+ <xsl:when test="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1519
+ <xsl:value-of select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name"/>
1520
+ <xsl:text>: </xsl:text>
1521
+ </xsl:when>
1522
+ </xsl:choose>
1523
+
1524
+ </xsl:if>
1525
+
1526
+ <xsl:if test="ogc:docidentifier">
1527
+ <xsl:choose>
1528
+ <xsl:when test="ogc:docidentifier/@type = 'ISO' and ogc:formattedref"/>
1529
+ <xsl:when test="ogc:docidentifier/@type = 'OGC' and ogc:formattedref"/>
1530
+ <xsl:otherwise><fo:inline>
1531
+ <xsl:if test="ogc:docidentifier/@type = 'OGC'">OGC </xsl:if>
1532
+ <xsl:value-of select="ogc:docidentifier"/><xsl:apply-templates select="ogc:note"/>, </fo:inline></xsl:otherwise>
1533
+ </xsl:choose>
1534
+ </xsl:if>
1535
+
1536
+
1537
+
1538
+ <xsl:choose>
1539
+ <xsl:when test="ogc:title[@type = 'main' and @language = 'en']">
1540
+ <xsl:apply-templates select="ogc:title[@type = 'main' and @language = 'en']"/>
1541
+ </xsl:when>
1542
+ <xsl:otherwise>
1543
+ <xsl:apply-templates select="ogc:title"/>
1544
+ </xsl:otherwise>
1545
+ </xsl:choose>
1546
+ <xsl:if test="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1547
+ <xsl:text>, </xsl:text>
1548
+ <xsl:for-each select="ogc:contributor[ogc:role/@type='publisher']/ogc:organization/ogc:name">
1549
+ <xsl:if test="position() != last()">and </xsl:if>
1550
+ <xsl:value-of select="."/>
1551
+ </xsl:for-each>
1552
+
1553
+ </xsl:if>
1554
+ <xsl:if test="ogc:place">
1555
+ <xsl:text>, </xsl:text>
1556
+ <xsl:value-of select="ogc:place"/>
1557
+ </xsl:if>
1558
+ <xsl:if test="ogc:date[@type='published']/ogc:on">
1559
+ <xsl:text> (</xsl:text><xsl:value-of select="ogc:date[@type='published']/ogc:on"/><xsl:text>).</xsl:text>
1560
+ </xsl:if>
1561
+ <xsl:apply-templates select="ogc:formattedref"/>
1562
+ </fo:block>
1563
+ </fo:list-item-body>
1564
+ </fo:list-item>
1565
+ </fo:list-block>
1566
+ </xsl:template>
1567
+
1568
+ <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem" mode="contents"/> [position() &gt; 1] -->
1569
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem" mode="contents"/>
1570
+
1571
+ <!-- <xsl:template match="ogc:references[@id = '_bibliography']/ogc:bibitem/ogc:title"> [position() &gt; 1]-->
1572
+ <xsl:template match="ogc:references[@id != '_normative_references' and @id != '_references']/ogc:bibitem/ogc:title">
1573
+ <fo:inline font-style="italic">
1574
+ <xsl:apply-templates/>
1575
+ </fo:inline>
1576
+ </xsl:template>
1577
+
1578
+ <xsl:template match="ogc:quote">
1579
+ <fo:block margin-top="12pt" margin-left="13mm" margin-right="12mm">
1580
+ <xsl:apply-templates select=".//ogc:p"/>
1581
+ </fo:block>
1582
+ <xsl:if test="ogc:author or ogc:source">
1583
+ <fo:block text-align="right" margin-right="25mm">
1584
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1585
+ <xsl:if test="ogc:author">
1586
+ <xsl:text>— </xsl:text><xsl:value-of select="ogc:author"/>
1587
+ </xsl:if>
1588
+ <xsl:if test="ogc:source">
1589
+ <xsl:text>, </xsl:text>
1590
+ <xsl:apply-templates select="ogc:source"/>
1591
+ </xsl:if>
1592
+ </fo:block>
1593
+ </xsl:if>
1594
+ </xsl:template>
1595
+
1596
+ <xsl:template match="ogc:source">
1597
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1598
+ <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1599
+ <xsl:apply-templates select="ogc:localityStack"/>
1600
+ </fo:basic-link>
1601
+ </xsl:template>
1602
+
1603
+
1604
+ <xsl:template match="ogc:xref">
1605
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
1606
+ <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1607
+ <!-- <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))"> -->
1608
+ <xsl:attribute name="color">blue</xsl:attribute>
1609
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1610
+ <!-- </xsl:if> -->
1611
+ <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1612
+ <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
1613
+
1614
+ <xsl:choose>
1615
+ <xsl:when test="normalize-space(.) != ''">
1616
+ <xsl:apply-templates/>
1617
+ </xsl:when>
1618
+ <xsl:otherwise>
1619
+ <xsl:choose>
1620
+ <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1621
+ <xsl:when test="$type = 'term' and ($root = 'clause' or $root = 'terms')">Clause </xsl:when>
1622
+ <xsl:when test="$type = 'clause' and $root = 'annex'">Annex </xsl:when>
1623
+ <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1624
+ </xsl:choose>
1625
+ <xsl:value-of select="$section"/>
1626
+ </xsl:otherwise>
1627
+ </xsl:choose>
1628
+ </fo:basic-link>
1629
+ </xsl:template>
1630
+
1631
+ <xsl:template match="ogc:sourcecode" priority="2">
1632
+ <xsl:call-template name="sourcecode"/>
1633
+ <xsl:choose>
1634
+ <xsl:when test="@unnumbered='true'"/>
1635
+ <xsl:when test="ancestor::ogc:example"/>
1636
+ <xsl:when test="ancestor::ogc:td"/>
1637
+ <xsl:when test="ancestor::ogc:annex">
1638
+ <xsl:variable name="id_annex" select="ancestor::ogc:annex/@id"/>
1639
+ <xsl:choose>
1640
+ <xsl:when test="count(//ogc:annex) = 1">
1641
+ <xsl:value-of select="/ogc:nist-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/><xsl:number format="-1" level="any" count="ogc:annex//ogc:sourcecode"/>
1642
+ </xsl:when>
1643
+ <xsl:otherwise>
1644
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1645
+ <xsl:text>Figure </xsl:text>
1646
+ <xsl:number format="A." level="multiple" count="ogc:annex"/>
1647
+ <xsl:number format="1" level="any" count="ogc:sourcecode[ancestor::ogc:annex/@id = $id_annex and not(@unnumbered='true') and not(ancestor::ogc:example)]"/>
1648
+ <xsl:if test="ogc:name">
1649
+ <xsl:text> — </xsl:text>
1650
+ <xsl:apply-templates select="ogc:name/*"/>
1651
+ </xsl:if>
1652
+ </fo:block>
1653
+ </xsl:otherwise>
1654
+ </xsl:choose>
1655
+ </xsl:when>
1656
+ <xsl:otherwise>
1657
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1658
+ <xsl:text>Figure </xsl:text>
1659
+ <xsl:number format="1" level="any" count="ogc:sourcecode[not(@unnumbered='true') and not(ancestor::ogc:example)] | ogc:figure"/>
1660
+ <xsl:if test="ogc:name">
1661
+ <xsl:text> — </xsl:text>
1662
+ <xsl:apply-templates select="ogc:name/*"/>
1663
+ </xsl:if>
1664
+ </fo:block>
1665
+ </xsl:otherwise>
1666
+ </xsl:choose>
1667
+ </xsl:template>
1668
+
1669
+ <xsl:template match="ogc:sourcecode/text()">
1670
+ <xsl:variable name="text">
1671
+ <xsl:call-template name="add-zero-spaces-equal"/>
1672
+ </xsl:variable>
1673
+ <xsl:call-template name="add-zero-spaces">
1674
+ <xsl:with-param name="text" select="$text"/>
1675
+ </xsl:call-template>
1676
+ </xsl:template>
1677
+
1678
+
1679
+ <xsl:template match="ogc:sourcecode/ogc:name"/>
1680
+
1681
+ <xsl:template match="ogc:example">
1682
+ <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1683
+ <xsl:text>EXAMPLE</xsl:text>
1684
+ <xsl:if test="following-sibling::ogc:example or preceding-sibling::ogc:example">
1685
+ <xsl:number format=" 1"/>
1686
+ </xsl:if>
1687
+ <xsl:if test="ogc:name">
1688
+ <xsl:text> — </xsl:text>
1689
+ <xsl:apply-templates select="ogc:name/node()"/>
1690
+ </xsl:if>
1691
+ </fo:block>
1692
+ <fo:block font-size="10pt" margin-left="12.5mm" margin-right="12.5mm">
1693
+ <xsl:apply-templates/>
1694
+ </fo:block>
1695
+ </xsl:template>
1696
+
1697
+ <xsl:template match="ogc:example/ogc:name"/>
1698
+
1699
+ <xsl:template match="ogc:example/ogc:p">
1700
+ <fo:block margin-bottom="14pt">
1701
+ <xsl:apply-templates/>
1702
+ </fo:block>
1703
+ </xsl:template>
1704
+
1705
+
1706
+
1707
+ <xsl:template match="ogc:note/ogc:p" name="note">
1708
+ <fo:block font-size="10pt" margin-top="12pt" margin-bottom="12pt" line-height="115%">
1709
+ <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol and not(ancestor::ogc:note[1]/following-sibling::*)">
1710
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1711
+ </xsl:if>
1712
+ <xsl:variable name="clauseid" select="ancestor::ogc:clause[1]/@id"/>
1713
+ <fo:inline padding-right="4mm">
1714
+ <xsl:text>NOTE </xsl:text>
1715
+ <xsl:if test="count(//ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]) &gt; 1">
1716
+ <xsl:number count="ogc:note[ancestor::ogc:clause[1][@id = $clauseid]]" level="any"/>
1717
+ </xsl:if>
1718
+ </fo:inline>
1719
+ <xsl:apply-templates/>
1720
+ </fo:block>
1721
+ </xsl:template>
1722
+
1723
+ <!-- <eref type="inline" bibitemid="ISO20483" citeas="ISO 20483:2013"><locality type="annex"><referenceFrom>C</referenceFrom></locality></eref> -->
1724
+ <xsl:template match="ogc:eref">
1725
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}" color="blue" text-decoration="underline"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
1726
+ <xsl:if test="@type = 'footnote'">
1727
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1728
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1729
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1730
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1731
+ </xsl:if>
1732
+ <xsl:if test="@type = 'inline'">
1733
+ <xsl:attribute name="color">blue</xsl:attribute>
1734
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1735
+ </xsl:if>
1736
+ <!-- <xsl:if test="@type = 'inline'">
1737
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1738
+ </xsl:if> -->
1739
+ <xsl:choose>
1740
+ <xsl:when test="@citeas and normalize-space(text()) = ''">
1741
+ <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1742
+ </xsl:when>
1743
+ <xsl:when test="@bibitemid and normalize-space(text()) = ''">
1744
+ <xsl:value-of select="//ogc:bibitem[@id = current()/@bibitemid]/ogc:docidentifier"/>
1745
+ </xsl:when>
1746
+ <xsl:otherwise/>
1747
+ </xsl:choose>
1748
+ <xsl:apply-templates select="ogc:localityStack"/>
1749
+ <xsl:apply-templates select="text()"/>
1750
+ </fo:basic-link>
1751
+ </xsl:template>
1752
+
1753
+ <xsl:template match="ogc:locality">
1754
+ <xsl:choose>
1755
+ <xsl:when test="@type ='clause'">Clause </xsl:when>
1756
+ <xsl:when test="@type ='annex'">Annex </xsl:when>
1757
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1758
+ </xsl:choose>
1759
+ <xsl:text> </xsl:text><xsl:value-of select="ogc:referenceFrom"/>
1760
+ </xsl:template>
1761
+
1762
+ <xsl:template match="ogc:admonition">
1763
+ <fo:block-container border="0.5pt solid rgb(79, 129, 189)" color="rgb(79, 129, 189)" margin-left="16mm" margin-right="16mm" margin-bottom="12pt">
1764
+ <fo:block-container margin-left="0mm" margin-right="0mm" padding="2mm" padding-top="3mm">
1765
+ <fo:block font-size="11pt" margin-bottom="6pt" font-weight="bold" font-style="italic" text-align="center">
1766
+ <xsl:value-of select="translate(@type, $lower, $upper)"/>
1767
+ </fo:block>
1768
+ <fo:block font-style="italic">
1769
+ <xsl:apply-templates/>
1770
+ </fo:block>
1771
+ </fo:block-container>
1772
+ </fo:block-container>
1773
+
1774
+
1775
+ </xsl:template>
1776
+
1777
+ <xsl:template match="ogc:formula/ogc:dt/ogc:stem">
1778
+ <fo:inline>
1779
+ <xsl:apply-templates/>
1780
+ </fo:inline>
1781
+ </xsl:template>
1782
+
1783
+ <xsl:template match="ogc:formula/ogc:stem">
1784
+ <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
1785
+ <fo:table table-layout="fixed" width="100%">
1786
+ <fo:table-column column-width="95%"/>
1787
+ <fo:table-column column-width="5%"/>
1788
+ <fo:table-body>
1789
+ <fo:table-row>
1790
+ <fo:table-cell display-align="center">
1791
+ <fo:block text-align="left" margin-left="5mm">
1792
+ <xsl:apply-templates/>
1793
+ </fo:block>
1794
+ </fo:table-cell>
1795
+ <fo:table-cell display-align="center">
1796
+ <fo:block text-align="right">
1797
+ <xsl:choose>
1798
+ <xsl:when test="ancestor::ogc:annex">
1799
+ <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="ogc:annex | ogc:formula"/><xsl:text>)</xsl:text>
1800
+ </xsl:when>
1801
+ <xsl:otherwise> <!-- not(ancestor::ogc:annex) -->
1802
+ <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="ogc:formula"/><xsl:text>)</xsl:text> -->
1803
+ </xsl:otherwise>
1804
+ </xsl:choose>
1805
+ </fo:block>
1806
+ </fo:table-cell>
1807
+ </fo:table-row>
1808
+ </fo:table-body>
1809
+ </fo:table>
1810
+ <fo:inline keep-together.within-line="always">
1811
+ </fo:inline>
1812
+ </fo:block>
1813
+ </xsl:template>
1814
+
1815
+
1816
+ <xsl:template match="ogc:br" priority="2">
1817
+ <!-- <fo:block>&#xA0;</fo:block> -->
1818
+ <xsl:value-of select="$linebreak"/>
1819
+ </xsl:template>
1820
+
1821
+ <xsl:template match="ogc:pagebreak">
1822
+ <fo:block break-after="page"/>
1823
+ <fo:block> </fo:block>
1824
+ <fo:block break-after="page"/>
1825
+ </xsl:template>
1826
+
1827
+ <xsl:template name="insertHeaderFooter">
1828
+ <xsl:param name="pagenum-font-weight" select="'normal'"/>
1829
+ <fo:static-content flow-name="header-even">
1830
+ <fo:block-container height="17mm" display-align="before">
1831
+ <fo:block padding-top="12.5mm">
1832
+ <xsl:value-of select="$header"/>
1833
+ </fo:block>
1834
+ </fo:block-container>
1835
+ </fo:static-content>
1836
+ <fo:static-content flow-name="footer-even">
1837
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1838
+ <fo:table table-layout="fixed" width="100%">
1839
+ <fo:table-column column-width="10%"/>
1840
+ <fo:table-column column-width="90%"/>
1841
+ <fo:table-body>
1842
+ <fo:table-row>
1843
+ <fo:table-cell>
1844
+ <fo:block padding-bottom="5mm" font-weight="{$pagenum-font-weight}">
1845
+ <fo:page-number/>
1846
+ </fo:block>
1847
+ </fo:table-cell>
1848
+ <fo:table-cell padding-right="2mm">
1849
+ <fo:block padding-bottom="5mm" text-align="right">
1850
+ <xsl:value-of select="$copyright_short"/></fo:block>
1851
+ </fo:table-cell>
1852
+ </fo:table-row>
1853
+ </fo:table-body>
1854
+ </fo:table>
1855
+ </fo:block-container>
1856
+ </fo:static-content>
1857
+ <fo:static-content flow-name="header-odd">
1858
+ <fo:block-container height="17mm" display-align="before">
1859
+ <fo:block text-align="right" padding-top="12.5mm">
1860
+ <xsl:value-of select="$header"/>
1861
+ </fo:block>
1862
+ </fo:block-container>
1863
+ </fo:static-content>
1864
+ <fo:static-content flow-name="footer-odd">
1865
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1866
+ <fo:table table-layout="fixed" width="100%">
1867
+ <fo:table-column column-width="90%"/>
1868
+ <fo:table-column column-width="10%"/>
1869
+ <fo:table-body>
1870
+ <fo:table-row>
1871
+ <fo:table-cell>
1872
+ <fo:block padding-bottom="5mm"><xsl:value-of select="$copyright"/></fo:block>
1873
+ </fo:table-cell>
1874
+ <fo:table-cell padding-right="2mm">
1875
+ <fo:block padding-bottom="5mm" text-align="right" font-weight="{$pagenum-font-weight}"><fo:page-number/></fo:block>
1876
+ </fo:table-cell>
1877
+ </fo:table-row>
1878
+ </fo:table-body>
1879
+ </fo:table>
1880
+ </fo:block-container>
1881
+ </fo:static-content>
1882
+ </xsl:template>
1883
+
1884
+ <xsl:template name="getId">
1885
+ <xsl:choose>
1886
+ <xsl:when test="../@id">
1887
+ <xsl:value-of select="../@id"/>
1888
+ </xsl:when>
1889
+ <xsl:otherwise>
1890
+ <xsl:value-of select="text()"/>
1891
+ </xsl:otherwise>
1892
+ </xsl:choose>
1893
+ </xsl:template>
1894
+
1895
+ <xsl:template name="getLevel">
1896
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
1897
+ <xsl:variable name="level">
1898
+ <xsl:choose>
1899
+ <xsl:when test="ancestor::ogc:preface">
1900
+ <xsl:value-of select="$level_total - 2"/>
1901
+ </xsl:when>
1902
+ <xsl:when test="ancestor::ogc:sections">
1903
+ <xsl:value-of select="$level_total - 2"/>
1904
+ </xsl:when>
1905
+ <xsl:when test="ancestor::ogc:bibliography">
1906
+ <xsl:value-of select="$level_total - 2"/>
1907
+ </xsl:when>
1908
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
1909
+ <xsl:otherwise>
1910
+ <xsl:value-of select="$level_total - 1"/>
1911
+ </xsl:otherwise>
1912
+ </xsl:choose>
1913
+ </xsl:variable>
1914
+ <xsl:value-of select="$level"/>
1915
+ </xsl:template>
1916
+
1917
+ <xsl:template name="getSection">
1918
+ <xsl:param name="sectionNum"/>
1919
+ <xsl:variable name="level">
1920
+ <xsl:call-template name="getLevel"/>
1921
+ </xsl:variable>
1922
+ <xsl:variable name="section">
1923
+ <xsl:choose>
1924
+ <xsl:when test="ancestor::ogc:bibliography">
1925
+ <xsl:value-of select="$sectionNum"/>
1926
+ </xsl:when>
1927
+ <xsl:when test="ancestor::ogc:sections">
1928
+ <!-- 1, 2, 3, 4, ... from main section (not annex, bibliography, ...) -->
1929
+ <xsl:choose>
1930
+ <xsl:when test="$level = 1">
1931
+ <xsl:value-of select="$sectionNum"/>
1932
+ </xsl:when>
1933
+ <xsl:when test="$level &gt;= 2">
1934
+ <xsl:variable name="num">
1935
+ <xsl:number format=".1" level="multiple" count="ogc:clause/ogc:clause | ogc:clause/ogc:terms | ogc:terms/ogc:term | ogc:clause/ogc:term | ogc:clause/ogc:definitions | ogc:definitions/ogc:definitions | ogc:terms/ogc:definitions"/>
1936
+ </xsl:variable>
1937
+ <xsl:value-of select="concat($sectionNum, $num)"/>
1938
+ </xsl:when>
1939
+ <xsl:otherwise>
1940
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1941
+ </xsl:otherwise>
1942
+ </xsl:choose>
1943
+ <!-- <xsl:text>.</xsl:text> -->
1944
+ </xsl:when>
1945
+ <!-- <xsl:when test="ancestor::ogc:annex[@obligation = 'informative']">
1946
+ <xsl:choose>
1947
+ <xsl:when test="$level = 1">
1948
+ <xsl:text>Annex </xsl:text>
1949
+ <xsl:number format="I" level="any" count="ogc:annex[@obligation = 'informative']"/>
1950
+ </xsl:when>
1951
+ <xsl:otherwise>
1952
+ <xsl:number format="I.1" level="multiple" count="ogc:annex[@obligation = 'informative'] | ogc:clause"/>
1953
+ </xsl:otherwise>
1954
+ </xsl:choose>
1955
+ </xsl:when> -->
1956
+ <xsl:when test="ancestor::ogc:annex">
1957
+ <xsl:choose>
1958
+ <xsl:when test="$level = 1">
1959
+ <xsl:text>Annex </xsl:text>
1960
+ <xsl:choose>
1961
+ <xsl:when test="count(//ogc:annex) = 1">
1962
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/>
1963
+ </xsl:when>
1964
+ <xsl:otherwise>
1965
+ <xsl:number format="A" level="any" count="ogc:annex"/>
1966
+ </xsl:otherwise>
1967
+ </xsl:choose>
1968
+ </xsl:when>
1969
+ <xsl:otherwise>
1970
+ <xsl:choose>
1971
+ <xsl:when test="count(//ogc:annex) = 1">
1972
+ <xsl:value-of select="/ogc:ogc-standard/ogc:bibdata/ogc:ext/ogc:structuredidentifier/ogc:annexid"/><xsl:number format=".1" level="multiple" count="ogc:clause"/>
1973
+ </xsl:when>
1974
+ <xsl:otherwise>
1975
+ <xsl:number format="A.1" level="multiple" count="ogc:annex | ogc:clause"/>
1976
+ </xsl:otherwise>
1977
+ </xsl:choose>
1978
+ </xsl:otherwise>
1979
+ </xsl:choose>
1980
+ </xsl:when>
1981
+ <xsl:when test="ancestor::ogc:preface"> <!-- if preface and there is clause(s) -->
1982
+ <xsl:choose>
1983
+ <xsl:when test="$level = 1 and ..//ogc:clause">0</xsl:when>
1984
+ <xsl:when test="$level &gt;= 2">
1985
+ <xsl:variable name="num">
1986
+ <xsl:number format=".1" level="multiple" count="ogc:clause"/>
1987
+ </xsl:variable>
1988
+ <xsl:value-of select="concat('0', $num)"/>
1989
+ </xsl:when>
1990
+ <xsl:otherwise>
1991
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1992
+ </xsl:otherwise>
1993
+ </xsl:choose>
1994
+ </xsl:when>
1995
+ <xsl:otherwise>
1996
+ </xsl:otherwise>
1997
+ </xsl:choose>
1998
+ </xsl:variable>
1999
+ <xsl:value-of select="$section"/>
2000
+ </xsl:template>
2001
+
2002
+ <xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-table">
2003
+
2004
+ <xsl:text>Table </xsl:text>
2005
+
2006
+
2007
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note">
2008
+
2009
+ <xsl:text>NOTE </xsl:text>
2010
+
2011
+
2012
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-figure">
2013
+
2014
+ <xsl:text>Figure </xsl:text>
2015
+
2016
+
2017
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-example">
2018
+
2019
+ <xsl:text>EXAMPLE </xsl:text>
2020
+
2021
+
2022
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-inequality">Inequality </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-equation">Equation </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-annex">
2023
+
2024
+ <xsl:text>Annex </xsl:text>
2025
+
2026
+
2027
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-appendix">
2028
+ <xsl:text>Appendix </xsl:text>
2029
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-clause">
2030
+
2031
+ <xsl:text>Clause </xsl:text>
2032
+
2033
+
2034
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-edition">
2035
+ <xsl:text>Edition </xsl:text>
2036
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-toc">
2037
+
2038
+
2039
+ </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-page">Page</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-key">Key</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-where">where</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-descriptors">Descriptors</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-en">Part </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-fr">Partie </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-modified">modified</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-source">SOURCE</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-keywords">Keywords</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="link-style">
2040
+
2041
+ <xsl:attribute name="color">blue</xsl:attribute>
2042
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2043
+
2044
+
2045
+ </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="sourcecode-style">
2046
+
2047
+
2048
+
2049
+
2050
+
2051
+
2052
+
2053
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2054
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2055
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2056
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2057
+ <xsl:attribute name="line-height">113%</xsl:attribute>
2058
+
2059
+
2060
+ </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-style">
2061
+
2062
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2063
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2064
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
2065
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2066
+
2067
+
2068
+
2069
+ </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-example-style">
2070
+
2071
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2072
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
2073
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2074
+
2075
+
2076
+
2077
+ </xsl:attribute-set><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()">
2078
+ <xsl:value-of select="."/>
2079
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='br']">
2080
+ <xsl:value-of select="$linebreak"/>
2081
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2082
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2083
+ <xsl:call-template name="add-zero-spaces-java"/>
2084
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']">
2085
+
2086
+ <xsl:variable name="simple-table">
2087
+ <!-- <xsl:copy> -->
2088
+ <xsl:call-template name="getSimpleTable"/>
2089
+ <!-- </xsl:copy> -->
2090
+ </xsl:variable>
2091
+
2092
+ <!-- DEBUG -->
2093
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2094
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2095
+
2096
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2097
+
2098
+ <!-- <xsl:if test="$namespace = 'iso'">
2099
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2100
+ </xsl:if> -->
2101
+
2102
+ <xsl:choose>
2103
+ <xsl:when test="@unnumbered = 'true'"/>
2104
+ <xsl:otherwise>
2105
+
2106
+
2107
+
2108
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2109
+
2110
+
2111
+
2112
+
2113
+
2114
+
2115
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2116
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
2117
+
2118
+
2119
+
2120
+
2121
+ <xsl:value-of select="$title-table"/>
2122
+
2123
+ <xsl:call-template name="getTableNumber"/>
2124
+
2125
+
2126
+ <xsl:if test="*[local-name()='name']">
2127
+
2128
+
2129
+
2130
+ <xsl:text> — </xsl:text>
2131
+
2132
+ <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
2133
+ </xsl:if>
2134
+ </fo:block>
2135
+
2136
+
2137
+ <xsl:call-template name="fn_name_display"/>
2138
+
2139
+ </xsl:otherwise>
2140
+ </xsl:choose>
2141
+
2142
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2143
+
2144
+ <!-- <xsl:variable name="cols-count">
2145
+ <xsl:choose>
2146
+ <xsl:when test="*[local-name()='thead']">
2147
+ <xsl:call-template name="calculate-columns-numbers">
2148
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2149
+ </xsl:call-template>
2150
+ </xsl:when>
2151
+ <xsl:otherwise>
2152
+ <xsl:call-template name="calculate-columns-numbers">
2153
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2154
+ </xsl:call-template>
2155
+ </xsl:otherwise>
2156
+ </xsl:choose>
2157
+ </xsl:variable> -->
2158
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2159
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2160
+
2161
+
2162
+
2163
+ <xsl:variable name="colwidths">
2164
+ <xsl:call-template name="calculate-column-widths">
2165
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2166
+ <xsl:with-param name="table" select="$simple-table"/>
2167
+ </xsl:call-template>
2168
+ </xsl:variable>
2169
+
2170
+ <!-- <xsl:variable name="colwidths2">
2171
+ <xsl:call-template name="calculate-column-widths">
2172
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2173
+ </xsl:call-template>
2174
+ </xsl:variable> -->
2175
+
2176
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2177
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2178
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2179
+
2180
+ <xsl:variable name="margin-left">
2181
+ <xsl:choose>
2182
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2183
+ <xsl:otherwise>0</xsl:otherwise>
2184
+ </xsl:choose>
2185
+ </xsl:variable>
2186
+
2187
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2188
+
2189
+
2190
+
2191
+
2192
+
2193
+
2194
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2195
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2196
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
2197
+
2198
+
2199
+
2200
+ <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
2201
+
2202
+
2203
+
2204
+
2205
+
2206
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2207
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2208
+
2209
+
2210
+
2211
+
2212
+
2213
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2214
+
2215
+
2216
+
2217
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2218
+ <xsl:choose>
2219
+ <xsl:when test=". = 1 or . = 0">
2220
+ <fo:table-column column-width="proportional-column-width(2)"/>
2221
+ </xsl:when>
2222
+ <xsl:otherwise>
2223
+ <fo:table-column column-width="proportional-column-width({.})"/>
2224
+ </xsl:otherwise>
2225
+ </xsl:choose>
2226
+ </xsl:for-each>
2227
+ <xsl:apply-templates/>
2228
+ </fo:table>
2229
+
2230
+
2231
+
2232
+ </fo:block-container>
2233
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getTableNumber">
2234
+ <xsl:choose>
2235
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2236
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2237
+ </xsl:when>
2238
+ <xsl:when test="ancestor::*[local-name()='annex']">
2239
+
2240
+
2241
+
2242
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1"/>
2243
+
2244
+
2245
+
2246
+
2247
+
2248
+
2249
+ </xsl:when>
2250
+ <xsl:otherwise>
2251
+
2252
+
2253
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2254
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2255
+
2256
+ </xsl:otherwise>
2257
+ </xsl:choose>
2258
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']" mode="process">
2259
+ <xsl:apply-templates/>
2260
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-columns-numbers">
2261
+ <xsl:param name="table-row"/>
2262
+ <xsl:variable name="columns-count" select="count($table-row/*)"/>
2263
+ <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2264
+ <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2265
+ <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2266
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-column-widths">
2267
+ <xsl:param name="table"/>
2268
+ <xsl:param name="cols-count"/>
2269
+ <xsl:param name="curr-col" select="1"/>
2270
+ <xsl:param name="width" select="0"/>
2271
+
2272
+ <xsl:if test="$curr-col &lt;= $cols-count">
2273
+ <xsl:variable name="widths">
2274
+ <xsl:choose>
2275
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2276
+ <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2277
+ <xsl:variable name="words">
2278
+ <xsl:call-template name="tokenize">
2279
+ <xsl:with-param name="text" select="translate(*[local-name()='th'][$curr-col],'- —:', ' ')"/>
2280
+ </xsl:call-template>
2281
+ </xsl:variable>
2282
+ <xsl:variable name="max_length">
2283
+ <xsl:call-template name="max_length">
2284
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2285
+ </xsl:call-template>
2286
+ </xsl:variable>
2287
+ <width>
2288
+ <xsl:value-of select="$max_length"/>
2289
+ </width>
2290
+ </xsl:for-each>
2291
+ <xsl:for-each select="*[local-name()='tbody']//*[local-name()='tr']">
2292
+ <xsl:variable name="words">
2293
+ <xsl:call-template name="tokenize">
2294
+ <xsl:with-param name="text" select="translate(*[local-name()='td'][$curr-col],'- —:', ' ')"/>
2295
+ </xsl:call-template>
2296
+ </xsl:variable>
2297
+ <xsl:variable name="max_length">
2298
+ <xsl:call-template name="max_length">
2299
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2300
+ </xsl:call-template>
2301
+ </xsl:variable>
2302
+ <width>
2303
+ <xsl:value-of select="$max_length"/>
2304
+ </width>
2305
+
2306
+ </xsl:for-each>
2307
+ </xsl:when>
2308
+ <xsl:otherwise>
2309
+ <xsl:for-each select="xalan:nodeset($table)//tr">
2310
+ <xsl:variable name="td_text">
2311
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2312
+ </xsl:variable>
2313
+ <xsl:variable name="words">
2314
+ <xsl:variable name="string_with_added_zerospaces">
2315
+ <xsl:call-template name="add-zero-spaces-java">
2316
+ <xsl:with-param name="text" select="$td_text"/>
2317
+ </xsl:call-template>
2318
+ </xsl:variable>
2319
+ <xsl:call-template name="tokenize">
2320
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2321
+ <!-- 2009 thinspace -->
2322
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2323
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2324
+ </xsl:call-template>
2325
+ </xsl:variable>
2326
+ <xsl:variable name="max_length">
2327
+ <xsl:call-template name="max_length">
2328
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2329
+ </xsl:call-template>
2330
+ </xsl:variable>
2331
+ <width>
2332
+ <xsl:variable name="divider">
2333
+ <xsl:choose>
2334
+ <xsl:when test="td[$curr-col]/@divide">
2335
+ <xsl:value-of select="td[$curr-col]/@divide"/>
2336
+ </xsl:when>
2337
+ <xsl:otherwise>1</xsl:otherwise>
2338
+ </xsl:choose>
2339
+ </xsl:variable>
2340
+ <xsl:value-of select="$max_length div $divider"/>
2341
+ </width>
2342
+
2343
+ </xsl:for-each>
2344
+
2345
+ </xsl:otherwise>
2346
+ </xsl:choose>
2347
+ </xsl:variable>
2348
+
2349
+
2350
+ <column>
2351
+ <xsl:for-each select="xalan:nodeset($widths)//width">
2352
+ <xsl:sort select="." data-type="number" order="descending"/>
2353
+ <xsl:if test="position()=1">
2354
+ <xsl:value-of select="."/>
2355
+ </xsl:if>
2356
+ </xsl:for-each>
2357
+ </column>
2358
+ <xsl:call-template name="calculate-column-widths">
2359
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2360
+ <xsl:with-param name="curr-col" select="$curr-col +1"/>
2361
+ <xsl:with-param name="table" select="$table"/>
2362
+ </xsl:call-template>
2363
+ </xsl:if>
2364
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()" mode="td_text">
2365
+ <xsl:variable name="zero-space">​</xsl:variable>
2366
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2367
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='termsource']" mode="td_text">
2368
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2369
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" mode="td_text">
2370
+ <xsl:value-of select="@target"/>
2371
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table2']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']" mode="process">
2372
+ <xsl:param name="cols-count"/>
2373
+ <!-- font-weight="bold" -->
2374
+ <fo:table-header>
2375
+
2376
+ <xsl:apply-templates/>
2377
+ </fo:table-header>
2378
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']" mode="process">
2379
+ <xsl:apply-templates/>
2380
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertTableFooter">
2381
+ <xsl:param name="cols-count"/>
2382
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2383
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2384
+
2385
+ <fo:table-footer>
2386
+
2387
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2388
+
2389
+ <!-- if there are note(s) or fn(s) then create footer row -->
2390
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2391
+
2392
+
2393
+
2394
+ <fo:table-row>
2395
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
2396
+
2397
+
2398
+
2399
+ <!-- fn will be processed inside 'note' processing -->
2400
+
2401
+
2402
+ <!-- except gb -->
2403
+
2404
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2405
+
2406
+
2407
+ <!-- horizontal row separator -->
2408
+
2409
+
2410
+ <!-- fn processing -->
2411
+ <xsl:call-template name="fn_display"/>
2412
+
2413
+ </fo:table-cell>
2414
+ </fo:table-row>
2415
+
2416
+ </xsl:if>
2417
+ </fo:table-footer>
2418
+
2419
+ </xsl:if>
2420
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tbody']">
2421
+
2422
+ <xsl:variable name="cols-count">
2423
+ <xsl:choose>
2424
+ <xsl:when test="../*[local-name()='thead']">
2425
+ <xsl:call-template name="calculate-columns-numbers">
2426
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2427
+ </xsl:call-template>
2428
+ </xsl:when>
2429
+ <xsl:otherwise>
2430
+ <xsl:call-template name="calculate-columns-numbers">
2431
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2432
+ </xsl:call-template>
2433
+ </xsl:otherwise>
2434
+ </xsl:choose>
2435
+ </xsl:variable>
2436
+
2437
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
2438
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2439
+ </xsl:apply-templates>
2440
+
2441
+ <xsl:call-template name="insertTableFooter">
2442
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2443
+ </xsl:call-template>
2444
+
2445
+ <fo:table-body>
2446
+ <xsl:apply-templates/>
2447
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
2448
+
2449
+ </fo:table-body>
2450
+
2451
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']">
2452
+ <xsl:variable name="parent-name" select="local-name(..)"/>
2453
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2454
+ <fo:table-row min-height="4mm">
2455
+ <xsl:if test="$parent-name = 'thead'">
2456
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2457
+
2458
+
2459
+
2460
+
2461
+
2462
+ </xsl:if>
2463
+ <xsl:if test="$parent-name = 'tfoot'">
2464
+
2465
+
2466
+ </xsl:if>
2467
+
2468
+
2469
+ <xsl:apply-templates/>
2470
+ </fo:table-row>
2471
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th']">
2472
+ <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2473
+
2474
+
2475
+
2476
+
2477
+
2478
+
2479
+
2480
+ <xsl:if test="@colspan">
2481
+ <xsl:attribute name="number-columns-spanned">
2482
+ <xsl:value-of select="@colspan"/>
2483
+ </xsl:attribute>
2484
+ </xsl:if>
2485
+ <xsl:if test="@rowspan">
2486
+ <xsl:attribute name="number-rows-spanned">
2487
+ <xsl:value-of select="@rowspan"/>
2488
+ </xsl:attribute>
2489
+ </xsl:if>
2490
+ <fo:block>
2491
+ <xsl:apply-templates/>
2492
+ </fo:block>
2493
+ </fo:table-cell>
2494
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']">
2495
+ <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2496
+
2497
+
2498
+
2499
+
2500
+
2501
+
2502
+
2503
+
2504
+
2505
+ <xsl:if test="@colspan">
2506
+ <xsl:attribute name="number-columns-spanned">
2507
+ <xsl:value-of select="@colspan"/>
2508
+ </xsl:attribute>
2509
+ </xsl:if>
2510
+ <xsl:if test="@rowspan">
2511
+ <xsl:attribute name="number-rows-spanned">
2512
+ <xsl:value-of select="@rowspan"/>
2513
+ </xsl:attribute>
2514
+ </xsl:if>
2515
+ <fo:block>
2516
+
2517
+ <xsl:apply-templates/>
2518
+ </fo:block>
2519
+ <!-- <xsl:choose>
2520
+ <xsl:when test="count(*) = 1 and *[local-name() = 'p']">
2521
+ <xsl:apply-templates />
2522
+ </xsl:when>
2523
+ <xsl:otherwise>
2524
+ <fo:block>
2525
+ <xsl:apply-templates />
2526
+ </fo:block>
2527
+ </xsl:otherwise>
2528
+ </xsl:choose> -->
2529
+
2530
+
2531
+ </fo:table-cell>
2532
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']" mode="process">
2533
+
2534
+
2535
+ <fo:block font-size="10pt" margin-bottom="12pt">
2536
+
2537
+
2538
+
2539
+
2540
+ <fo:inline padding-right="2mm">
2541
+
2542
+
2543
+ <xsl:value-of select="$title-note"/>
2544
+
2545
+ <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2546
+ <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
2547
+ <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
2548
+ </xsl:if>
2549
+
2550
+
2551
+
2552
+
2553
+ </fo:inline>
2554
+ <xsl:apply-templates mode="process"/>
2555
+ </fo:block>
2556
+
2557
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2558
+ <xsl:apply-templates/>
2559
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display">
2560
+ <xsl:variable name="references">
2561
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2562
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2563
+
2564
+
2565
+ <xsl:attribute name="id">
2566
+ <xsl:value-of select="@reference"/>
2567
+ <xsl:text>_</xsl:text>
2568
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
2569
+ </xsl:attribute>
2570
+
2571
+ <xsl:apply-templates/>
2572
+ </fn>
2573
+ </xsl:for-each>
2574
+ </xsl:variable>
2575
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2576
+ <xsl:variable name="reference" select="@reference"/>
2577
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2578
+ <fo:block margin-bottom="12pt">
2579
+
2580
+
2581
+
2582
+
2583
+ <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2584
+
2585
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2586
+
2587
+
2588
+
2589
+
2590
+
2591
+
2592
+ <xsl:value-of select="@reference"/>
2593
+
2594
+ </fo:inline>
2595
+ <fo:inline>
2596
+
2597
+ <xsl:apply-templates/>
2598
+ </fo:inline>
2599
+ </fo:block>
2600
+ </xsl:if>
2601
+ </xsl:for-each>
2602
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_name_display">
2603
+ <!-- <xsl:variable name="references">
2604
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2605
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2606
+ <xsl:apply-templates />
2607
+ </fn>
2608
+ </xsl:for-each>
2609
+ </xsl:variable>
2610
+ $references=<xsl:copy-of select="$references"/> -->
2611
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2612
+ <xsl:variable name="reference" select="@reference"/>
2613
+ <fo:block id="{@reference}_{ancestor::*[@id][1]/@id}"><xsl:value-of select="@reference"/></fo:block>
2614
+ <fo:block margin-bottom="12pt">
2615
+ <xsl:apply-templates/>
2616
+ </fo:block>
2617
+ </xsl:for-each>
2618
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display_figure">
2619
+ <xsl:variable name="key_iso">
2620
+ <!-- and (not(@class) or @class !='pseudocode') -->
2621
+ </xsl:variable>
2622
+ <xsl:variable name="references">
2623
+ <xsl:for-each select=".//*[local-name()='fn']">
2624
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2625
+ <xsl:apply-templates/>
2626
+ </fn>
2627
+ </xsl:for-each>
2628
+ </xsl:variable>
2629
+ <xsl:if test="xalan:nodeset($references)//fn">
2630
+ <fo:block>
2631
+ <fo:table width="95%" table-layout="fixed">
2632
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2633
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2634
+
2635
+ </xsl:if>
2636
+ <fo:table-column column-width="15%"/>
2637
+ <fo:table-column column-width="85%"/>
2638
+ <fo:table-body>
2639
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2640
+ <xsl:variable name="reference" select="@reference"/>
2641
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2642
+ <fo:table-row>
2643
+ <fo:table-cell>
2644
+ <fo:block>
2645
+ <fo:inline font-size="80%" padding-right="5mm" vertical-align="super" id="{@id}">
2646
+
2647
+ <xsl:value-of select="@reference"/>
2648
+ </fo:inline>
2649
+ </fo:block>
2650
+ </fo:table-cell>
2651
+ <fo:table-cell>
2652
+ <fo:block text-align="justify" margin-bottom="12pt">
2653
+
2654
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2655
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
2656
+ </xsl:if>
2657
+
2658
+ <xsl:apply-templates/>
2659
+ </fo:block>
2660
+ </fo:table-cell>
2661
+ </fo:table-row>
2662
+ </xsl:if>
2663
+ </xsl:for-each>
2664
+ </fo:table-body>
2665
+ </fo:table>
2666
+ </fo:block>
2667
+ </xsl:if>
2668
+
2669
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']">
2670
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2671
+ <fo:inline font-size="80%" keep-with-previous.within-line="always">
2672
+
2673
+
2674
+
2675
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2676
+ <xsl:attribute name="color">blue</xsl:attribute>
2677
+
2678
+
2679
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2680
+
2681
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2682
+
2683
+ <xsl:attribute name="internal-destination">
2684
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
2685
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
2686
+ </xsl:attribute>
2687
+
2688
+ <xsl:value-of select="@reference"/>
2689
+ </fo:basic-link>
2690
+ </fo:inline>
2691
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']/*[local-name()='p']">
2692
+ <fo:inline>
2693
+ <xsl:apply-templates/>
2694
+ </fo:inline>
2695
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']">
2696
+ <xsl:variable name="parent" select="local-name(..)"/>
2697
+
2698
+ <xsl:variable name="key_iso">
2699
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2700
+ </xsl:variable>
2701
+
2702
+ <xsl:choose>
2703
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2704
+
2705
+
2706
+ <fo:block margin-bottom="12pt" text-align="left">
2707
+
2708
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2709
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2710
+ <xsl:text/>
2711
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2712
+ </fo:block>
2713
+
2714
+ </xsl:when>
2715
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2716
+ <fo:block margin-bottom="12pt" text-align="left">
2717
+
2718
+
2719
+
2720
+
2721
+ <xsl:value-of select="$title-where"/>
2722
+ </fo:block>
2723
+ </xsl:when>
2724
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2725
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
2726
+
2727
+
2728
+
2729
+ <xsl:value-of select="$title-key"/>
2730
+ </fo:block>
2731
+ </xsl:when>
2732
+ </xsl:choose>
2733
+
2734
+ <!-- a few components -->
2735
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2736
+ <fo:block>
2737
+
2738
+
2739
+
2740
+
2741
+ <fo:block>
2742
+
2743
+
2744
+
2745
+ <!-- create virtual html table for dl/[dt and dd] -->
2746
+ <xsl:variable name="html-table">
2747
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2748
+ <xsl:element name="{$ns}:table">
2749
+ <tbody>
2750
+ <xsl:apply-templates mode="dl"/>
2751
+ </tbody>
2752
+ </xsl:element>
2753
+ </xsl:variable>
2754
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2755
+ <xsl:variable name="colwidths">
2756
+ <xsl:call-template name="calculate-column-widths">
2757
+ <xsl:with-param name="cols-count" select="2"/>
2758
+ <xsl:with-param name="table" select="$html-table"/>
2759
+ </xsl:call-template>
2760
+ </xsl:variable>
2761
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2762
+
2763
+ <fo:table width="95%" table-layout="fixed">
2764
+
2765
+ <xsl:choose>
2766
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2767
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2768
+ </xsl:when>
2769
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2770
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2771
+
2772
+ </xsl:when>
2773
+ </xsl:choose>
2774
+ <xsl:choose>
2775
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2776
+ <fo:table-column column-width="50%"/>
2777
+ <fo:table-column column-width="50%"/>
2778
+ </xsl:when>
2779
+ <xsl:otherwise>
2780
+ <xsl:choose>
2781
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2782
+ <fo:table-column column-width="60%"/>
2783
+ <fo:table-column column-width="40%"/>
2784
+ </xsl:when> -->
2785
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2786
+ <fo:table-column column-width="50%"/>
2787
+ <fo:table-column column-width="50%"/>
2788
+ </xsl:when>
2789
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2790
+ <fo:table-column column-width="40%"/>
2791
+ <fo:table-column column-width="60%"/>
2792
+ </xsl:when>
2793
+ <xsl:otherwise>
2794
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2795
+ <xsl:choose>
2796
+ <xsl:when test=". = 1 or . = 0">
2797
+ <fo:table-column column-width="proportional-column-width(2)"/>
2798
+ </xsl:when>
2799
+ <xsl:otherwise>
2800
+ <fo:table-column column-width="proportional-column-width({.})"/>
2801
+ </xsl:otherwise>
2802
+ </xsl:choose>
2803
+ </xsl:for-each>
2804
+ </xsl:otherwise>
2805
+ </xsl:choose>
2806
+ <!-- <fo:table-column column-width="15%"/>
2807
+ <fo:table-column column-width="85%"/> -->
2808
+ </xsl:otherwise>
2809
+ </xsl:choose>
2810
+ <fo:table-body>
2811
+ <xsl:apply-templates>
2812
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2813
+ </xsl:apply-templates>
2814
+ </fo:table-body>
2815
+ </fo:table>
2816
+ </fo:block>
2817
+ </fo:block>
2818
+ </xsl:if>
2819
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']/*[local-name()='note']">
2820
+ <xsl:param name="key_iso"/>
2821
+
2822
+ <!-- <tr>
2823
+ <td>NOTE</td>
2824
+ <td>
2825
+ <xsl:apply-templates />
2826
+ </td>
2827
+ </tr>
2828
+ -->
2829
+ <fo:table-row>
2830
+ <fo:table-cell>
2831
+ <fo:block margin-top="6pt">
2832
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2833
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2834
+ </xsl:if>
2835
+ <xsl:value-of select="$title-note"/>
2836
+ </fo:block>
2837
+ </fo:table-cell>
2838
+ <fo:table-cell>
2839
+ <fo:block>
2840
+ <xsl:apply-templates/>
2841
+ </fo:block>
2842
+ </fo:table-cell>
2843
+ </fo:table-row>
2844
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']" mode="dl">
2845
+ <tr>
2846
+ <td>
2847
+ <xsl:apply-templates/>
2848
+ </td>
2849
+ <td>
2850
+
2851
+
2852
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2853
+
2854
+ </td>
2855
+ </tr>
2856
+
2857
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']">
2858
+ <xsl:param name="key_iso"/>
2859
+
2860
+ <fo:table-row>
2861
+ <fo:table-cell>
2862
+
2863
+ <fo:block margin-top="6pt">
2864
+
2865
+
2866
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2867
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2868
+
2869
+ </xsl:if>
2870
+
2871
+
2872
+
2873
+
2874
+
2875
+ <xsl:apply-templates/>
2876
+
2877
+ </fo:block>
2878
+ </fo:table-cell>
2879
+ <fo:table-cell>
2880
+ <fo:block>
2881
+
2882
+
2883
+
2884
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2885
+
2886
+ </fo:block>
2887
+ </fo:table-cell>
2888
+ </fo:table-row>
2889
+
2890
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl_process">
2891
+ <xsl:apply-templates/>
2892
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="process">
2893
+ <xsl:apply-templates/>
2894
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2895
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
2896
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='em']">
2897
+ <fo:inline font-style="italic">
2898
+ <xsl:apply-templates/>
2899
+ </fo:inline>
2900
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='strong']">
2901
+ <fo:inline font-weight="bold">
2902
+ <xsl:apply-templates/>
2903
+ </fo:inline>
2904
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sup']">
2905
+ <fo:inline font-size="80%" vertical-align="super">
2906
+ <xsl:apply-templates/>
2907
+ </fo:inline>
2908
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sub']">
2909
+ <fo:inline font-size="80%" vertical-align="sub">
2910
+ <xsl:apply-templates/>
2911
+ </fo:inline>
2912
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tt']">
2913
+ <fo:inline font-family="Courier" font-size="10pt">
2914
+ <xsl:apply-templates/>
2915
+ </fo:inline>
2916
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='del']">
2917
+ <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2918
+ <xsl:apply-templates/>
2919
+ </fo:inline>
2920
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()[ancestor::*[local-name()='smallcap']]">
2921
+ <xsl:variable name="text" select="normalize-space(.)"/>
2922
+ <fo:inline font-size="75%">
2923
+ <xsl:if test="string-length($text) &gt; 0">
2924
+ <xsl:call-template name="recursiveSmallCaps">
2925
+ <xsl:with-param name="text" select="$text"/>
2926
+ </xsl:call-template>
2927
+ </xsl:if>
2928
+ </fo:inline>
2929
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="recursiveSmallCaps">
2930
+ <xsl:param name="text"/>
2931
+ <xsl:variable name="char" select="substring($text,1,1)"/>
2932
+ <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
2933
+ <xsl:choose>
2934
+ <xsl:when test="$char=$upperCase">
2935
+ <fo:inline font-size="{100 div 0.75}%">
2936
+ <xsl:value-of select="$upperCase"/>
2937
+ </fo:inline>
2938
+ </xsl:when>
2939
+ <xsl:otherwise>
2940
+ <xsl:value-of select="$upperCase"/>
2941
+ </xsl:otherwise>
2942
+ </xsl:choose>
2943
+ <xsl:if test="string-length($text) &gt; 1">
2944
+ <xsl:call-template name="recursiveSmallCaps">
2945
+ <xsl:with-param name="text" select="substring($text,2)"/>
2946
+ </xsl:call-template>
2947
+ </xsl:if>
2948
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="tokenize">
2949
+ <xsl:param name="text"/>
2950
+ <xsl:param name="separator" select="' '"/>
2951
+ <xsl:choose>
2952
+ <xsl:when test="not(contains($text, $separator))">
2953
+ <word>
2954
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
2955
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
2956
+ <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
2957
+ <xsl:variable name="len_str">
2958
+ <xsl:choose>
2959
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
2960
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
2961
+ </xsl:when>
2962
+ <xsl:otherwise>
2963
+ <xsl:value-of select="$len_str_tmp"/>
2964
+ </xsl:otherwise>
2965
+ </xsl:choose>
2966
+ </xsl:variable>
2967
+
2968
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
2969
+ <xsl:message>
2970
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
2971
+ len_str=<xsl:value-of select="$len_str"/>
2972
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
2973
+ </xsl:message>
2974
+ </xsl:if> -->
2975
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
2976
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
2977
+ <xsl:choose>
2978
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
2979
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
2980
+ </xsl:when>
2981
+ <xsl:otherwise>
2982
+ <xsl:value-of select="$len_str"/>
2983
+ </xsl:otherwise>
2984
+ </xsl:choose>
2985
+ </word>
2986
+ </xsl:when>
2987
+ <xsl:otherwise>
2988
+ <word>
2989
+ <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
2990
+ </word>
2991
+ <xsl:call-template name="tokenize">
2992
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
2993
+ </xsl:call-template>
2994
+ </xsl:otherwise>
2995
+ </xsl:choose>
2996
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="max_length">
2997
+ <xsl:param name="words"/>
2998
+ <xsl:for-each select="$words//word">
2999
+ <xsl:sort select="." data-type="number" order="descending"/>
3000
+ <xsl:if test="position()=1">
3001
+ <xsl:value-of select="."/>
3002
+ </xsl:if>
3003
+ </xsl:for-each>
3004
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-java">
3005
+ <xsl:param name="text" select="."/>
3006
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3007
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3008
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces">
3009
+ <xsl:param name="text" select="."/>
3010
+ <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3011
+ <xsl:variable name="zero-space-after-dot">.</xsl:variable>
3012
+ <xsl:variable name="zero-space-after-colon">:</xsl:variable>
3013
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3014
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
3015
+ <xsl:variable name="zero-space">​</xsl:variable>
3016
+ <xsl:choose>
3017
+ <xsl:when test="contains($text, $zero-space-after-chars)">
3018
+ <xsl:value-of select="substring-before($text, $zero-space-after-chars)"/>
3019
+ <xsl:value-of select="$zero-space-after-chars"/>
3020
+ <xsl:value-of select="$zero-space"/>
3021
+ <xsl:call-template name="add-zero-spaces">
3022
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-chars)"/>
3023
+ </xsl:call-template>
3024
+ </xsl:when>
3025
+ <xsl:when test="contains($text, $zero-space-after-dot)">
3026
+ <xsl:value-of select="substring-before($text, $zero-space-after-dot)"/>
3027
+ <xsl:value-of select="$zero-space-after-dot"/>
3028
+ <xsl:value-of select="$zero-space"/>
3029
+ <xsl:call-template name="add-zero-spaces">
3030
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-dot)"/>
3031
+ </xsl:call-template>
3032
+ </xsl:when>
3033
+ <xsl:when test="contains($text, $zero-space-after-colon)">
3034
+ <xsl:value-of select="substring-before($text, $zero-space-after-colon)"/>
3035
+ <xsl:value-of select="$zero-space-after-colon"/>
3036
+ <xsl:value-of select="$zero-space"/>
3037
+ <xsl:call-template name="add-zero-spaces">
3038
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-colon)"/>
3039
+ </xsl:call-template>
3040
+ </xsl:when>
3041
+ <xsl:when test="contains($text, $zero-space-after-equal)">
3042
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3043
+ <xsl:value-of select="$zero-space-after-equal"/>
3044
+ <xsl:value-of select="$zero-space"/>
3045
+ <xsl:call-template name="add-zero-spaces">
3046
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3047
+ </xsl:call-template>
3048
+ </xsl:when>
3049
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
3050
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
3051
+ <xsl:value-of select="$zero-space-after-underscore"/>
3052
+ <xsl:value-of select="$zero-space"/>
3053
+ <xsl:call-template name="add-zero-spaces">
3054
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
3055
+ </xsl:call-template>
3056
+ </xsl:when>
3057
+ <xsl:otherwise>
3058
+ <xsl:value-of select="$text"/>
3059
+ </xsl:otherwise>
3060
+ </xsl:choose>
3061
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-equal">
3062
+ <xsl:param name="text" select="."/>
3063
+ <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3064
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3065
+ <xsl:variable name="zero-space">​</xsl:variable>
3066
+ <xsl:choose>
3067
+ <xsl:when test="contains($text, $zero-space-after-equals)">
3068
+ <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3069
+ <xsl:value-of select="$zero-space-after-equals"/>
3070
+ <xsl:value-of select="$zero-space"/>
3071
+ <xsl:call-template name="add-zero-spaces-equal">
3072
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3073
+ </xsl:call-template>
3074
+ </xsl:when>
3075
+ <xsl:when test="contains($text, $zero-space-after-equal)">
3076
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3077
+ <xsl:value-of select="$zero-space-after-equal"/>
3078
+ <xsl:value-of select="$zero-space"/>
3079
+ <xsl:call-template name="add-zero-spaces-equal">
3080
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3081
+ </xsl:call-template>
3082
+ </xsl:when>
3083
+ <xsl:otherwise>
3084
+ <xsl:value-of select="$text"/>
3085
+ </xsl:otherwise>
3086
+ </xsl:choose>
3087
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getSimpleTable">
3088
+ <xsl:variable name="simple-table">
3089
+
3090
+ <!-- Step 1. colspan processing -->
3091
+ <xsl:variable name="simple-table-colspan">
3092
+ <tbody>
3093
+ <xsl:apply-templates mode="simple-table-colspan"/>
3094
+ </tbody>
3095
+ </xsl:variable>
3096
+
3097
+ <!-- Step 2. rowspan processing -->
3098
+ <xsl:variable name="simple-table-rowspan">
3099
+ <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3100
+ </xsl:variable>
3101
+
3102
+ <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3103
+
3104
+ <!-- <xsl:choose>
3105
+ <xsl:when test="current()//*[local-name()='th'][@colspan] or current()//*[local-name()='td'][@colspan] ">
3106
+
3107
+ </xsl:when>
3108
+ <xsl:otherwise>
3109
+ <xsl:copy-of select="current()"/>
3110
+ </xsl:otherwise>
3111
+ </xsl:choose> -->
3112
+ </xsl:variable>
3113
+ <xsl:copy-of select="$simple-table"/>
3114
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3115
+ <xsl:apply-templates mode="simple-table-colspan"/>
3116
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3117
+ <xsl:choose>
3118
+ <xsl:when test="@colspan">
3119
+ <xsl:variable name="td">
3120
+ <xsl:element name="td">
3121
+ <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
3122
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3123
+ <xsl:apply-templates mode="simple-table-colspan"/>
3124
+ </xsl:element>
3125
+ </xsl:variable>
3126
+ <xsl:call-template name="repeatNode">
3127
+ <xsl:with-param name="count" select="@colspan"/>
3128
+ <xsl:with-param name="node" select="$td"/>
3129
+ </xsl:call-template>
3130
+ </xsl:when>
3131
+ <xsl:otherwise>
3132
+ <xsl:element name="td">
3133
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3134
+ <xsl:apply-templates mode="simple-table-colspan"/>
3135
+ </xsl:element>
3136
+ </xsl:otherwise>
3137
+ </xsl:choose>
3138
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']" mode="simple-table-colspan">
3139
+ <xsl:element name="tr">
3140
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3141
+ <xsl:apply-templates mode="simple-table-colspan"/>
3142
+ </xsl:element>
3143
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-colspan">
3144
+ <xsl:copy>
3145
+ <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3146
+ </xsl:copy>
3147
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="repeatNode">
3148
+ <xsl:param name="count"/>
3149
+ <xsl:param name="node"/>
3150
+
3151
+ <xsl:if test="$count &gt; 0">
3152
+ <xsl:call-template name="repeatNode">
3153
+ <xsl:with-param name="count" select="$count - 1"/>
3154
+ <xsl:with-param name="node" select="$node"/>
3155
+ </xsl:call-template>
3156
+ <xsl:copy-of select="$node"/>
3157
+ </xsl:if>
3158
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-rowspan">
3159
+ <xsl:copy>
3160
+ <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3161
+ </xsl:copy>
3162
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tbody" mode="simple-table-rowspan">
3163
+ <xsl:copy>
3164
+ <xsl:copy-of select="tr[1]"/>
3165
+ <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3166
+ <xsl:with-param name="previousRow" select="tr[1]"/>
3167
+ </xsl:apply-templates>
3168
+ </xsl:copy>
3169
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tr" mode="simple-table-rowspan">
3170
+ <xsl:param name="previousRow"/>
3171
+ <xsl:variable name="currentRow" select="."/>
3172
+
3173
+ <xsl:variable name="normalizedTDs">
3174
+ <xsl:for-each select="xalan:nodeset($previousRow)//td">
3175
+ <xsl:choose>
3176
+ <xsl:when test="@rowspan &gt; 1">
3177
+ <xsl:copy>
3178
+ <xsl:attribute name="rowspan">
3179
+ <xsl:value-of select="@rowspan - 1"/>
3180
+ </xsl:attribute>
3181
+ <xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
3182
+ <xsl:copy-of select="node()"/>
3183
+ </xsl:copy>
3184
+ </xsl:when>
3185
+ <xsl:otherwise>
3186
+ <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
3187
+ </xsl:otherwise>
3188
+ </xsl:choose>
3189
+ </xsl:for-each>
3190
+ </xsl:variable>
3191
+
3192
+ <xsl:variable name="newRow">
3193
+ <xsl:copy>
3194
+ <xsl:copy-of select="$currentRow/@*"/>
3195
+ <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
3196
+ </xsl:copy>
3197
+ </xsl:variable>
3198
+ <xsl:copy-of select="$newRow"/>
3199
+
3200
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3201
+ <xsl:with-param name="previousRow" select="$newRow"/>
3202
+ </xsl:apply-templates>
3203
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getLang">
3204
+ <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3205
+ <xsl:choose>
3206
+ <xsl:when test="$language = 'English'">en</xsl:when>
3207
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3208
+ </xsl:choose>
3209
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="capitalizeWords">
3210
+ <xsl:param name="str"/>
3211
+ <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3212
+ <xsl:choose>
3213
+ <xsl:when test="contains($str2, ' ')">
3214
+ <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3215
+ <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3216
+ <xsl:value-of select="substring($substr, 2)"/>
3217
+ <xsl:text> </xsl:text>
3218
+ <xsl:call-template name="capitalizeWords">
3219
+ <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3220
+ </xsl:call-template>
3221
+ </xsl:when>
3222
+ <xsl:otherwise>
3223
+ <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3224
+ <xsl:value-of select="substring($str2, 2)"/>
3225
+ </xsl:otherwise>
3226
+ </xsl:choose>
3227
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="mathml:math">
3228
+ <fo:inline font-family="STIX2Math">
3229
+ <fo:instream-foreign-object fox:alt-text="Math">
3230
+ <xsl:copy-of select="."/>
3231
+ </fo:instream-foreign-object>
3232
+ </fo:inline>
3233
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='localityStack']">
3234
+ <xsl:for-each select="*[local-name()='locality']">
3235
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3236
+ <xsl:apply-templates select="."/>
3237
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3238
+ </xsl:for-each>
3239
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" name="link">
3240
+ <xsl:variable name="target">
3241
+ <xsl:choose>
3242
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3243
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
3244
+ </xsl:when>
3245
+ <xsl:otherwise>
3246
+ <xsl:value-of select="normalize-space(@target)"/>
3247
+ </xsl:otherwise>
3248
+ </xsl:choose>
3249
+ </xsl:variable>
3250
+ <fo:inline xsl:use-attribute-sets="link-style">
3251
+ <xsl:choose>
3252
+ <xsl:when test="$target = ''">
3253
+ <xsl:apply-templates/>
3254
+ </xsl:when>
3255
+ <xsl:otherwise>
3256
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3257
+ <xsl:choose>
3258
+ <xsl:when test="normalize-space(.) = ''">
3259
+ <xsl:value-of select="$target"/>
3260
+ </xsl:when>
3261
+ <xsl:otherwise>
3262
+ <xsl:apply-templates/>
3263
+ </xsl:otherwise>
3264
+ </xsl:choose>
3265
+ </fo:basic-link>
3266
+ </xsl:otherwise>
3267
+ </xsl:choose>
3268
+ </fo:inline>
3269
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sourcecode']" name="sourcecode">
3270
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3271
+ <!-- <xsl:choose>
3272
+ <xsl:when test="@lang = 'en'"></xsl:when>
3273
+ <xsl:otherwise> -->
3274
+ <xsl:attribute name="white-space">pre</xsl:attribute>
3275
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
3276
+ <!-- </xsl:otherwise>
3277
+ </xsl:choose> -->
3278
+ <xsl:apply-templates/>
3279
+ </fo:block>
3280
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='bookmark']">
3281
+ <fo:inline id="{@id}"/>
3282
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']">
3283
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3284
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3285
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3286
+ </fo:block>
3287
+ <xsl:apply-templates/>
3288
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3289
+ <fo:inline><xsl:apply-templates/></fo:inline>
3290
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']">
3291
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
3292
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
3293
+ <xsl:value-of select="$title-example"/>
3294
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3295
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
3296
+ </xsl:if>
3297
+ <xsl:if test="*[local-name()='name']">
3298
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
3299
+ </xsl:if>
3300
+ </fo:block>
3301
+ <xsl:apply-templates/>
3302
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
3303
+ <fo:inline><xsl:apply-templates/></fo:inline>
3304
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'callout']">
3305
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3306
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']">
3307
+ <xsl:variable name="annotation-id" select="@id"/>
3308
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3309
+ <fo:block id="{$annotation-id}" white-space="nowrap">
3310
+ <fo:inline>
3311
+ <xsl:apply-templates>
3312
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
3313
+ </xsl:apply-templates>
3314
+ </fo:inline>
3315
+ </fo:block>
3316
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3317
+ <xsl:param name="callout"/>
3318
+ <fo:inline id="{@id}">
3319
+ <!-- for first p in annotation, put <x> -->
3320
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3321
+ <xsl:apply-templates/>
3322
+ </fo:inline>
3323
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="convertDate">
3324
+ <xsl:param name="date"/>
3325
+ <xsl:param name="format" select="'short'"/>
3326
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
3327
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
3328
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
3329
+ <xsl:variable name="monthStr">
3330
+ <xsl:choose>
3331
+ <xsl:when test="$month = '01'">January</xsl:when>
3332
+ <xsl:when test="$month = '02'">February</xsl:when>
3333
+ <xsl:when test="$month = '03'">March</xsl:when>
3334
+ <xsl:when test="$month = '04'">April</xsl:when>
3335
+ <xsl:when test="$month = '05'">May</xsl:when>
3336
+ <xsl:when test="$month = '06'">June</xsl:when>
3337
+ <xsl:when test="$month = '07'">July</xsl:when>
3338
+ <xsl:when test="$month = '08'">August</xsl:when>
3339
+ <xsl:when test="$month = '09'">September</xsl:when>
3340
+ <xsl:when test="$month = '10'">October</xsl:when>
3341
+ <xsl:when test="$month = '11'">November</xsl:when>
3342
+ <xsl:when test="$month = '12'">December</xsl:when>
3343
+ </xsl:choose>
3344
+ </xsl:variable>
3345
+ <xsl:variable name="result">
3346
+ <xsl:choose>
3347
+ <xsl:when test="$format = 'short' or $day = ''">
3348
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
3349
+ </xsl:when>
3350
+ <xsl:otherwise>
3351
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
3352
+ </xsl:otherwise>
3353
+ </xsl:choose>
3354
+ </xsl:variable>
3355
+ <xsl:value-of select="$result"/>
3356
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeywords">
3357
+ <xsl:param name="sorting" select="'true'"/>
3358
+ <xsl:param name="charAtEnd" select="'.'"/>
3359
+ <xsl:param name="charDelim" select="', '"/>
3360
+ <xsl:choose>
3361
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
3362
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3363
+ <xsl:sort data-type="text" order="ascending"/>
3364
+ <xsl:call-template name="insertKeyword">
3365
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3366
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3367
+ </xsl:call-template>
3368
+ </xsl:for-each>
3369
+ </xsl:when>
3370
+ <xsl:otherwise>
3371
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3372
+ <xsl:call-template name="insertKeyword">
3373
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3374
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3375
+ </xsl:call-template>
3376
+ </xsl:for-each>
3377
+ </xsl:otherwise>
3378
+ </xsl:choose>
3379
+ </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeyword">
3380
+ <xsl:param name="charAtEnd"/>
3381
+ <xsl:param name="charDelim"/>
3382
+ <xsl:apply-templates/>
3383
+ <xsl:choose>
3384
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3385
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3386
+ </xsl:choose>
3387
+ </xsl:template></xsl:stylesheet>