如何使用 XSL-FO 创建有序列表 (ol in HTML)?
How to create an ordered list (ol in HTML) with XSL-FO?
美好的一天,
我正在处理演示文稿,将其从 xml 转换为 pdf,我正在使用这些技术:
- XML
- XSL
- XSL-FO
- 撒克逊人
- 其他内容...
并且在我的 XSL-FO 文件中,我需要一个包含特定项目编号列表的演示幻灯片。我发现的唯一一件事就是本段上方所示的通用列表。这是列表的 xsl-fo 文档:https://www.alt-soft.com/tutorial/xslfo_tutorial/xsl-fo_list.html
这是我的代码:
<fo:list-block padding="4pt" margin-left="10mm" margin-top="4mm">
<xsl:for-each select="//*[starts-with(name(), 'slide_')]">
<xsl:if test="not(position()=1)">
<fo:list-item margin-left="13mm" margin-top="8mm" margin-right="5mm" font-family="Times, 'Times New Roman', serif" font-size="15pt">
<fo:list-item-label end-indent="label-end()">
<fo:block>•</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block margin-left="10mm">
<xsl:value-of select="title"/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:if>
</xsl:for-each>
</fo:list-block>
此代码将生成所有幻灯片标题的公共点列表,但我无法使用 HTML 中的 ol 等数字制作有序列表。我发现只有这些列表元素以某种方式嵌套的解决方案对我不起作用。我试过了,但在编译过程中总是失败。这是该代码的 link(第 8,9 页):https://www.w3.org/Style/XSL/TestSuite/contrib/FOP/list.pdf
这个在线站点可以帮助您找到适合我的解决方案,在线测试:
http://www.utilities-online.info/foprender/#.WRLOAYh97cs
请问有什么解决办法吗?预先感谢您的回复。
您需要用数字代替每个 fo:list-item-label
中的 •
。
您可以使用 xsl:number
从源 XML 的结构中生成数字。有关 XSLT 1.0 定义和一些简单示例,请参阅 https://www.w3.org/TR/xslt#number。
美好的一天,
我正在处理演示文稿,将其从 xml 转换为 pdf,我正在使用这些技术:
- XML
- XSL
- XSL-FO
- 撒克逊人
- 其他内容...
并且在我的 XSL-FO 文件中,我需要一个包含特定项目编号列表的演示幻灯片。我发现的唯一一件事就是本段上方所示的通用列表。这是列表的 xsl-fo 文档:https://www.alt-soft.com/tutorial/xslfo_tutorial/xsl-fo_list.html
这是我的代码:
<fo:list-block padding="4pt" margin-left="10mm" margin-top="4mm">
<xsl:for-each select="//*[starts-with(name(), 'slide_')]">
<xsl:if test="not(position()=1)">
<fo:list-item margin-left="13mm" margin-top="8mm" margin-right="5mm" font-family="Times, 'Times New Roman', serif" font-size="15pt">
<fo:list-item-label end-indent="label-end()">
<fo:block>•</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block margin-left="10mm">
<xsl:value-of select="title"/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:if>
</xsl:for-each>
</fo:list-block>
此代码将生成所有幻灯片标题的公共点列表,但我无法使用 HTML 中的 ol 等数字制作有序列表。我发现只有这些列表元素以某种方式嵌套的解决方案对我不起作用。我试过了,但在编译过程中总是失败。这是该代码的 link(第 8,9 页):https://www.w3.org/Style/XSL/TestSuite/contrib/FOP/list.pdf
这个在线站点可以帮助您找到适合我的解决方案,在线测试: http://www.utilities-online.info/foprender/#.WRLOAYh97cs
请问有什么解决办法吗?预先感谢您的回复。
您需要用数字代替每个 fo:list-item-label
中的 •
。
您可以使用 xsl:number
从源 XML 的结构中生成数字。有关 XSLT 1.0 定义和一些简单示例,请参阅 https://www.w3.org/TR/xslt#number。