【发布时间】:2012-06-01 16:02:56
【问题描述】:
我试图在我的 XSL 转换过程中获取 iWantToGetThis.jpg 的值并将其放入 <img> 中。这就是我的 xml 的结构:
<article>
<info>
<mediaobject>
<imageobject>
<imagedata fileref='iWantToGetThis.jpg'>
这是我为 XSL 提出的建议:
<xsl:template name="user.header.content">
<xsl:stylesheet xmlns:d='http://docbook.org/ns/docbook'>
<img><xsl:attribute name="src">../icons/<xsl:value-of select='ancestor-or-self::d:article/info/mediaobject/imageobject/imagedata/@fileref' /></xsl:attribute></img>
</xsl:stylesheet>
</xsl:template>
图像被添加到输出中,但 src 属性设置为“../icons/”,所以我假设它没有在 XML 中找到 fileref 属性。这对我来说看起来完全有效,所以我不确定我错过了什么。
【问题讨论】: