Skip to content

Commit c8cc57e

Browse files
committed
check for xml:lang
and count preceding divs for the section numbers accordingly #456
1 parent 6ada1c2 commit c8cc57e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

xsl/var.xsl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,18 @@
212212
<xsl:with-param name="dot" select="true()"/>
213213
</xsl:call-template>
214214
</xsl:if>
215-
<xsl:value-of select="count($div/preceding-sibling::tei:div[not(following::tei:divGen)][tei:head][ancestor-or-self::tei:div/@xml:lang=$lang]) + 1 +$offset"/>
215+
<xsl:variable name="preceding-divs" as="node()*">
216+
<!-- when xml:lang information is present only the respective divs need to be taken into account -->
217+
<xsl:choose>
218+
<xsl:when test="$div/ancestor-or-self::tei:div/@xml:lang">
219+
<xsl:sequence select="$div/preceding-sibling::tei:div[not(following::tei:divGen)][tei:head][ancestor-or-self::tei:div/@xml:lang=$lang]"/>
220+
</xsl:when>
221+
<xsl:otherwise>
222+
<xsl:sequence select="$div/preceding-sibling::tei:div[not(following::tei:divGen)][tei:head]"/>
223+
</xsl:otherwise>
224+
</xsl:choose>
225+
</xsl:variable>
226+
<xsl:value-of select="count($preceding-divs) + 1 +$offset"/>
216227
<xsl:if test="$dot">
217228
<xsl:text>.&#8201;</xsl:text>
218229
</xsl:if>

0 commit comments

Comments
 (0)