Html 本章末尾的脚注替换
在输入xml中,我在每个部分的每个段落中都没有脚注。我想在脚注可用的地方设置一个链接,我需要将所有脚注移动到html中的章节末尾 我正在粘贴我输入的一部分,供您参考Html 本章末尾的脚注替换,html,xslt,Html,Xslt,在输入xml中,我在每个部分的每个段落中都没有脚注。我想在脚注可用的地方设置一个链接,我需要将所有脚注移动到html中的章节末尾 我正在粘贴我输入的一部分,供您参考 <section level="1"> <heading class="hdgautonum1" level="1"><inline style="\-ilx-tab-stops: left blank 0tw; "><gentext type="headingnumberstring"&g
<section level="1">
<heading class="hdgautonum1" level="1"><inline style="\-ilx-tab-stops: left blank 0tw; "><gentext type="headingnumberstring">1 </gentext>Introduction</inline></heading>
<par class="para"><inline class="glossaryrefmain">ITIL</inline> is part of a suite of best-practice publications for <inline class="glossaryrefmain">IT service management</inline> (ITSM).<inline class="footnote reference"><footnote>
<par class="footnote text"> ITSM and other concepts from this chapter are described in more detail in Chapter 2.</par></footnote></inline> ITIL provides guidance to <inline class="glossaryrefmain">service provider</inline>s on the provision of quality</par>
</section>
1导言
ITIL是一套IT服务管理(ITSM)最佳实践出版物的一部分。
ITSM和本章中的其他概念在第2章中有更详细的描述。ITIL为服务提供商提供有关提供优质服务的指导
有什么想法吗 试试这个模板:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- copies all nodes -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- generate footnote link -->
<xsl:template match="footnote">
<xref>
<xsl:attribute name="rid">fn<xsl:number level="any" format="1"/></xsl:attribute>
<xsl:number level="any" format="1"/>
</xref>
</xsl:template>
<!-- removes container footnote reference, or you can retain them, just remove the comment marks o xsl:copy -->
<xsl:template match="inline[contains(@class, 'footnote')]">
<!--<xsl:copy>
<xsl:copy-of select="@*"/>-->
<xsl:apply-templates/>
<!--</xsl:copy>-->
</xsl:template>
<!-- moves all footnotes at the end -->
<xsl:template match="section">
<root>
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
<footnote-group>
<xsl:apply-templates select="//footnote" mode="group"/>
</footnote-group>
</root>
</xsl:template>
<!-- template to fix footnotes, in a different mode -->
<xsl:template match="footnote" mode="group">
<footnote>
<xsl:attribute name="id">fn<xsl:number level="any" format="1"/></xsl:attribute>
<label><xsl:number level="any" format="1"/></label>
<xsl:apply-templates/>
</footnote>
</xsl:template>
</xsl:stylesheet>
fn
fn
应用于输入XML时,它会输出:
<?xml version="1.0" encoding="utf-8"?>
<root>
<section level="1">
<heading class="hdgautonum1" level="1">
<inline style="\-ilx-tab-stops: left blank 0tw; "><gentext type="headingnumberstring">1
</gentext>Introduction</inline>
</heading>
<par class="para"><inline class="glossaryrefmain">ITIL</inline> is part of a suite of
best-practice publications for <inline class="glossaryrefmain">IT service
management</inline> (ITSM).<xref rid="fn1">1</xref> ITIL provides guidance to
<inline class="glossaryrefmain">service provider</inline>s on the provision of
quality</par>
</section>
<footnote-group>
<footnote id="fn1">
<label>1</label>
<par class="footnote text"> ITSM and other concepts from this chapter are described in
more detail in Chapter 2.</par>
</footnote>
</footnote-group>
</root>
1.
介绍
ITIL是一套
IT服务最佳实践出版物
管理层(ITSM)。1 ITIL为
服务提供者关于提供
质量
1.
本章中的ITSM和其他概念在
更多详情请参见第2章。
请展示您迄今为止所做的尝试-这样,您就更容易告诉您哪里出了问题。您使用的是什么版本的XSLT?这与构建索引基本上是相同的问题,除了(a)在“索引”点插入脚注标记和(b)“索引”的第二次传递发生在正文之后而不是之前。看看网站上的索引示例,它收集了过去常见问题的解决方案;我还没有找到一个脚注的答案,但有一些索引示例可以修改。另见@Muller,我还没有尝试过我正在思考的问题。我正在寻求帮助。。。