Copied to clipboard

Flag this post as spam?

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


  • Lee 1130 posts 3088 karma points
    Dec 01, 2010 @ 15:51
    Lee
    0

    Can't Access Member Properties (Using 4.5.2)

    Having a weird problem getting some member properties, example of code below

    <xsl:variable name="member" select="umbraco.library:GetMember(1265)" />
    <xls:value-of select="$member/mypropertyname" />

    Even though I can see 'mypropertyname' in the XML has a value when doing copy-of its not putting it out?  What is weird is this IS outputting the email of the member so I definitely have access to the XML?

    <xls:value-of select="$member/@email" />

    Anyone know if there is a bug with member properties and 4.5.2? :(

     

  • Lee 1130 posts 3088 karma points
    Dec 01, 2010 @ 15:54
    Lee
    0

    Sorry meant to say, I can get email doing it this way 

    <p>Email: <xsl:value-of select="$member/*/@email" /></p>

    But that does not work for the properties?

  • jaygreasley 416 posts 403 karma points
    Dec 01, 2010 @ 16:13
    jaygreasley
    1

    Have you looked at umbraco.config to make sure the xml matches the structure you are expecting in your XPath statement?

     

  • Brendan Rice 538 posts 1101 karma points
    Dec 01, 2010 @ 16:14
    Brendan Rice
    2

    Try this to see the properties:

    <textarea><xsl:copy-of select="$member"/></textarea>

  • Lee 1130 posts 3088 karma points
    Dec 01, 2010 @ 16:20
    Lee
    0

    @Jay - Yep which is which is why I'm stumped

    here it is (Have tried the following and cannot get the property)

    $member/jobpostername, $member/*/jobpostername, $member/*/node/jobpostername, $member//node/jobpostername, $member/node//jobpostername
    $member/node/jobpostername

    <node id="1314" 
        version="fef51405-37af-443c-a8d0-e5d81e90b0d5" 
        parentid="-1" 
        level="1" 
        writerid="0" 
        nodetype="1059" 
        template="0" 
        sortorder="85" 
        createdate="2010-12-01T14:10:16" 
        updatedate="2010-12-01T14:10:16" 
        nodename="Job Poster" 
        urlname="jobposter" 
        writername="Administrator" 
        nodetypealias="JobPoster" 
        path="-1,1314" 
        loginname="jobposter" 
        email="[email protected]">
      <jobpostername>Lee</jobpostername>
      <jobpostercompany>My Company</jobpostercompany>
      <jobpostercontactnumber>07777 777777</jobpostercontactnumber>
      <jobposteramountposted>5</jobposteramountposted>
      <jobpostercounty>1198</jobpostercounty>
      <jobposterbanned>0</jobposterbanned>
    </node>

    @Brendan Rice - Yep I did that in the XSL visualiser to make sure I had the right data

     

  • Brendan Rice 538 posts 1101 karma points
    Dec 01, 2010 @ 16:32
    Brendan Rice
    0

    $member/@email <- did you try that?

  • Lee 1130 posts 3088 karma points
    Dec 01, 2010 @ 16:34
    Lee
    0

    Read second post bud

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Dec 01, 2010 @ 16:36
    Lee Kelleher
    1

    Hi Lee,

    Took a quick look at the GetMember source-code... it's looking like you'd need to reference the "/node" part in your XPath expressions.

    So "$member/node/jobpostername" should work.  Obviously you say you've tried that - soooo... might be worth trying to loop through each of the child-nodes (using the wildcard)?

    <xsl:for-each select="$member/*">
        <xsl:value-of select="name()" /> == node?
    
        <xsl:for-each select="*">
            <xsl:value-of select="name()" />
        </xsl:for-each>
    
    </xsl:for-each>

    Cheers, Lee.

  • Lee 1130 posts 3088 karma points
    Dec 01, 2010 @ 16:52
    Lee
    0

    That outputs each of the property names?

    node == node? 
    jobPosterNamejobPosterCompanyjobPosterContactNumberjobPosterAmountPostedjobPosterCountyjobPosterBa

    I have just tried this using XSLT

        <xsl:if test="string($member) != ''">
          
          <div id="jobpostrecruiter">
            <p>Name: <xsl:value-of select="$member/node/jobpostername" /></p>
            <p>Company: <xsl:value-of select="$member/node/jobpostercompany" /></p>
            <p>Website: <xsl:value-of select="$member/node/jobposterurl" /></p>
            <p>Email: <xsl:value-of select="$member/node/@email" /></p>
          </div>
          
        </xsl:if>

    And again no output apart from the email!? (Below is screen capture)

    I then used the Umbraco member using .NET and it works fine (There is no URL on this one which is why its not showing below)

    So I am completely and utterly MIFFED!!!

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Dec 01, 2010 @ 16:56
    Lee Kelleher
    1

    DUDE! Your property alias are camel-cased! XPath is case-sensitive... Durrrr! haha ;-)

    Try: "$member/node/jobPosterName"

    Cheers, Lee.

  • Lee 1130 posts 3088 karma points
    Dec 01, 2010 @ 16:59
    Lee
    0

    BWAHAHAHAHAHA........  Guess why it doesn't work!!!!

    I went back to basics and took Brendans advice and output to a Text area... Then found out the XSL Visualiser is lowercasing all my properties!!  They are actually Camel cased.

      <jobPosterName>Lee Messenger</jobPosterName>
      <jobPosterCompany>n3o Ltd</jobPosterCompany>

    So changed it to the following and it works....

        <xsl:if test="string($member) != ''">
         
          <div id="jobpostrecruiter">
            <p>Name: <xsl:value-of select="$member/node/jobPosterName" /></p>
            <p>Company: <xsl:value-of select="$member/node/jobPosterCompany" /></p>
            <p>Website: <xsl:value-of select="$member/node/jobPosterURL" /></p>
            <p>Email: <xsl:value-of select="$member/node/@email" /></p>
          </div>
         
        </xsl:if>

  • Lee 1130 posts 3088 karma points
    Dec 01, 2010 @ 17:01
    Lee
    0

    Yep... I f**king hate XSLT!

    From now on I shall always copy-of to a textarea!!

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Dec 01, 2010 @ 17:01
    Lee Kelleher
    0

    Can't say that I've used the XSLT Visualiser much... good to know that it lowercases things.

  • Lee 1130 posts 3088 karma points
    Dec 01, 2010 @ 17:02
    Lee
    0

    Ooops forgot to say, thanks chaps for trying to help anyway :)  Everyone gets some karma

Please Sign in or register to post replies

Write your reply to:

Draft