Skip to content

Commit 6fd3ebe

Browse files
author
Sanders Kleinfeld
committed
Fixed bugs in handling of formal object labeling (figure/table/example) in use cases with Parts.
1 parent 6e3deac commit 6fd3ebe

File tree

2 files changed

+378
-48
lines changed

2 files changed

+378
-48
lines changed

htmlbook-xsl/common.xsl

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@
9898
</xsl:template>
9999

100100
<xsl:template match="h:table" mode="label.markup">
101+
<xsl:param name="label.formal.with.ancestor" select="$label.formal.with.ancestor"/>
101102
<xsl:choose>
102103
<xsl:when test="$label.formal.with.ancestor != 0">
103-
<xsl:apply-templates select="ancestor::h:section[contains(@data-type, 'acknowledgments') or
104+
<xsl:apply-templates select="(ancestor::h:section[contains(@data-type, 'acknowledgments') or
104105
contains(@data-type, 'afterword') or
105106
contains(@data-type, 'appendix') or
106107
contains(@data-type, 'bibliography') or
@@ -116,25 +117,27 @@
116117
contains(@data-type, 'introduction') or
117118
contains(@data-type, 'preface') or
118119
contains(@data-type, 'titlepage') or
119-
contains(@data-type, 'toc')][last()]" mode="label.markup"/>
120+
contains(@data-type, 'toc')]|
121+
ancestor::h:div[@data-type = 'part'])[last()]" mode="label.markup"/>
120122
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
121123
<xsl:number count="h:table" from="h:section[contains(@data-type, 'acknowledgments') or
122-
contains(@data-type, 'afterword') or
123-
contains(@data-type, 'appendix') or
124-
contains(@data-type, 'bibliography') or
125-
contains(@data-type, 'chapter') or
126-
contains(@data-type, 'colophon') or
127-
contains(@data-type, 'conclusion') or
128-
contains(@data-type, 'copyright-page') or
129-
contains(@data-type, 'dedication') or
130-
contains(@data-type, 'foreword') or
131-
contains(@data-type, 'glossary') or
132-
contains(@data-type, 'halftitlepage') or
133-
contains(@data-type, 'index') or
134-
contains(@data-type, 'introduction') or
135-
contains(@data-type, 'preface') or
136-
contains(@data-type, 'titlepage') or
137-
contains(@data-type, 'toc')]" level="any" format="1"/>
124+
contains(@data-type, 'afterword') or
125+
contains(@data-type, 'appendix') or
126+
contains(@data-type, 'bibliography') or
127+
contains(@data-type, 'chapter') or
128+
contains(@data-type, 'colophon') or
129+
contains(@data-type, 'conclusion') or
130+
contains(@data-type, 'copyright-page') or
131+
contains(@data-type, 'dedication') or
132+
contains(@data-type, 'foreword') or
133+
contains(@data-type, 'glossary') or
134+
contains(@data-type, 'halftitlepage') or
135+
contains(@data-type, 'index') or
136+
contains(@data-type, 'introduction') or
137+
contains(@data-type, 'preface') or
138+
contains(@data-type, 'titlepage') or
139+
contains(@data-type, 'toc')]|
140+
h:div[contains(@data-type, 'part')]" level="any" format="1"/>
138141
</xsl:when>
139142
<xsl:otherwise>
140143
<xsl:number count="h:table" level="any" format="1"/>
@@ -181,7 +184,8 @@
181184
contains(@data-type, 'introduction') or
182185
contains(@data-type, 'preface') or
183186
contains(@data-type, 'titlepage') or
184-
contains(@data-type, 'toc')]" level="any" format="1"/>
187+
contains(@data-type, 'toc')]|
188+
h:div[contains(@data-type, 'part')]" level="any" format="1"/>
185189
</xsl:when>
186190
<xsl:otherwise>
187191
<xsl:number count="h:figure[not(contains(@data-type, 'cover'))]" level="any" format="1"/>
@@ -190,9 +194,10 @@
190194
</xsl:template>
191195

192196
<xsl:template match="h:div[contains(@data-type, 'example')]" mode="label.markup">
197+
<xsl:param name="label.formal.with.ancestor" select="$label.formal.with.ancestor"/>
193198
<xsl:choose>
194199
<xsl:when test="$label.formal.with.ancestor != 0">
195-
<xsl:apply-templates select="ancestor::h:section[contains(@data-type, 'acknowledgments') or
200+
<xsl:apply-templates select="(ancestor::h:section[contains(@data-type, 'acknowledgments') or
196201
contains(@data-type, 'afterword') or
197202
contains(@data-type, 'appendix') or
198203
contains(@data-type, 'bibliography') or
@@ -208,25 +213,27 @@
208213
contains(@data-type, 'introduction') or
209214
contains(@data-type, 'preface') or
210215
contains(@data-type, 'titlepage') or
211-
contains(@data-type, 'toc')][last()]" mode="label.markup"/>
216+
contains(@data-type, 'toc')]|
217+
ancestor::h:div[@data-type = 'part'])[last()]" mode="label.markup"/>
212218
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
213-
<xsl:number count="h:div[contains(@data-type, 'example')]" from="h:section[contains(@data-type, 'acknowledgments') or
214-
contains(@data-type, 'afterword') or
215-
contains(@data-type, 'appendix') or
216-
contains(@data-type, 'bibliography') or
217-
contains(@data-type, 'chapter') or
218-
contains(@data-type, 'colophon') or
219-
contains(@data-type, 'conclusion') or
220-
contains(@data-type, 'copyright-page') or
221-
contains(@data-type, 'dedication') or
222-
contains(@data-type, 'foreword') or
223-
contains(@data-type, 'glossary') or
224-
contains(@data-type, 'halftitlepage') or
225-
contains(@data-type, 'index') or
226-
contains(@data-type, 'introduction') or
227-
contains(@data-type, 'preface') or
228-
contains(@data-type, 'titlepage') or
229-
contains(@data-type, 'toc')]" level="any" format="1"/>
219+
<xsl:number count="h:div[@data-type='example']" from="h:section[contains(@data-type, 'acknowledgments') or
220+
contains(@data-type, 'afterword') or
221+
contains(@data-type, 'appendix') or
222+
contains(@data-type, 'bibliography') or
223+
contains(@data-type, 'chapter') or
224+
contains(@data-type, 'colophon') or
225+
contains(@data-type, 'conclusion') or
226+
contains(@data-type, 'copyright-page') or
227+
contains(@data-type, 'dedication') or
228+
contains(@data-type, 'foreword') or
229+
contains(@data-type, 'glossary') or
230+
contains(@data-type, 'halftitlepage') or
231+
contains(@data-type, 'index') or
232+
contains(@data-type, 'introduction') or
233+
contains(@data-type, 'preface') or
234+
contains(@data-type, 'titlepage') or
235+
contains(@data-type, 'toc')]|
236+
h:div[contains(@data-type, 'part')]" level="any" format="1"/>
230237
</xsl:when>
231238
<xsl:otherwise>
232239
<xsl:number count="h:div[contains(@data-type, 'example')]" level="any" format="1"/>

0 commit comments

Comments
 (0)