Copied to clipboard

Flag this post as spam?

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


  • Craig Palenshus 39 posts 63 karma points
    Apr 15, 2010 @ 01:57
    Craig Palenshus
    0

    Use umbraco.library.GetItem to get data property alias

    I'm trying to add an image in my XSLT.

    The following works great for my ALT tag because I'm just reading the value of a node property:

    umbraco.library:GetItem(data [@alias= 'author'], 'nodeName')

    But for the SRC, I need to get the value of a data property by an alias, and it doesn't work. I've tried the following and it seems like the first option should be working, but it returns a System.NullReferenceException: Object reference not set to an instance of an object. The second option saves, but returns nothing.

    1. umbraco.library:GetItem(data [@alias= 'author'], 'teamMemberIcon')

    2. umbraco.library:GetItem(data [@alias= 'author'], data [@alias = 'teamMemberIcon'])

    What am I missing?

    Thanks.

  • Craig Palenshus 39 posts 63 karma points
    Apr 15, 2010 @ 02:30
    Craig Palenshus
    0

    Just a follow-up. I've spent like 3 hours trying to figure this out and am very frustrated. What I've shown in #1 above DOES work from some aliases, but not for others. I haven't tested them all, but from what I have tested, there's something strange going on.

    Here's the node from which I'm trying to get the 'teamMemberIcon' path. Everything in bold does NOT work. The one's italicized throw the object reference error. How can this be?

    I've tried republishing it and the parent node. That doesn't work either.

    <node id="1081"
    version="d8ba5a6e-3ecf-43bf-88c5-603908362f4c"
    parentID="1056"
    level="3"
    writerID="0"
    creatorID="0"
    nodeType="1078"
    template="1062"
    sortOrder="6"

    createDate="2009-06-19T12:59:18"
    updateDate="2010-04-14T14:55:02"
    nodeName="Craig Palenshus"
    urlName="craig-palenshus"
    writerName="Administrator"

    creatorName="Administrator"
    nodeTypeAlias="teamMember"
    path="-1,1045,1056,1081">

    <data alias="managementTeamMember">1</data>
    <data alias="teamMemberPhoto">1070</data>
    <data alias="teamMemberBlog">http://craig.palenshus.com</data>;
    <data alias="teamMemberBlogThumbnail">1215</data>

    <data alias="teamMemberBlogBody">
    &lt;p&gt;Craig Palenshus is the Creative Director for NimblePros. He
    primarily blogs about things of interest to him professionally like
    marketing, Silverlight design, and CSS and HTML.&lt;/p&gt;
    </data>

    <data alias="sortOrder">4</data>
    <data alias="teamMemberIcon">/media/18273/craig-cartoon-icon.png</data>
    <data alias="teamMemberTitles">Creative Director</data>

    <data alias="teamMemberBio">
    &lt;p&gt;Craig Palenshus has worked in the advertising industry for over
    15 years and has specialized in UI design for the Web for the last
    five. He joined Nimble Software Professionals to provide creative
    direction and design to ensure that everything developed by
    NimblePros looks as great as it functions.&lt;/p&gt;
    </data>

    <data alias="mainNaviShow">0</data>
    <data alias="umbracoNaviHide">1</data>
    <data alias="topNaviShow">0</data>
    <data alias="footerNaviShow">0</data>
    <data alias="pageTitleInBrowser" />
    <data alias="pageLinkTitle" />

    </node>

  • Craig Palenshus 39 posts 63 karma points
    Apr 15, 2010 @ 19:58
    Craig Palenshus
    0

    Wow. I think this was a caching issue. It works correctly today.

    How can I prevent caching (or whatever was causing this problem) and eliminate the "beating my head against the wall" step in getting something like this to work in the future?

Please Sign in or register to post replies

Write your reply to:

Draft