如何为 fo:external graphics xsl 提供动态路径

Man*_*sht 7 xsl-fo

我为 sp_sign 获得的值(如下所示)我想将其用作 fo:external graphics 的 src 。我尝试了很多事情仍然没有运气请帮助。

    <xsl:for-each select="//**sp_sign**">
    <xsl:value-of select="**@value**" />
Run Code Online (Sandbox Code Playgroud)

//

<xsl:variable name="src" select="//sp_sign" />
<fo:external-graphic baseline-shift="super" **src="${src}"** content-height="80px" content-width="80px"/>
</fo:block> 
Run Code Online (Sandbox Code Playgroud)

在此先感谢您, Manik Vashisht

san*_*zky 8

我通常使用 xsl:attribute 标签提供 src 属性

<fo:external-graphic>
      <xsl:attribute name="src">
             <xsl:value-of select="$src" />
       </xsl:attribute>
</fo:external-graphic>
Run Code Online (Sandbox Code Playgroud)

src 应如下所示: url('path/to/image')

  • 使用 AVT (http://www.w3.org/TR/xslt#attribute-value-templates) 要干净得多。示例:`&lt;fo:external-graphic src="{$src}"/&gt;` (4认同)