XSL:将XML解析为HTML-如何将元素数据的值用作HTML属性?

XSL:将XML解析为HTML-如何将元素数据的值用作HTML属性?,html,xml,xslt,Html,Xml,Xslt,我有一个xml元素,它包含解析后需要以HTML显示的图像路径。 返回存储在image元素中的字符串,但如何使用它使该字符串成为html标记中的src atribute值? 我尝试了,但显然这不起作用,那么如何才能做到呢 我希望我的问题是清楚的。请帮忙 这应该有效: <input src="LOGO.JPG" type="image" name="imagem"> 你是说 <input type="image" name="imagem" src="{image}" /&g

我有一个xml元素,它包含解析后需要以HTML显示的图像路径。
返回存储在image元素中的字符串,但如何使用它使该字符串成为html标记中的src atribute值? 我尝试了
,但显然这不起作用,那么如何才能做到呢

我希望我的问题是清楚的。请帮忙

这应该有效:

<input src="LOGO.JPG" type="image" name="imagem">


你是说

<input type="image" name="imagem" src="{image}" />

请记住正确绑定命名空间前缀。此外,HTML中的img元素必须具有alt


或者将“//image”替换为XML元素的特定Xpath。

请参见此问题:我在编辑器中突出显示了错误“Unexpected atribute”和select=“image”。我尝试了各种xpath表达式的组合,但这个错误仍然存在
<input type="image" name="imagem" src="{image}" />
<xsl:template select="//image">
    <xhtml:img>
        <xsl:attribute name="alt"><xsl:value-of="@name" /></xsl:attribute>
        <xsl:attribute name="src"><xsl:value-of="@src" /></xsl:attribute>
    </xhtml:img>
</xsl:template>