Copied to clipboard

Flag this post as spam?

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


  • Gene Foxwell 17 posts 39 karma points
    Jan 26, 2011 @ 17:05
    Gene Foxwell
    0

    Problem with umbraco.library.GetMember($id)

    Hi,

    I am having some trouble with the umbraco.library.GetMember() method in my XSLT for umbraco version 4.5.2 .  I've check the bugs and the forum and while it appears that other people have experienced something similar to this before none of the suggestions have worked and all of the related bugs are marked as fixed.  I can only assume I'm missing something.

    Here is the XSLT in question: (I've pruned out the markup and anything not related to GetMember for clarity).

     

    <xsl:variable name="member" select="umbraco.library:GetMember($id)" />
    <xsl:copy-of select="$member"></xsl:copy-of>
    <xsl:value-of select="$member/node/@email"/>
    <xsl:value-of select="$member/node/fullname"></xsl:value-of>

     

    It's the last line I'm having trouble with - it basically return nothing.   I have tried the following variations on this, just in case, all with the same result:

     <xsl:value-of select="$member/fullname"></xsl:value-of>
    <xsl:value-of select="$member/node/data/fullname"></xsl:value-of>
    <xsl:value-of select="$member/node[@alias='fullname']"></xsl:value-of>
    <xsl:value-of select="$member/node/@fullname"></xsl:value-of>
    <xsl:value-of select="$member/@fullname"></xsl:value-of>

     

    While I admit most of these variations aren't logical, I was getting a bit desperate so I tried everything I could think of.   I know the data is present however, since the "copy-of" commad in the first code set produces the following xml output (I've cleared out some of the information like my personal email address etc from this, but the format remains the same).

     

    <node email="[email protected]"
    loginname="doctorlight"
    path="-1,1455"
    nodetypealias="Member"
    writername="Administrator"
    urlname="doctorlight"
    nodename="Doctor Light"
    updatedate="2011-01-25T13:34:59"
    createdate="2011-01-25T13:34:59"
    sortorder="94"
    template="0"
    nodetype="1150"
    writerid="0"
    level="1"
    parentid="-1"
    version="318ca77a-359b-40da-b707-6427e05689c2" id="1455">
    <fullname>Doctor Light</fullname>
    <organization>Capcom</organization>
    </node>

     

    Anyway at this point I am completely unsure how to get what I need out of the system, as far I can one of those original permutations of the value-of section should of worked. since they didn't, and the data is clearly present, I would appreciate any advice on what I am missing or where to go next.

     

  • Seth Niemuth 275 posts 397 karma points
    Jan 26, 2011 @ 18:20
    Seth Niemuth
    0

    Since it is XML still inside of full name, you need to disable output escaping:

     <xsl:value-of  disable-output-escaping="yes" select="$member/node/lastname" />

  • Gene Foxwell 17 posts 39 karma points
    Jan 26, 2011 @ 19:25
    Gene Foxwell
    0

    Hi,

     

    So I tried using the disable-output-escaping="yes" in the XSLT in the appropriate place and this did not work either.  Thanks for the suggestion however.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 26, 2011 @ 19:27
    Kim Andersen
    0

    Hi Gene

    This code should for sure work on an installation out of the box, and from the XML that you provided above:

    <xsl:value-of select="$member/node/fullname" />

    But if nothing is rendered, could you try this:

    <xsl:value-of select="$member//fullname" />

    Just to check.

    /Kim A

  • Seth Niemuth 275 posts 397 karma points
    Jan 26, 2011 @ 19:29
    Seth Niemuth
    0

    I copied your code and put it into my installation and I thought that: <xsl:value-of select="$member/node/fullname" /> would work but it doesn't but it does work for me with disable-output-escaping="yes"  on the value of the fullname (I happened to use lastname as the property type alias name).

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 26, 2011 @ 19:40
    Kim Andersen
    0

    Hmm... You shouldn't have to use the disable-output-escaping, to make this work as it's just plain text inside the <fullname></fullname>.

    I also tried the code in a fresh new installed v4.6, and it's work just like a charm with just:

    <xsl:value-of select="$member/node/fullname" />

    Where the fullname is a textstring.

    /Kim A

  • Gene Foxwell 17 posts 39 karma points
    Jan 26, 2011 @ 19:54
    Gene Foxwell
    0

    Well, I did eventually get it to work.  It wouldn't work for me until I had republished the whole site and then deleted the umbraco.config file.  I can only assume that somehow there was something wierd going on with the cache that was causing the problem. (Maybe all those bad or empty queries I had tried had magically gotten some bad data cached?).  Anyway, once I deleted the config file and reloaded the page it was working as expected with the correct notation.

     

    Thanks for the help!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 26, 2011 @ 19:59
    Jan Skovgaard
    0

    Hi Gene

    It's always a good idea to right click "Content" and choose "Republish entire site". This refreshes the XML cache so it should not be neccesary to delete it. But sometimes one just needs to go the hard way. Just thought I would mention this if you were not aware about it. And happy to see you have got it to work :-)

    /Jan

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 26, 2011 @ 20:00
    Kim Andersen
    0

    Ahh, did you maybe play around with the "UseLegacyXmlSchema" in the umbracoSettings.config-file? I'm just curious :)

    But great that you got it working Gene. Couldn't quite understand why it didn't work :)

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft