Searching for an error with GetMedia on Forum, I read that the variable i give the functions is not an integer.
Here is the error: System.OverflowException: Value was either too large or too small for an Int32.
I check my variable:
<xsl:value-of select="$currentPage/image" />
The output was:
1663
then i try this:
<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/image, false())" />
It returns me the error I wrote you above. If i wrote 1663 instead of $currentPage/image it works but then it's hardcoded and it musn't be hardcoded.
Here my xslt
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:value-of select="$currentPage/image" />
<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/image, false())" />
<div class="tfirst">
<p>
<!--xsl:if test="not($media/error)">
<img src="{$media/umbracoFile}" class="left timg" />
</xsl:if-->
<div class="ttext">
<h2><xsl:value-of select="umbraco.library:StripHtml($currentPage/title)" /></h2>
<xsl:value-of select="$currentPage/abstractText" disable-output-escaping="yes" />
</div>
</p>
</div>
<div class="ttext">
<xsl:if test="$currentPage/showMultipleColumns='1'">
<xsl:attribute name="class">showMultipleColumns</xsl:attribute>
</xsl:if>
<xsl:value-of select="$currentPage/bodyText" disable-output-escaping="yes" />
</div>
</xsl:template>
Thank you for your help. Benjamin
Edit------------------
I've tried to add a if test but now it give me another error if i replace $currentPage/image by 1663 : System.Xml.Xsl.XslTransformException: To use a result tree fragment in a path expression, first convert it to a node-set using the msxsl:node-set() function.
If i let the $currentPage/image I always have: System.OverflowException: Value was either too large or too small for an Int32.
Here is the xslt:
<xsl:variable name="atest" select="umbraco.library:GetMedia($currentPage/image, false())" />
<xsl:variable name="media">
<xsl:if test="$currentPage/image > 0">
<xsl:value-of select="$atest" />
</xsl:if>
</xsl:variable>
Edit2------------
Trying this below always getting the error: System.OverflowException: Value was either too large or too small for an Int32.
<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/image, false())" />
<xsl:if test="$media">
<img src="{$media/umbracoFile}" class="left timg" />
</xsl:if>