Try this instead - it's not easy to see where your code goes wrong, but it's doing a couple of not so good things (e.g., calling GetMedia() several times for the same item) - this will make sure only to fetch the media once, and to reference the data from the cached item instead:
Use of umbraco.library:GetMedia to retrieve text field crashes umbraco
Umbraco Version: 4.0.0 (Assembly version 1.0.3317.32692)
ASP.net version: 2.0.50727
Wndows & IIS Version: Windows server 2003 R2 SP2 / IIS7
Stacktrace:
Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 1000
Date: 14/02/2012
Time: 5:42:49 PM
User: N/A
Computer: XXXX
Description:
Faulting application w3wp.exe, version 6.0.3790.3959, stamp 45d6968e, faulting module kernel32.dll, version 5.2.3790.4062, stamp 46264680, debug? 0, fault address 0x0000bee7.
Detailed Description:
The code in red color causing the crash. Applicaiton pool recycle is reqruied to bring back the server. Please help.
<xsl:variable name="CoverImg" select="umbraco.library:GetMedia(@id, 'false')/data [@alias='CoverImage']"/>
<xsl:variable name="Note" select="umbraco.library:GetMedia(@id, 'false')/data [@alias='ImgNote']"/>
<xsl:choose>
<xsl:when test="$CoverImg != ''">
<li>
<a class="hoverImg" href="{umbraco.library:GetMedia(@id, 'false')/data [@alias = 'umbracoFile']}" target="_blank"><xsl:value-of select="@nodeName"/>
<span><img alt="" src="{umbraco.library:GetMedia(@id, 'false')/data [@alias='CoverImage']}" /><br/>
<xsl:if test="$Note != ''">
<xsl:value-of select="$Note" />
</xsl:if>
</span>
</a>
</li>
</xsl:when>
Hi Praj,
Try this instead - it's not easy to see where your code goes wrong, but it's doing a couple of not so good things (e.g., calling GetMedia() several times for the same item) - this will make sure only to fetch the media once, and to reference the data from the cached item instead:
Please be sure to use false() instead of 'false' - in XSLT 'false' is just a string, which will be converted to the boolean true for the C# extension.
/Chriztian
is working on a reply...