Is that at design-time? If so, then yes, this error should occur cause it is being verified against a top node which might not have that property. A solution is to surround the xsl:value-of with a xsl:if statement.
I am having a similar issue (Int32) in Umbraco 4.5 using new XML format and would appreciate any tips:
I see the correct value of $thumb which is the NodeID from the data picker so I assume I have the right variable, and if I put a NodeID in place of $thumb it returns the image.
The problem is in the way you call GetMedia. Once $thumb does not contain an int (or it can't yet determined if it will ever contain an int), you get this error.
I would do something like this (and yes, converting to a number is a great idea!):
Thank you both for your suggestions - I had already tried them previously to no effect. However I've implemented the casting and the if-test again; and now I'm seeing a different error:
With a value-of in the if condition, I'm seeing the nodeID's.
XSLT Error: System.OverflowException: Value was either too large or too small for an Int32.
I have only started today so sorry if this is a stupid question, but in a macro this works:
[code]
[/code]
but this does not - i get the OverflowException.
[code]
[/code]
Where am I going wrong?
Many Thanks,
Neil
Hi neil,
Is that at design-time? If so, then yes, this error should occur cause it is being verified against a top node which might not have that property. A solution is to surround the xsl:value-of with a xsl:if statement.
Hope this helps.
Regards,
/Dirk
That makes sense.
Thanks for you help!
Hi,
I am having a similar issue (Int32) in Umbraco 4.5 using new XML format and would appreciate any tips:
I see the correct value of $thumb which is the NodeID from the data picker so I assume I have the right variable, and if I put a NodeID in place of $thumb it returns the image.
Any thoughts?
Thanks,
Chris
<xsl:for-each select="$currentPage/* [@isDoc]">
<xsl:variable name="thumb" select="stillthumb"/>
<xsl:value-of select="$thumb"/>
<xsl:variable name="thumbnail" select="umbraco.library:GetMedia($thumb, 0)" />
<img src="{$thumbnail/Image/umbracoFile}" alt="@nodeName" style="height: 158px; width: 280px;" /></a>
</xsl:for-each>
Have you tried converting the value in $thumb explicitly to a number, like
<xsl:variable name="thumb" select="number(stillthumb)" />?
The problem is in the way you call GetMedia. Once $thumb does not contain an int (or it can't yet determined if it will ever contain an int), you get this error.
I would do something like this (and yes, converting to a number is a great idea!):
Hi,
Thank you both for your suggestions - I had already tried them previously to no effect. However I've implemented the casting and the if-test again; and now I'm seeing a different error:
With a value-of in the if condition, I'm seeing the nodeID's.
Thanks again,
Chris
Error in XSLT at line 38, char 64
38: >>> <img src="{$thumbnail/Image/umbracoFile}" alt="@nodeName" style="height: 158px; width: 280px;" /> <<<
<xsl:variable name="thumb" select="number(stillthumb)" />
<xsl:if test="$thumb > 0">
<xsl:variable name="thumbnail" select="umbraco.library:GetMedia($thumb, 0)" />
xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}" class="thumb"><img src="{$thumbnail/Image/umbracoFile}" alt="@nodeName" style="height: 158px; width: 280px;" />a>
is working on a reply...