[英]Creating Change Bars Using XSL-FO
我有一个文档,我需要使用修订条(边距中的黑条指示发生更改的位置)跟踪更改。
更改后的文本是使用<span class="changeText">
。
示例代码,如下:
<p>This is the original text. This is the original text. This is the original text. This
is the original text. This is the original text. <span class="changeText">This text has
changed. This text has changed. This text has changed.</span> This is the original text.
</p>
我可以通过使用合理接近
fo:block background-color="lightyellow" border-end-color="black"
border-start-style="solid" border-start-width="4pt" padding-start="25pt"
当然,这将部分视为一个块。 我需要让它内联工作......但一直无法找出正确的代码来提供这种具有内联文本流的行为。
任何想法我们的意见将不胜感激。
谢谢!
可以使用 XSL-FO 中的fo:change-bar
和fo:change-bar-end
来实现修订栏。
6.13.2 fo:change-bar-begin
https://www.w3.org/TR/xsl11/#fo_change-bar-begin
6.13.3 fo:change-bar-end
https://www.w3.org/TR/xsl11/#fo_change-bar-end
因此需要立即从<span class="changeText">
元素生成fo:change-bar-begin
、 fo:inline
和fo:change-bar-end
,例如以下模板:
<xsl:template match="span[string(@class) eq 'changeText']">
<xsl:variable name="id" as="xs:string" select="generate-id(.)"/>
<fo:change-bar-begin change-bar-class="{$id}" change-bar-color="black" change-bar-style="solid"/>
<fo:inline background-color="yellow">
<xsl:apply-templates/>
</fo:inline>
<fo:change-bar-end change-bar-class="{$id}"/>
</xsl:template>
样本结果:
这是由 AH Formatter 生成的。 不幸的是,FOP 目前没有实现fo:change-bar-begin
和fo:change-bar-end
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.