Skip to content

Commit

Permalink
Implement footnote references correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jelovirt committed Aug 29, 2015
1 parent d800754 commit cc725cb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
41 changes: 40 additions & 1 deletion docx/word/document.link.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,46 @@
</w:r>
</xsl:when>
<xsl:when test="@type = 'fn'">
<xsl:apply-templates select="$target"/>
<!--xsl:apply-templates select="$target"/-->
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:fldChar w:fldCharType="begin"/>
</w:r>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:instrText xml:space="preserve">
<xsl:text> NOTEREF _Note</xsl:text>
<xsl:value-of select="generate-id($target)"/>
<xsl:text> \h </xsl:text>
</w:instrText>
</w:r>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
</w:r>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:fldChar w:fldCharType="separate"/>
</w:r>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:t>0</w:t>
</w:r>
<w:r>
<w:rPr>
<w:rStyle w:val="FootnoteReference"/>
</w:rPr>
<w:fldChar w:fldCharType="end"/>
</w:r>
</xsl:when>
<xsl:when test="@type = 'fig'">
<xsl:apply-templates select="$target" mode="xref-prefix"/>
Expand Down
2 changes: 2 additions & 0 deletions docx/word/document.topic.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,9 @@ s <xsl:apply-templates select="*[contains(@class, ' topic/related-links ')]"/
</xsl:template>

<xsl:template match="*[contains(@class, ' topic/fn ')]" mode="x:get-footnote-reference">
<w:bookmarkStart w:id="note_{generate-id()}" w:name="_Note{generate-id()}"/>
<w:footnoteReference w:id="{@x:fn-number}"/>
<w:bookmarkEnd w:id="note_{generate-id()}"/>
</xsl:template>

<xsl:template match="*[contains(@class, ' topic/draft-comment ')]">
Expand Down

0 comments on commit cc725cb

Please sign in to comment.