how to place value of xpath in to html img tag

2019-02-26 11:50发布

问题:

The following code gets me the appropriate string, but I don't know how to put the value in to an html img tag:

<xsl:value-of select="MT[@N = 'tag']/@V" />

I've tried this:

<img src="<xsl:value-of select="MT[@N = 'tag']/@V" />

and several variations.

Thanks.

回答1:

Use an Attribute Value Template (AVT)

<img src="{MT[@N = 'tag']/@V}" />


标签: xml xslt