XSL-FO 用循环实现图片

XSL-FO implementing pictures with a loop

我的问题是我有一个 XML 结构有效的文件,所有图片都放在以下路径中。

<figure>
   <graphic url="Alexander.jpg" width="180px" height="281px" />
   <figDesc>Alexander</figDesc>
 </figure>

IN XSL 添加循环并将图片放入生成的 html 文件中的解决方案很清楚。我用这样的东西

<figure>
<img src="{tei:figure/tei:graphic/@url}" 
width="{substring-before(tei:figure/tei:graphic/@width, 'px')}" 
alt="{tei:figure/tei:figDesc}" />     
</figure>

但在 XSL FO 中我只能添加这样的图片。而且我真的不想用手放置它们。

<fo:block>
 <fo:external-graphic src="Alexander.jpg" />
</fo:block>

所以你能帮我一点忙吗?克里斯蒂安干杯

属性值模板适用于任何 non-XSLT 属性(以及许多 XSLT-defined 属性)。参见 http://www.w3.org/TR/xslt#attribute-value-templates

所以您也可以在 XSLT 中执行此操作:

<fo:block>
 <fo:external-graphic src="{tei:figure/tei:graphic/@url}" />
</fo:block>