metanorma-un 0.10.5 → 0.10.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1515,6 +1515,7 @@
1515
1515
  <xsl:attribute-set name="term-name-style">
1516
1516
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1517
1517
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1518
+
1518
1519
  </xsl:attribute-set>
1519
1520
 
1520
1521
  <xsl:attribute-set name="figure-block-style">
@@ -2471,7 +2472,7 @@
2471
2472
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2472
2473
  </xsl:when>
2473
2474
  <xsl:otherwise>
2474
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
2475
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
2475
2476
  </xsl:otherwise>
2476
2477
  </xsl:choose>
2477
2478
 
@@ -2971,7 +2972,7 @@
2971
2972
  <xsl:param name="colwidths"/>
2972
2973
  <xsl:param name="colgroup"/>
2973
2974
 
2974
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2975
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2975
2976
 
2976
2977
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
2977
2978
 
@@ -3039,6 +3040,7 @@
3039
3040
 
3040
3041
  <!-- except gb and bsi -->
3041
3042
 
3043
+ <xsl:apply-templates select="../*[local-name()='dl']"/>
3042
3044
  <xsl:apply-templates select="../*[local-name()='note']"/>
3043
3045
 
3044
3046
  <xsl:variable name="isDisplayRowSeparator">
@@ -3164,7 +3166,7 @@
3164
3166
  <!-- ===================== -->
3165
3167
  <!-- Table's row processing -->
3166
3168
  <!-- ===================== -->
3167
- <!-- row in table header (thead) -->
3169
+ <!-- row in table header (thead) thead/tr -->
3168
3170
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3169
3171
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3170
3172
 
@@ -3198,7 +3200,7 @@
3198
3200
  </xsl:choose>
3199
3201
  </xsl:template>
3200
3202
 
3201
- <!-- row in table footer (tfoot) -->
3203
+ <!-- row in table footer (tfoot), tfoot/tr -->
3202
3204
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
3203
3205
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
3204
3206
 
@@ -3682,6 +3684,8 @@
3682
3684
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3683
3685
  <fo:block-container>
3684
3686
 
3687
+ <xsl:call-template name="setBlockSpanAll"/>
3688
+
3685
3689
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3686
3690
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3687
3691
  </xsl:if>
@@ -5744,13 +5748,17 @@
5744
5748
  </xsl:template>
5745
5749
 
5746
5750
  <xsl:template match="*[local-name() = 'callout']">
5747
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
5751
+ <xsl:choose>
5752
+ <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
5753
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
5754
+ </xsl:choose>
5748
5755
  </xsl:template>
5749
5756
 
5750
5757
  <xsl:template match="*[local-name() = 'annotation']">
5751
5758
  <xsl:variable name="annotation-id" select="@id"/>
5752
5759
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
5753
5760
  <fo:block id="{$annotation-id}" white-space="nowrap">
5761
+
5754
5762
  <fo:inline>
5755
5763
  <xsl:apply-templates>
5756
5764
  <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
@@ -5860,6 +5868,10 @@
5860
5868
  <!-- ====== -->
5861
5869
  <!-- ====== -->
5862
5870
 
5871
+ <xsl:template name="setBlockSpanAll">
5872
+ <xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
5873
+ </xsl:template>
5874
+
5863
5875
  <!-- ====== -->
5864
5876
  <!-- note -->
5865
5877
  <!-- termnote -->
@@ -5869,6 +5881,8 @@
5869
5881
 
5870
5882
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
5871
5883
 
5884
+ <xsl:call-template name="setBlockSpanAll"/>
5885
+
5872
5886
  <fo:block-container margin-left="0mm" margin-right="0mm">
5873
5887
 
5874
5888
  <fo:block>
@@ -5928,6 +5942,8 @@
5928
5942
  <xsl:template match="*[local-name() = 'termnote']">
5929
5943
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
5930
5944
 
5945
+ <xsl:call-template name="setBlockSpanAll"/>
5946
+
5931
5947
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5932
5948
 
5933
5949
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
@@ -7840,6 +7856,9 @@
7840
7856
  <!-- ====== -->
7841
7857
  <xsl:template match="*[local-name() = 'termexample']">
7842
7858
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
7859
+
7860
+ <xsl:call-template name="setBlockSpanAll"/>
7861
+
7843
7862
  <xsl:apply-templates select="*[local-name()='name']"/>
7844
7863
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7845
7864
  </fo:block>
@@ -7891,6 +7910,8 @@
7891
7910
 
7892
7911
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
7893
7912
 
7913
+ <xsl:call-template name="setBlockSpanAll"/>
7914
+
7894
7915
  <xsl:variable name="fo_element">
7895
7916
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
7896
7917
  block
@@ -7918,6 +7939,35 @@
7918
7939
  </fo:block-container>
7919
7940
  </xsl:when> <!-- end block -->
7920
7941
 
7942
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
7943
+
7944
+ <xsl:variable name="provisional_distance_between_starts">
7945
+ 7
7946
+ </xsl:variable>
7947
+ <xsl:variable name="indent">
7948
+ 0
7949
+ </xsl:variable>
7950
+
7951
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
7952
+ <fo:list-item>
7953
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
7954
+ <fo:block>
7955
+ <xsl:apply-templates select="*[local-name()='name']">
7956
+ <xsl:with-param name="fo_element">block</xsl:with-param>
7957
+ </xsl:apply-templates>
7958
+ </fo:block>
7959
+ </fo:list-item-label>
7960
+ <fo:list-item-body start-indent="body-start()">
7961
+ <fo:block>
7962
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
7963
+ <xsl:with-param name="fo_element" select="$fo_element"/>
7964
+ </xsl:apply-templates>
7965
+ </fo:block>
7966
+ </fo:list-item-body>
7967
+ </fo:list-item>
7968
+ </fo:list-block>
7969
+ </xsl:when> <!-- end list -->
7970
+
7921
7971
  <xsl:otherwise> <!-- inline -->
7922
7972
 
7923
7973
  <!-- display 'EXAMPLE' and first element in the same line -->
@@ -7997,6 +8047,11 @@
7997
8047
  </fo:block>
7998
8048
  </fo:block-container>
7999
8049
  </xsl:when>
8050
+ <xsl:when test="starts-with(normalize-space($element), 'list')">
8051
+ <fo:block xsl:use-attribute-sets="example-p-style">
8052
+ <xsl:apply-templates/>
8053
+ </fo:block>
8054
+ </xsl:when>
8000
8055
  <xsl:otherwise>
8001
8056
  <fo:inline xsl:use-attribute-sets="example-p-style">
8002
8057
  <xsl:apply-templates/>
@@ -8114,6 +8169,9 @@
8114
8169
  <!-- ====== -->
8115
8170
  <xsl:template match="*[local-name() = 'quote']">
8116
8171
  <fo:block-container margin-left="0mm">
8172
+
8173
+ <xsl:call-template name="setBlockSpanAll"/>
8174
+
8117
8175
  <xsl:if test="parent::*[local-name() = 'note']">
8118
8176
  <xsl:if test="not(ancestor::*[local-name() = 'table'])">
8119
8177
  <xsl:attribute name="margin-left">5mm</xsl:attribute>
@@ -8403,6 +8461,8 @@
8403
8461
  <fo:block>
8404
8462
  <xsl:call-template name="setId"/>
8405
8463
 
8464
+ <xsl:call-template name="setBlockSpanAll"/>
8465
+
8406
8466
  <xsl:apply-templates/>
8407
8467
  </fo:block>
8408
8468
  </xsl:template>
@@ -8417,6 +8477,8 @@
8417
8477
  <fo:block break-after="page"/>
8418
8478
  <fo:block id="{@id}">
8419
8479
 
8480
+ <xsl:call-template name="setBlockSpanAll"/>
8481
+
8420
8482
  <xsl:variable name="num"><xsl:number/></xsl:variable>
8421
8483
  <xsl:if test="$num = 1">
8422
8484
  <xsl:attribute name="margin-top">3pt</xsl:attribute>
@@ -9360,6 +9422,8 @@
9360
9422
  <!-- text in the box -->
9361
9423
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
9362
9424
 
9425
+ <xsl:call-template name="setBlockSpanAll"/>
9426
+
9363
9427
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
9364
9428
 
9365
9429
  <fo:block-container margin-left="0mm" margin-right="0mm">
@@ -9537,6 +9601,16 @@
9537
9601
  <xsl:apply-templates mode="update_xml_step1"/>
9538
9602
  </xsl:copy>
9539
9603
  </xsl:template>
9604
+
9605
+ <!-- remove semantic xml -->
9606
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
9607
+
9608
+ <!-- remove image/emf -->
9609
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
9610
+
9611
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9612
+ <xsl:copy-of select="."/>
9613
+ </xsl:template>
9540
9614
  <!-- =========================================================================== -->
9541
9615
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9542
9616
  <!-- =========================================================================== -->
@@ -9558,7 +9632,7 @@
9558
9632
 
9559
9633
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
9560
9634
 
9561
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9635
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9562
9636
 
9563
9637
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9564
9638
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
@@ -9632,6 +9706,10 @@
9632
9706
 
9633
9707
  </xsl:template>
9634
9708
 
9709
+ <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
9710
+ <xsl:copy-of select="."/>
9711
+ </xsl:template>
9712
+
9635
9713
  <xsl:template name="replace_text_tags">
9636
9714
  <xsl:param name="tag_open"/>
9637
9715
  <xsl:param name="tag_close"/>
@@ -9658,6 +9736,194 @@
9658
9736
  <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9659
9737
  <!-- ===================================== -->
9660
9738
 
9739
+ <!-- ===================================== -->
9740
+ <!-- ===================================== -->
9741
+ <!-- Make linear XML (need for landscape orientation) -->
9742
+ <!-- ===================================== -->
9743
+ <!-- ===================================== -->
9744
+ <xsl:template match="@*|node()" mode="linear_xml">
9745
+ <xsl:copy>
9746
+ <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
9747
+ </xsl:copy>
9748
+ </xsl:template>
9749
+
9750
+ <xsl:template match="processing-instruction()" mode="linear_xml">
9751
+ <xsl:copy-of select="."/>
9752
+ </xsl:template>
9753
+
9754
+ <!-- From:
9755
+ <clause>
9756
+ <title>...</title>
9757
+ <p>...</p>
9758
+ </clause>
9759
+ To:
9760
+ <clause/>
9761
+ <title>...</title>
9762
+ <p>...</p>
9763
+ -->
9764
+ <xsl:template match="*[local-name() = 'foreword'] | *[local-name() = 'foreword']//*[local-name() = 'clause'] | *[local-name() = 'preface']//*[local-name() = 'clause'][not(@type = 'corrigenda') and not(@type = 'policy') and not(@type = 'related-refs')] | *[local-name() = 'introduction'] | *[local-name() = 'introduction']//*[local-name() = 'clause'] | *[local-name() = 'sections']//*[local-name() = 'clause'] | *[local-name() = 'annex'] | *[local-name() = 'annex']//*[local-name() = 'clause'] | *[local-name() = 'references'][not(@hidden = 'true')] | *[local-name() = 'bibliography']/*[local-name() = 'clause'] | *[local-name() = 'colophon'] | *[local-name() = 'colophon']//*[local-name() = 'clause'] | *[local-name()='sections']//*[local-name()='terms'] | *[local-name()='sections']//*[local-name()='definitions'] | *[local-name()='annex']//*[local-name()='definitions']" mode="linear_xml" name="clause_linear">
9765
+
9766
+ <xsl:copy>
9767
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9768
+
9769
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9770
+
9771
+ <xsl:if test="local-name() = 'foreword' or local-name() = 'introduction' or local-name(..) = 'preface' or local-name(..) = 'sections' or (local-name() = 'references' and parent::*[local-name() = 'bibliography']) or (local-name() = 'clause' and parent::*[local-name() = 'bibliography']) or local-name() = 'annex' or local-name(..) = 'annex' or local-name(..) = 'colophon'">
9772
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9773
+ </xsl:if>
9774
+ </xsl:copy>
9775
+
9776
+ <xsl:apply-templates mode="linear_xml"/>
9777
+ </xsl:template>
9778
+
9779
+ <xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
9780
+ <xsl:copy>
9781
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9782
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9783
+ <xsl:variable name="level">
9784
+ <xsl:call-template name="getLevel"/>
9785
+ </xsl:variable>
9786
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9787
+ <xsl:attribute name="ancestor">sections</xsl:attribute>
9788
+ <xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
9789
+ </xsl:copy>
9790
+ <xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
9791
+ </xsl:template>
9792
+
9793
+ <xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
9794
+ <xsl:copy>
9795
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9796
+
9797
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
9798
+
9799
+ <xsl:variable name="level">
9800
+ <xsl:call-template name="getLevel"/>
9801
+ </xsl:variable>
9802
+ <xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
9803
+
9804
+ <xsl:if test="parent::*[local-name() = 'annex']">
9805
+ <xsl:attribute name="depth">1</xsl:attribute>
9806
+ </xsl:if>
9807
+
9808
+ <xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
9809
+ <xsl:copy-of select="../@inline-header"/>
9810
+ </xsl:if>
9811
+
9812
+ <xsl:attribute name="ancestor">
9813
+ <xsl:choose>
9814
+ <xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
9815
+ <xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
9816
+ <xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
9817
+ <xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
9818
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
9819
+ </xsl:choose>
9820
+ </xsl:attribute>
9821
+
9822
+ <xsl:apply-templates mode="linear_xml"/>
9823
+ </xsl:copy>
9824
+ </xsl:template>
9825
+
9826
+ <!-- add @to = figure, table, clause -->
9827
+ <!-- add @depth = from -->
9828
+ <xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
9829
+ <xsl:copy>
9830
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9831
+ <xsl:variable name="target" select="@target"/>
9832
+ <xsl:attribute name="to">
9833
+ <xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
9834
+ </xsl:attribute>
9835
+ <xsl:attribute name="depth">
9836
+ <xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
9837
+ </xsl:attribute>
9838
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9839
+ </xsl:copy>
9840
+ </xsl:template>
9841
+
9842
+ <xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
9843
+ <xsl:choose>
9844
+ <xsl:when test="contains(., $non_breaking_hyphen)">
9845
+ <xsl:call-template name="replaceChar">
9846
+ <xsl:with-param name="text" select="."/>
9847
+ <xsl:with-param name="replace" select="$non_breaking_hyphen"/>
9848
+ <xsl:with-param name="by" select="'-'"/>
9849
+ </xsl:call-template>
9850
+ </xsl:when>
9851
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
9852
+ </xsl:choose>
9853
+ </xsl:template>
9854
+
9855
+ <xsl:template name="replaceChar">
9856
+ <xsl:param name="text"/>
9857
+ <xsl:param name="replace"/>
9858
+ <xsl:param name="by"/>
9859
+ <xsl:choose>
9860
+ <xsl:when test="$text = '' or $replace = '' or not($replace)">
9861
+ <xsl:value-of select="$text"/>
9862
+ </xsl:when>
9863
+ <xsl:when test="contains($text, $replace)">
9864
+ <xsl:value-of select="substring-before($text,$replace)"/>
9865
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
9866
+ <xsl:call-template name="replaceChar">
9867
+ <xsl:with-param name="text" select="substring-after($text,$replace)"/>
9868
+ <xsl:with-param name="replace" select="$replace"/>
9869
+ <xsl:with-param name="by" select="$by"/>
9870
+ </xsl:call-template>
9871
+ </xsl:when>
9872
+ <xsl:otherwise>
9873
+ <xsl:value-of select="$text"/>
9874
+ </xsl:otherwise>
9875
+ </xsl:choose>
9876
+ </xsl:template>
9877
+
9878
+ <xsl:template match="*[local-name() = 'inlineChar']">
9879
+ <fo:inline><xsl:value-of select="."/></fo:inline>
9880
+ </xsl:template>
9881
+
9882
+ <!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
9883
+ <!--
9884
+ <fn reference="1">
9885
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
9886
+ </fn>
9887
+ -->
9888
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
9889
+ <xsl:variable name="p_fn_">
9890
+ <xsl:call-template name="get_fn_list"/>
9891
+ </xsl:variable>
9892
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9893
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
9894
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9895
+ <xsl:variable name="reference" select="@reference"/>
9896
+ <!-- fn sequence number in document -->
9897
+ <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
9898
+
9899
+ <xsl:copy>
9900
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9901
+ <!-- put actual reference number -->
9902
+ <xsl:attribute name="current_fn_number">
9903
+ <xsl:value-of select="$current_fn_number"/>
9904
+ </xsl:attribute>
9905
+ <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
9906
+ <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
9907
+ </xsl:attribute>
9908
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9909
+ </xsl:copy>
9910
+ </xsl:template>
9911
+
9912
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
9913
+ <xsl:copy>
9914
+ <xsl:apply-templates select="@*" mode="linear_xml"/>
9915
+ <xsl:if test="@depth = '1'">
9916
+ <xsl:attribute name="mainsection">true</xsl:attribute>
9917
+ </xsl:if>
9918
+ <xsl:apply-templates select="node()" mode="linear_xml"/>
9919
+ </xsl:copy>
9920
+ </xsl:template>
9921
+ <!-- ===================================== -->
9922
+ <!-- ===================================== -->
9923
+ <!-- END: Make linear XML (need for landscape orientation) -->
9924
+ <!-- ===================================== -->
9925
+ <!-- ===================================== -->
9926
+
9661
9927
  <!-- for correct rendering combining chars -->
9662
9928
  <xsl:template match="*[local-name() = 'lang_none']">
9663
9929
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>