html - FO 列表块更改样式
问题描述
我正在使用 XSL FO 列表块来显示项目符号。是否可以更改 list-style-type 以显示正方形(或其他形状)?在 HTML 中,它是<ul style="list-style-type:square;">
代码:
<fo:list-block>
<fo:list-item>
<fo:list-item-label>
<fo:block>*</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block>Volvo</fo:block>
</fo:list-item-body>
</fo:list-item>
<fo:list-item>
<fo:list-item-label>
<fo:block>*</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block>Saab</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
解决方案
把你想要的字符放在*
:
<fo:list-item-label>
<fo:block color="blue" font-weight="bold" font-size="1.3em">✪</fo:block>
</fo:list-item-label>
与 相比,这看起来需要做很多工作<ul style="list-style-type:square;">
,但是:
- 您通常只需要这样做一次,因为您正在使用 XSLT 生成 XSL-FO
- 您可以完全控制列表项标签的内容、大小、重量、颜色、对齐方式(参见
relative-align
:https ://www.w3.org/TR/xsl11/#relative-align )和位置(以及,如上所述,您通常只需要设置一次) - 如果您愿意,您可以更改,例如,通过
position()
在 XSLT 中使用每个列表项的项目符号颜色 - 当您查看编号列表项时,您会发现这
xsl:number
使得生成分层编号以在列表项标签中使用变得很容易。(如果您使用的是 AH Formatter,您还可以使用一组预定义的计数器样式:https ://www.antennahouse.com/product/ahf66/ahf-ext.html#axf.counter-style 。)
推荐阅读
- c# - 如何以高效的方式运行大量阻塞操作?
- reactjs - GUN 不会在父组件 React.js 中获取数据
- bigdata - 大 p 小 n 问题与维度灾难相同吗?
- javascript - 数据表转义正则表达式 - 下拉列表过滤器不起作用
- java - 如何使用 jpa 和 hibernate 访问查询中的子元素 - SpringBoot
- java - Android webview自动填充相关的崩溃
- express - 前端 Next js 和后端 Express js 中的支付网关集成?
- python - 如何将数据从树莓派发送到网页?
- google-sheets-formula - Google表格中的IF语句需要搜索直到接近最大数字
- python-3.x - cmake: brp-python-bytecompile 和 python3