英文:
`retrieve-marker` in attribute value
问题
我试图使用标记来确定在页眉/页脚中显示的图像。每个章节都有一个标记,用于传达要使用的图像。当我在<xsl:attribute元素中使用fo:marker/fo:retrieve-marker时,它会理所当然地生成一个无效的src=值。
例如,页面:
- 第1章
- 第1章结束;第2章开始
- 第2章
页面1和2的页眉将引用
如何嵌入一个根据内容流而变化的页眉或页脚中的图像呢?
英文:
I'm trying to use a marker to determine the image to show in a header/footer. Each chapter has a marker which communicates the image to use. When I use <fo:marker
/ <fo:retreive-marker
in an <xsl:attribute
element, it understandably produces an invalid src=
value.
e.g. pages:
- Chapter 1
- Chapter 1 ends; chapter 2 begins
- Chapter 2
Header for page 1 and 2 would reference <external-graphic src="1.png"/>
and 3 would reference <external-graphic src="2.png"/>
.
How can I embed an image in a header or footer that varies based on the flow content?
答案1
得分: 1
fo:marker
可以包含文本,但无法检索该文本以生成src
属性的值。
可以工作的方法是检索具有正确src
值的整个fo:external-graphic
。类似以下内容(未经测试):
<fo:page-sequence master-reference="...">
<fo:marker marker-class-name="image">
<fo:external-graphic src="1.png"/>
</fo:marker>
<fo:static-content flow-name="xsl:region-after">
<fo:block><fo:retrieve-marker retrieve-class-name="image"/></fo:block>
</fo:static-content>
<!-- 一些内容 -->
</fo:page-sequence>
<fo:page-sequence master-reference="...">
<fo:marker marker-class-name="image">
<fo:external-graphic src="2.png"/>
</fo:marker>
<fo:static-content flow-name="xsl:region-after">
<fo:block><fo:retrieve-marker retrieve-class-name="image"/></fo:block>
</fo:static-content>
<!-- 更多内容 -->
</fo:page-sequence>
英文:
An fo:marker
could contain just text, but you can't retrieve that text to make the value of a src
property.
What would work is to retrieve an entire fo:external-graphic
that has the correct src
value. Something like (untested):
<fo:page-sequence master-reference="...">
<fo:marker marker-class-name="image">
<fo:external-graphic src="1.png"/>
</fo:marker>
<fo:static-content flow-name="xsl:region-after">
<fo:block><fo:retrieve-marker retrieve-class-name="image"/></fo:block>
</fo:static-content>
<!-- Stuff -->
</fo:page-sequence>
<fo:page-sequence master-reference="...">
<fo:marker marker-class-name="image">
<fo:external-graphic src="2.png"/>
</fo:marker>
<fo:static-content flow-name="xsl:region-after">
<fo:block><fo:retrieve-marker retrieve-class-name="image"/></fo:block>
</fo:static-content>
<!-- More stuff -->
</fo:page-sequence>
答案2
得分: 0
把整个图像放在标记中,不仅仅是URL。
英文:
Put the entire image in the marker, not just the URL.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论