Skip to content

Commit b896f1d

Browse files
author
Sanders Kleinfeld
committed
Merge pull request #122 from oreillymedia/indexterms
Adding <spans> around index terms
2 parents 372f24c + 8e45475 commit b896f1d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

htmlbook-xsl/indexgen.xsl

+9-3
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@
226226
<xsl:variable name="key" select="normalize-space(concat(@data-primary-sortas, &quot; &quot;, @data-primary))"/>
227227
<xsl:variable name="refs" select="key('primary', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0)) and not(@data-startref)]"/>
228228
<li>
229-
<xsl:value-of select="@data-primary"/>
229+
<span data-type="index-term">
230+
<xsl:value-of select="@data-primary"/>
231+
</span>
230232
<xsl:choose>
231233
<xsl:when test="$index.links.to.section = 1">
232234
<xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('primary-section', concat($key, &quot; &quot;, generate-id((ancestor-or-self::h:body|ancestor-or-self::h:nav|ancestor-or-self::h:div[@data-type='part']|ancestor-or-self::h:section)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]">
@@ -288,7 +290,9 @@
288290
<xsl:variable name="key" select="concat(normalize-space(concat(@data-primary-sortas, &quot; &quot;, @data-primary)), &quot; &quot;, normalize-space(concat(@data-secondary-sortas, &quot; &quot;, @data-secondary)))"/>
289291
<xsl:variable name="refs" select="key('secondary', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0)) and not(@data-startref)]"/>
290292
<li>
291-
<xsl:value-of select="@data-secondary"/>
293+
<span data-type="index-term">
294+
<xsl:value-of select="@data-secondary"/>
295+
</span>
292296
<xsl:choose>
293297
<xsl:when test="$index.links.to.section = 1">
294298
<xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('secondary-section', concat($key, &quot; &quot;, generate-id((ancestor-or-self::h:body|ancestor-or-self::h:nav|ancestor-or-self::h:div[@data-type='part']|ancestor-or-self::h:section)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]">
@@ -350,7 +354,9 @@
350354
<xsl:variable name="key" select="concat(normalize-space(concat(@data-primary-sortas, &quot; &quot;, @data-primary)), &quot; &quot;, normalize-space(concat(@data-secondary-sortas, &quot; &quot;, @data-secondary)), &quot; &quot;, normalize-space(concat(@data-tertiary-sortas, &quot; &quot;, @data-tertiary)))"/>
351355
<xsl:variable name="refs" select="key('tertiary', $key)[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0)) and not(@data-startref)]"/>
352356
<li>
353-
<xsl:value-of select="@data-tertiary"/>
357+
<span data-type="index-term">
358+
<xsl:value-of select="@data-tertiary"/>
359+
</span>
354360
<xsl:choose>
355361
<xsl:when test="$index.links.to.section = 1">
356362
<xsl:for-each select="$refs[@zone != '' or generate-id() = generate-id(key('tertiary-section', concat($key, &quot; &quot;, generate-id((ancestor-or-self::h:body|ancestor-or-self::h:nav|ancestor-or-self::h:div[@data-type='part']|ancestor-or-self::h:section)[last()])))[count(ancestor::node()|$scope) = count(ancestor::node()) and ($role = @role or $type = @type or (string-length($role) = 0 and string-length($type) = 0))][1])]">

0 commit comments

Comments
 (0)