如何在xsl-fo中强调整个答案字段?

时间:2016-11-09 09:01:54

标签: xml xsl-fo

我正在尝试在xsl-fo中创建此表单(请参阅链接)。

enter image description here

不幸的是我不知道如何制作所有下划线。我尝试使用fo:inline,但只强调答案文本,而不是整个答案字段。

1 个答案:

答案 0 :(得分:0)

对于空下划线,请使用带有底部边框的fo:leaderhttps://www.w3.org/TR/xsl11/#fo_leader),例如:

<fo:block>Name:<fo:leader leader-length.optimum="100%" border-bottom="thin solid black"
     /></fo:block>
<fo:block>Address:<fo:leader leader-length.optimum="100%"
        border-bottom="thin solid black" /><fo:block /><fo:leader
        leader-length.optimum="100%" border-bottom="thin solid black" /></fo:block>

对于文字下的长下划线,请将fo:inlineinline-progression-dimension.optimuminline-progression-dimension.minimum一起使用,以便fo:inline不必占用宽度的100%:

<fo:block>Name:<fo:inline keep-with-previous.within-line="always"
        inline-progression-dimension.minimum="12pt"
        inline-progression-dimension.optimum="100%" border-bottom="thin solid black"
        padding-left="12pt">RECEIVER NAME</fo:inline></fo:block>
<fo:block>Address:<fo:inline keep-with-previous.within-line="always"
        inline-progression-dimension.minimum="12pt"
        inline-progression-dimension.optimum="100%" border-bottom="thin solid black"
        padding-left="12pt">RECEIVER STREET 1</fo:inline><fo:block /><fo:inline
        keep-with-previous.within-line="always"
        inline-progression-dimension.minimum="12pt"
        inline-progression-dimension.optimum="100%" border-bottom="thin solid black"
        padding-left="12pt">2, RECEIVER STREET 3</fo:inline></fo:block>

要使文本排成一行,如果您正在使用AH Formatter,请使用axf:tabhttps://www.antennahouse.com/product/ahf63/ahf-ext.html#axf.tab)和相关属性来设置和使用制表位:

<fo:flow flow-name="xsl-region-body" axf:tab-stops="20mm">
    <fo:block>Name:<fo:inline keep-with-previous.within-line="always"
            inline-progression-dimension.minimum="12pt"
            inline-progression-dimension.optimum="100%" border-bottom="thin solid black"
            ><axf:tab />RECEIVER NAME</fo:inline></fo:block>
    <fo:block>Address:<fo:inline keep-with-previous.within-line="always"
            inline-progression-dimension.minimum="12pt"
            inline-progression-dimension.optimum="100%" border-bottom="thin solid black"
            ><axf:tab />RECEIVER STREET 1</fo:inline><fo:block /><fo:inline
            keep-with-previous.within-line="always"
            inline-progression-dimension.minimum="12pt"
            inline-progression-dimension.optimum="100%" border-bottom="thin solid black"
            ><axf:tab />RECEIVER STREET 2, RECEIVER STREET 3</fo:inline></fo:block>
</fo:flow>

enter image description here