metanorma-iso 2.1.9 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 736603eaeed361ebf56fc8903c4d25db5a5a38639bce84a8a27923929d5c591d
4
- data.tar.gz: fa9c3e2707ed1642cbbd934061c556c8bf7613d5d88575cd35bf86b84ed9ce8e
3
+ metadata.gz: 64ff031dbcbae3aeb600c99c3c200b27983e96d865a49c52413245c470885824
4
+ data.tar.gz: 81ea3cfa5672feae8e31aff1341224310f15f85d74d85a0ca017e3ceba829421
5
5
  SHA512:
6
- metadata.gz: 23dbd404fb1b7745a787f7c70f7f7d3885b499b4329c49f821bc7e81361eed76c7378539c973b596b5b033801757081c152069e467267c566f4de14fb56d471e
7
- data.tar.gz: 975d364c1c59be33c513cb5f010d1b393dd9ff33d336816f8433ca5bfccbf09d94137212fd642737c4c1303815099857acf8518bc28d443256ce95b744905d29
6
+ metadata.gz: fdb2b2f7a30d439df33decf4e0f97fedf91f7545aa7ee7f1c43e9a4a66b21ef942ddb7e9f77520ebdbb68dcc509332e0651a866f2ec33e98835e70c67f641546
7
+ data.tar.gz: 03500425f5f236f69010d688aaa906719f52eac6695d4dbe1ed78d6b63e6d2943a8b2299f8d19a05ae18570deb6f3d22b380a6f1b69da4d386d2d817da42273e
@@ -78,3 +78,5 @@ requirements:
78
78
  modspec:
79
79
  description: Description
80
80
  provisions: Provisions
81
+ conformancetests: Conformance tests
82
+ # pending proper handling of inflection
@@ -72,4 +72,4 @@ requirements:
72
72
  modspec:
73
73
  description: Description
74
74
  provisions: Dispositions
75
-
75
+ conformancetests: Tests de conformité
@@ -73,4 +73,3 @@ requirements:
73
73
  modspec:
74
74
  description: 描述
75
75
  provisions: 条件
76
-
@@ -6,8 +6,8 @@ require_relative "i18n"
6
6
  module IsoDoc
7
7
  module Iso
8
8
  module Init
9
- def metadata_init(lang, script, i18n)
10
- @meta = Metadata.new(lang, script, i18n)
9
+ def metadata_init(lang, script, locale, i18n)
10
+ @meta = Metadata.new(lang, script, locale, i18n)
11
11
  end
12
12
 
13
13
  def xref_init(lang, script, _klass, i18n, options)
@@ -15,12 +15,13 @@ module IsoDoc
15
15
  @xrefs = Xref.new(lang, script, html, i18n, options)
16
16
  end
17
17
 
18
- def i18n_init(lang, script, i18nyaml = nil)
19
- @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
18
+ def i18n_init(lang, script, locale, i18nyaml = nil)
19
+ @i18n = I18n.new(lang, script, locale: locale,
20
+ i18nyaml: i18nyaml || @i18nyaml)
20
21
  end
21
22
 
22
23
  def amd(docxml)
23
- doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
24
+ doctype = docxml.at(ns("//bibdata/ext/doctype"))&.text
24
25
  %w(amendment technical-corrigendum).include? doctype
25
26
  end
26
27
 
@@ -39,14 +40,18 @@ module IsoDoc
39
40
  ids.map! do |i|
40
41
  if %w(GUIDE TR TS DIR).include?(i)
41
42
  "<span class='stddocNumber'>#{i}</span>"
42
- else
43
- i.sub(/^([^0-9]+)(\s|$)/, "<span class='stdpublisher'>\\1</span>\\2")
44
- .sub(/([0-9]+)/, "<span class='stddocNumber'>\\1</span>")
45
- .sub(/-([0-9]+)/, "-<span class='stddocPartNumber'>\\1</span>")
46
- .sub(/:([0-9]{4})(?!\d)/, ":<span class='stdyear'>\\1</span>")
43
+ else std_docid_semantic_full(i)
47
44
  end
48
45
  end.join(" ")
49
46
  end
47
+
48
+ def std_docid_semantic_full(ident)
49
+ ident
50
+ .sub(/^([^0-9]+)(\s|$)/, "<span class='stdpublisher'>\\1</span>\\2")
51
+ .sub(/([0-9]+)/, "<span class='stddocNumber'>\\1</span>")
52
+ .sub(/-([0-9]+)/, "-<span class='stddocPartNumber'>\\1</span>")
53
+ .sub(/:([0-9]{4})(?!\d)/, ":<span class='stdyear'>\\1</span>")
54
+ end
50
55
  end
51
56
  end
52
57
  end
@@ -4,7 +4,8 @@
4
4
 
5
5
  <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
6
6
 
7
- <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
7
+ <xsl:key name="attachments" match="iso:eref[java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" use="@bibitemid"/>
8
+ <xsl:key name="attachments2" match="iso:eref[contains(@bibitemid,'.exp_')]" use="@bibitemid"/>
8
9
 
9
10
  <xsl:variable name="namespace_full">https://www.metanorma.org/ns/iso</xsl:variable>
10
11
 
@@ -435,6 +436,15 @@
435
436
  <xsl:variable name="url" select="concat('url(file:',$basepath, @bibitemid, ')')"/>
436
437
  <pdf:embedded-file src="{$url}" filename="{@bibitemid}"/>
437
438
  </xsl:for-each>
439
+ <xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments2',@bibitemid)[1])]">
440
+ <xsl:variable name="bibitemid" select="@bibitemid"/>
441
+ <xsl:variable name="uri" select="normalize-space($bibitems/*[local-name() ='bibitem'][@hidden = 'true'][@id = $bibitemid][1]/*[local-name() = 'uri'][@type='citation'])"/>
442
+ <xsl:if test="$uri != ''">
443
+ <xsl:variable name="url" select="concat('url(file:',$basepath, $uri, ')')"/>
444
+ <xsl:variable name="filename" select="concat(substring-before($bibitemid, '.exp_'), '.exp')"/>
445
+ <pdf:embedded-file src="{$url}" filename="{$filename}"/>
446
+ </xsl:if>
447
+ </xsl:for-each>
438
448
  </fo:declarations>
439
449
 
440
450
  <xsl:call-template name="addBookmarks">
@@ -1414,7 +1424,23 @@
1414
1424
  </fo:page-sequence>
1415
1425
 
1416
1426
  <!-- Index -->
1417
- <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1427
+ <xsl:variable name="docid">
1428
+ <xsl:call-template name="getDocumentId"/>
1429
+ </xsl:variable>
1430
+
1431
+ <xsl:variable name="current_document_index_id">
1432
+ <xsl:apply-templates select="//iso:indexsect" mode="index_add_id">
1433
+ <xsl:with-param name="docid" select="$docid"/>
1434
+ </xsl:apply-templates>
1435
+
1436
+ </xsl:variable>
1437
+
1438
+ <xsl:variable name="current_document_index">
1439
+ <xsl:apply-templates select="xalan:nodeset($current_document_index_id)" mode="index_update"/>
1440
+ </xsl:variable>
1441
+
1442
+ <!-- <xsl:apply-templates select="//iso:indexsect" mode="index"/> -->
1443
+ <xsl:apply-templates select="xalan:nodeset($current_document_index)" mode="index"/>
1418
1444
 
1419
1445
  <xsl:if test="$isPublished = 'true'">
1420
1446
  <fo:page-sequence master-reference="last-page" force-page-count="no-force">
@@ -1920,7 +1946,7 @@
1920
1946
  </xsl:template>
1921
1947
 
1922
1948
  <!-- For express listings PDF attachments -->
1923
- <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
1949
+ <xsl:template match="*[local-name() = 'eref'][java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" priority="2">
1924
1950
  <fo:inline xsl:use-attribute-sets="eref-style">
1925
1951
  <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
1926
1952
  <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
@@ -1932,6 +1958,28 @@
1932
1958
  </fo:inline>
1933
1959
  </xsl:template>
1934
1960
 
1961
+ <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid,'.exp_')]" priority="2">
1962
+ <xsl:variable name="bibitemid" select="@bibitemid"/>
1963
+ <xsl:variable name="uri" select="normalize-space($bibitems/*[local-name() ='bibitem'][@hidden = 'true'][@id = $bibitemid][1]/*[local-name() = 'uri'][@type='citation'])"/>
1964
+ <xsl:choose>
1965
+ <xsl:when test="$uri != ''">
1966
+ <xsl:variable name="filename" select="concat(substring-before($bibitemid, '.exp_'), '.exp')"/>
1967
+ <fo:inline xsl:use-attribute-sets="eref-style">
1968
+ <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
1969
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
1970
+ <xsl:if test="normalize-space(@citeas) = ''">
1971
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
1972
+ </xsl:if>
1973
+ <xsl:apply-templates/>
1974
+ </fo:basic-link>
1975
+ </fo:inline>
1976
+ </xsl:when>
1977
+ <xsl:otherwise>
1978
+ <xsl:call-template name="eref"/>
1979
+ </xsl:otherwise>
1980
+ </xsl:choose>
1981
+ </xsl:template>
1982
+
1935
1983
  <!-- =================== -->
1936
1984
  <!-- Index processing -->
1937
1985
  <!-- =================== -->
@@ -8065,6 +8113,18 @@
8065
8113
  </xsl:copy>
8066
8114
  </xsl:template>
8067
8115
 
8116
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
8117
+ <xsl:copy>
8118
+ <xsl:apply-templates mode="contents_item"/>
8119
+ </xsl:copy>
8120
+ </xsl:template>
8121
+
8122
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
8123
+ <xsl:copy>
8124
+ <xsl:apply-templates mode="contents_item"/>
8125
+ </xsl:copy>
8126
+ </xsl:template>
8127
+
8068
8128
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
8069
8129
  <xsl:copy-of select="."/>
8070
8130
  </xsl:template>
@@ -9021,7 +9081,7 @@
9021
9081
  <!-- ====== -->
9022
9082
  <!-- eref -->
9023
9083
  <!-- ====== -->
9024
- <xsl:template match="*[local-name() = 'eref']">
9084
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
9025
9085
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
9026
9086
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
9027
9087
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -9515,21 +9575,29 @@
9515
9575
  </xsl:variable>
9516
9576
 
9517
9577
  <xsl:template match="@*|node()" mode="index_add_id">
9578
+ <xsl:param name="docid"/>
9518
9579
  <xsl:copy>
9519
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9580
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9581
+ <xsl:with-param name="docid" select="$docid"/>
9582
+ </xsl:apply-templates>
9520
9583
  </xsl:copy>
9521
9584
  </xsl:template>
9522
9585
 
9523
9586
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9587
+ <xsl:param name="docid"/>
9524
9588
  <xsl:variable name="id">
9525
- <xsl:call-template name="generateIndexXrefId"/>
9589
+ <xsl:call-template name="generateIndexXrefId">
9590
+ <xsl:with-param name="docid" select="$docid"/>
9591
+ </xsl:call-template>
9526
9592
  </xsl:variable>
9527
9593
  <xsl:copy> <!-- add id to xref -->
9528
9594
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9529
9595
  <xsl:attribute name="id">
9530
9596
  <xsl:value-of select="$id"/>
9531
9597
  </xsl:attribute>
9532
- <xsl:apply-templates mode="index_add_id"/>
9598
+ <xsl:apply-templates mode="index_add_id">
9599
+ <xsl:with-param name="docid" select="$docid"/>
9600
+ </xsl:apply-templates>
9533
9601
  </xsl:copy>
9534
9602
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9535
9603
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9541,7 +9609,9 @@
9541
9609
  <xsl:attribute name="id">
9542
9610
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9543
9611
  </xsl:attribute>
9544
- <xsl:apply-templates mode="index_add_id"/>
9612
+ <xsl:apply-templates mode="index_add_id">
9613
+ <xsl:with-param name="docid" select="$docid"/>
9614
+ </xsl:apply-templates>
9545
9615
  </xsl:copy>
9546
9616
  </xsl:if>
9547
9617
  </xsl:template>
@@ -9578,12 +9648,33 @@
9578
9648
  </xsl:when>
9579
9649
  <xsl:when test="self::* and local-name(.) = 'xref'">
9580
9650
  <xsl:variable name="id" select="@id"/>
9581
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9582
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9583
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9584
9651
 
9652
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9585
9653
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9586
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9654
+
9655
+ <xsl:variable name="pages_">
9656
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9657
+ <xsl:choose>
9658
+ <xsl:when test="@id = $id">
9659
+ <page><xsl:value-of select="."/></page>
9660
+ </xsl:when>
9661
+ <xsl:when test="@id = $id_next">
9662
+ <page_next><xsl:value-of select="."/></page_next>
9663
+ </xsl:when>
9664
+ <xsl:when test="@id = $id_prev">
9665
+ <page_prev><xsl:value-of select="."/></page_prev>
9666
+ </xsl:when>
9667
+ </xsl:choose>
9668
+ </xsl:for-each>
9669
+ </xsl:variable>
9670
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9671
+
9672
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9673
+ <xsl:variable name="page" select="$pages/page"/>
9674
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9675
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9676
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9677
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9587
9678
 
9588
9679
  <xsl:choose>
9589
9680
  <!-- 2nd pass -->
@@ -9643,16 +9734,20 @@
9643
9734
  </xsl:template>
9644
9735
 
9645
9736
  <xsl:template name="generateIndexXrefId">
9737
+ <xsl:param name="docid"/>
9738
+
9646
9739
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9647
9740
 
9648
- <xsl:variable name="docid">
9649
- <xsl:call-template name="getDocumentId"/>
9741
+ <xsl:variable name="docid_curr">
9742
+ <xsl:value-of select="$docid"/>
9743
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9650
9744
  </xsl:variable>
9745
+
9651
9746
  <xsl:variable name="item_number">
9652
9747
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9653
9748
  </xsl:variable>
9654
9749
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9655
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9750
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9656
9751
  </xsl:template>
9657
9752
 
9658
9753
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -4,7 +4,8 @@
4
4
 
5
5
  <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
6
6
 
7
- <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
7
+ <xsl:key name="attachments" match="iso:eref[java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" use="@bibitemid"/>
8
+ <xsl:key name="attachments2" match="iso:eref[contains(@bibitemid,'.exp_')]" use="@bibitemid"/>
8
9
 
9
10
  <xsl:variable name="namespace_full">https://www.metanorma.org/ns/iso</xsl:variable>
10
11
 
@@ -435,6 +436,15 @@
435
436
  <xsl:variable name="url" select="concat('url(file:',$basepath, @bibitemid, ')')"/>
436
437
  <pdf:embedded-file src="{$url}" filename="{@bibitemid}"/>
437
438
  </xsl:for-each>
439
+ <xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments2',@bibitemid)[1])]">
440
+ <xsl:variable name="bibitemid" select="@bibitemid"/>
441
+ <xsl:variable name="uri" select="normalize-space($bibitems/*[local-name() ='bibitem'][@hidden = 'true'][@id = $bibitemid][1]/*[local-name() = 'uri'][@type='citation'])"/>
442
+ <xsl:if test="$uri != ''">
443
+ <xsl:variable name="url" select="concat('url(file:',$basepath, $uri, ')')"/>
444
+ <xsl:variable name="filename" select="concat(substring-before($bibitemid, '.exp_'), '.exp')"/>
445
+ <pdf:embedded-file src="{$url}" filename="{$filename}"/>
446
+ </xsl:if>
447
+ </xsl:for-each>
438
448
  </fo:declarations>
439
449
 
440
450
  <xsl:call-template name="addBookmarks">
@@ -1414,7 +1424,23 @@
1414
1424
  </fo:page-sequence>
1415
1425
 
1416
1426
  <!-- Index -->
1417
- <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1427
+ <xsl:variable name="docid">
1428
+ <xsl:call-template name="getDocumentId"/>
1429
+ </xsl:variable>
1430
+
1431
+ <xsl:variable name="current_document_index_id">
1432
+ <xsl:apply-templates select="//iso:indexsect" mode="index_add_id">
1433
+ <xsl:with-param name="docid" select="$docid"/>
1434
+ </xsl:apply-templates>
1435
+
1436
+ </xsl:variable>
1437
+
1438
+ <xsl:variable name="current_document_index">
1439
+ <xsl:apply-templates select="xalan:nodeset($current_document_index_id)" mode="index_update"/>
1440
+ </xsl:variable>
1441
+
1442
+ <!-- <xsl:apply-templates select="//iso:indexsect" mode="index"/> -->
1443
+ <xsl:apply-templates select="xalan:nodeset($current_document_index)" mode="index"/>
1418
1444
 
1419
1445
  <xsl:if test="$isPublished = 'true'">
1420
1446
  <fo:page-sequence master-reference="last-page" force-page-count="no-force">
@@ -1920,7 +1946,7 @@
1920
1946
  </xsl:template>
1921
1947
 
1922
1948
  <!-- For express listings PDF attachments -->
1923
- <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
1949
+ <xsl:template match="*[local-name() = 'eref'][java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" priority="2">
1924
1950
  <fo:inline xsl:use-attribute-sets="eref-style">
1925
1951
  <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
1926
1952
  <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
@@ -1932,6 +1958,28 @@
1932
1958
  </fo:inline>
1933
1959
  </xsl:template>
1934
1960
 
1961
+ <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid,'.exp_')]" priority="2">
1962
+ <xsl:variable name="bibitemid" select="@bibitemid"/>
1963
+ <xsl:variable name="uri" select="normalize-space($bibitems/*[local-name() ='bibitem'][@hidden = 'true'][@id = $bibitemid][1]/*[local-name() = 'uri'][@type='citation'])"/>
1964
+ <xsl:choose>
1965
+ <xsl:when test="$uri != ''">
1966
+ <xsl:variable name="filename" select="concat(substring-before($bibitemid, '.exp_'), '.exp')"/>
1967
+ <fo:inline xsl:use-attribute-sets="eref-style">
1968
+ <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
1969
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
1970
+ <xsl:if test="normalize-space(@citeas) = ''">
1971
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
1972
+ </xsl:if>
1973
+ <xsl:apply-templates/>
1974
+ </fo:basic-link>
1975
+ </fo:inline>
1976
+ </xsl:when>
1977
+ <xsl:otherwise>
1978
+ <xsl:call-template name="eref"/>
1979
+ </xsl:otherwise>
1980
+ </xsl:choose>
1981
+ </xsl:template>
1982
+
1935
1983
  <!-- =================== -->
1936
1984
  <!-- Index processing -->
1937
1985
  <!-- =================== -->
@@ -8065,6 +8113,18 @@
8065
8113
  </xsl:copy>
8066
8114
  </xsl:template>
8067
8115
 
8116
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
8117
+ <xsl:copy>
8118
+ <xsl:apply-templates mode="contents_item"/>
8119
+ </xsl:copy>
8120
+ </xsl:template>
8121
+
8122
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
8123
+ <xsl:copy>
8124
+ <xsl:apply-templates mode="contents_item"/>
8125
+ </xsl:copy>
8126
+ </xsl:template>
8127
+
8068
8128
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
8069
8129
  <xsl:copy-of select="."/>
8070
8130
  </xsl:template>
@@ -9021,7 +9081,7 @@
9021
9081
  <!-- ====== -->
9022
9082
  <!-- eref -->
9023
9083
  <!-- ====== -->
9024
- <xsl:template match="*[local-name() = 'eref']">
9084
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
9025
9085
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
9026
9086
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
9027
9087
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -9515,21 +9575,29 @@
9515
9575
  </xsl:variable>
9516
9576
 
9517
9577
  <xsl:template match="@*|node()" mode="index_add_id">
9578
+ <xsl:param name="docid"/>
9518
9579
  <xsl:copy>
9519
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9580
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9581
+ <xsl:with-param name="docid" select="$docid"/>
9582
+ </xsl:apply-templates>
9520
9583
  </xsl:copy>
9521
9584
  </xsl:template>
9522
9585
 
9523
9586
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9587
+ <xsl:param name="docid"/>
9524
9588
  <xsl:variable name="id">
9525
- <xsl:call-template name="generateIndexXrefId"/>
9589
+ <xsl:call-template name="generateIndexXrefId">
9590
+ <xsl:with-param name="docid" select="$docid"/>
9591
+ </xsl:call-template>
9526
9592
  </xsl:variable>
9527
9593
  <xsl:copy> <!-- add id to xref -->
9528
9594
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9529
9595
  <xsl:attribute name="id">
9530
9596
  <xsl:value-of select="$id"/>
9531
9597
  </xsl:attribute>
9532
- <xsl:apply-templates mode="index_add_id"/>
9598
+ <xsl:apply-templates mode="index_add_id">
9599
+ <xsl:with-param name="docid" select="$docid"/>
9600
+ </xsl:apply-templates>
9533
9601
  </xsl:copy>
9534
9602
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9535
9603
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9541,7 +9609,9 @@
9541
9609
  <xsl:attribute name="id">
9542
9610
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9543
9611
  </xsl:attribute>
9544
- <xsl:apply-templates mode="index_add_id"/>
9612
+ <xsl:apply-templates mode="index_add_id">
9613
+ <xsl:with-param name="docid" select="$docid"/>
9614
+ </xsl:apply-templates>
9545
9615
  </xsl:copy>
9546
9616
  </xsl:if>
9547
9617
  </xsl:template>
@@ -9578,12 +9648,33 @@
9578
9648
  </xsl:when>
9579
9649
  <xsl:when test="self::* and local-name(.) = 'xref'">
9580
9650
  <xsl:variable name="id" select="@id"/>
9581
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9582
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9583
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9584
9651
 
9652
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9585
9653
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9586
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9654
+
9655
+ <xsl:variable name="pages_">
9656
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9657
+ <xsl:choose>
9658
+ <xsl:when test="@id = $id">
9659
+ <page><xsl:value-of select="."/></page>
9660
+ </xsl:when>
9661
+ <xsl:when test="@id = $id_next">
9662
+ <page_next><xsl:value-of select="."/></page_next>
9663
+ </xsl:when>
9664
+ <xsl:when test="@id = $id_prev">
9665
+ <page_prev><xsl:value-of select="."/></page_prev>
9666
+ </xsl:when>
9667
+ </xsl:choose>
9668
+ </xsl:for-each>
9669
+ </xsl:variable>
9670
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9671
+
9672
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9673
+ <xsl:variable name="page" select="$pages/page"/>
9674
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9675
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9676
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9677
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9587
9678
 
9588
9679
  <xsl:choose>
9589
9680
  <!-- 2nd pass -->
@@ -9643,16 +9734,20 @@
9643
9734
  </xsl:template>
9644
9735
 
9645
9736
  <xsl:template name="generateIndexXrefId">
9737
+ <xsl:param name="docid"/>
9738
+
9646
9739
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9647
9740
 
9648
- <xsl:variable name="docid">
9649
- <xsl:call-template name="getDocumentId"/>
9741
+ <xsl:variable name="docid_curr">
9742
+ <xsl:value-of select="$docid"/>
9743
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9650
9744
  </xsl:variable>
9745
+
9651
9746
  <xsl:variable name="item_number">
9652
9747
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9653
9748
  </xsl:variable>
9654
9749
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9655
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9750
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9656
9751
  </xsl:template>
9657
9752
 
9658
9753
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -3,7 +3,7 @@ require "isodoc"
3
3
  module IsoDoc
4
4
  module Iso
5
5
  class Metadata < IsoDoc::Metadata
6
- def initialize(lang, script, i18n)
6
+ def initialize(lang, script, locale, i18n)
7
7
  super
8
8
  DATETYPES.each { |w| @metadata["#{w.gsub(/-/, '_')}date".to_sym] = nil }
9
9
  set(:editorialgroup, [])
@@ -54,6 +54,7 @@ module IsoDoc
54
54
  target&.gsub(/<[^>]+>/, "")&.match(/^IEV$|^IEC 60050-/)
55
55
  end
56
56
 
57
+ # ISO has not bothered to communicate to us what most of these span classes mean
57
58
  LOCALITY2SPAN = {
58
59
  annex: "citeapp",
59
60
  dunno: "citebase",
@@ -196,6 +196,12 @@ module IsoDoc
196
196
  end
197
197
  end
198
198
 
199
+ def table_attrs(node)
200
+ ret = super
201
+ node["class"] == "modspec" and ret[:width] = "100%"
202
+ ret
203
+ end
204
+
199
205
  include BaseConvert
200
206
  include Init
201
207
  end