简体   繁体   English

XSLT图片Umbraco

[英]XSLT Image Umbraco

I need in my xsl file an image. 我的xsl文件中需要一个图像。 this image is in a content in umbraco, the news page. 此图片位于umbraco新闻页面的内容中。 I did this but doesn't work: 我这样做了,但是不起作用:

 <xsl:if test="$currentPage/image &gt; ''"> <xsl:variable name="media1" select="umbraco.library:GetMedia($currentPage/image, false())" /> <xsl:if test="not($media1/error)"> <img src="{$media1}" /> </xsl:if> </xsl:if> 

the result is: 结果是:

 <a href="#"></a> 

it doesn't take nothing. 它什么也没做。 some one have some idea why? 有人知道为什么吗?

Change your image code to this and it should work. 将您的图像代码更改为此,它应该工作。 You need to specify the file name property, otherwise you're trying to set the source of the image to the full XML representation of the media item. 您需要指定文件名属性,否则,您尝试将图像的源设置为媒体项的完整XML表示。

<img src="{$media1/umbracoFile}"  />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM