Merge pull request #360 from SamWhited/unique_ref_notes

Don't duplicate footnotes in HTML
This commit is contained in:
Florian Schmaus 2017-01-11 13:28:09 +01:00 committed by GitHub
commit ee2544758c
1 changed files with 25 additions and 30 deletions

15
xep.xsl
View File

@ -36,6 +36,7 @@ OR OTHER DEALINGS IN THE SOFTWARE.
<xsl:output doctype-public='-//W3C//DTD XHTML 1.0 Transitional//EN' doctype-system='http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd' method='xml'/>
<xsl:key name="unique-notes" match="note" use="text()" />
<xsl:template match='/'>
<html>
<head>
@ -397,7 +398,7 @@ OR OTHER DEALINGS IN THE SOFTWARE.
<a name="appendix-notes"></a>
<h3>Appendix G: Notes</h3>
<div class='indent'>
<xsl:apply-templates select='//note' mode='endlist'/>
<xsl:apply-templates select="//note[generate-id(.) = generate-id(key('unique-notes', text())[1])]" mode='endlist'/>
</div>
<!-- REVISION HISTORY -->
<hr />
@ -979,22 +980,16 @@ OR OTHER DEALINGS IN THE SOFTWARE.
<xsl:template match='note'>
<xsl:variable name='notenum'>
<xsl:number level='any' count='note'/>
<xsl:number level='any' count="note[generate-id(.) = generate-id(key('unique-notes', text())[1])]"/>
</xsl:variable>
<xsl:variable name='oid'>
<xsl:call-template name='object.id'/>
</xsl:variable>
<xsl:text> [</xsl:text><a href='#nt-{$oid}'>
<xsl:text> [</xsl:text><a href='#nt-{$notenum}'>
<xsl:value-of select='$notenum'/></a>
<xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match='note' mode='endlist'>
<p>
<xsl:variable name='oid'>
<xsl:call-template name='object.id'/>
</xsl:variable>
<a name='nt-{$oid}'><xsl:value-of select='position()'/></a>
<a name='nt-{position()}'><xsl:value-of select='position()'/></a>
<xsl:text>. </xsl:text>
<xsl:apply-templates/>
</p>