Copied to clipboard

Flag this post as spam?

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


  • Alex 21 posts 41 karma points
    Aug 25, 2010 @ 18:29
    Alex
    0

    Problems getting attributes with getMedia()

    I'm trying to get an attribute of a media node but for some reason it's not returning anything. Strangely the 'id' attribute returns a value.

     

    <xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/data [@alias = 'mediaId'], 0)" />

    <xsl:value-of select="$media/@id" />   <!-- this works -->

    <xsl:value-of select="$media/@nodetypealias" />   <!-- this does not -->

     

    If I use <xsl:copy-of select="$media" /> I can see that the 'nodetypealias' attribute is there on the node, but I am unable to select it. Does anyone have any ideas why this could be?

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Aug 25, 2010 @ 18:40
    Matt Brailsford
    0

    Hi Alex,

    First thing I would try is to use the alias @nodeTypeAlias (that exact casing) as this is case sensitive.

    If that's not the case, can you let us know version of Umbraco you are using?

    Matt

  • Alex 21 posts 41 karma points
    Aug 25, 2010 @ 18:50
    Alex
    0

    Ha thanks Matt, just worked that out myself too. I was looking at the XML dumped out my <xsl:copy-of /> in Firebug and it had lower-cased all the damn attribute names! Very frustrating waste of time as I was trying to work out what was wrong with my XPath queries!

Please Sign in or register to post replies

Write your reply to:

Draft