Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin 1 post 21 karma points
    May 21, 2010 @ 16:19
    Kevin
    0

    GetItem() NullReferenceException only in one environment

    Hi Guys,

     

    I have a very simple XSLT macro that lists the field names and string values from the field from the current page.  It works perfectly in my test environment, but the exact same code won't even compile on the production environment.  The machines both have the same version of Umbraco.  Any ideas on how to fix this?

     

    This is the error it gives while compiling on production:

    [code]Error occured

     

    System.NullReferenceException: Object reference not set to an instance of an object. 

    at umbraco.library.GetItem(Int32 nodeID, String alias)[/code]

     

    If I comment out this line, it works:

    [code]<xsl:value-of disable-output-escaping="yes" select="umbraco.library:GetItem($currentPage/@id, .)"/>[/code]

     

    This is the XSLT code:

    [code]<?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>

    <xsl:stylesheet 

    version="1.0" 

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

    xmlns:msxml="urn:schemas-microsoft-com:xslt"

    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 

    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

     

     

    <xsl:output method="xml" omit-xml-declaration="yes"/>

     

    <xsl:param name="currentPage"/>

     

    <xsl:template match="/">

     

    <xsl:for-each select="$currentPage/data [string(data [@alias='umbracoNaviHide']) != '1']/@alias">

    <xsl:value-of select="."/>

    <xsl:value-of disable-output-escaping="yes" select="umbraco.library:GetItem($currentPage/@id, .)"/>

    </xsl:for-each>

     

    </xsl:template>

     

    </xsl:stylesheet>[/code]

     

Please Sign in or register to post replies

Write your reply to:

Draft