0
votes

I need in my xsl file an image. this image is in a content in umbraco, the news page. 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?

1
'I tried <xsl:value-of select="umbraco.library:GetMedia($currentPage/image, false)/News" /> but it give me an error : Value was either too large or too small for an Int32. - AnSt
I just did it in this mode: <img > <xsl:attribute name="src"> <xsl:value-of select="(current()/image)"/> </xsl:attribute> </img> - AnSt
First of I would check the value of $currentPage/image - Is it returning the expected value which I think you believe is an integer? Output the value to the page using something like <xsl:value-of select="$currentPage/image" /> or you could also look at the contents of $currentPage using <xsl:copy-of select="$currentPage" /> - ProNotion

1 Answers

1
votes

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.

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