Copied to clipboard

Flag this post as spam?

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


  • Pinal Bhatt 298 posts 389 karma points
    Nov 22, 2010 @ 21:11
    Pinal Bhatt
    0

    accessing member details

    I have a document  property named "articleAuthor" mapped to type "Member Picker". 

    Now i want to access member details thru xslt.

    Using below code i just get the member id. How can i get further details like loginname, email and other custom fields associated with that user.

      <xsl:variable name="propertyAlias" select="string('articleAuthor')"/>

      <xsl:variable name="memberno" select="$currentPage/* [name() = $propertyAlias]"/>

    following is not working for me:

    <xsl:variable name="member1" select="umbraco.library:GetMember($memberno)" />
    <xsl:value-of select="$member1/@loginName" />
    <xsl:value-of select="$member1/@email" />

     

    Thanks & Regards,
    Pinal Bhatt

     

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Nov 22, 2010 @ 21:54
    Jan Skovgaard
    0

    Hi Pinal

    what do you get returned if you make a xsl:copy-of on your $member1 variable?

    like...

    <textarea>

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

    </textarea>

    /Jan

  • Pinal Bhatt 298 posts 389 karma points
    Nov 22, 2010 @ 22:13
    Pinal Bhatt
    0

    First of all, Thanks Jan for the reply.

     I am getting following error while saving following code:

      <xsl:variable name="propertyAlias" select="string('articleAuthor')"/>
      <xsl:variable name="memberno" select="$currentPage/* [name() = $propertyAlias]"/>
      <xsl:variable name="member1" select="umbraco.library:GetMember($memberno)" />

    System.OverflowException: Value was either too large or too small for an Int32.
    at System.Convert.ToInt32(Double value)
    at System.Double.System.IConvertible.ToInt32(IFormatProvider provider)
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    at System.Xml.Xsl.Runtime.XmlQueryRuntime.ChangeTypeXsltArgument(XmlQueryType xmlType, Object value, Type destinationType)
    at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
    at member1(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
    at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver)
    at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

    But after i mark the "Skip testing (ignore errors)" checkbox. I can save it and i get following output:

    <node id="1124" version="19bef398-11a1-45ce-b95a-b774c082bf39" parentID="-1" level="1" writerID="0" nodeType="1123" template="0" sortOrder="60" createDate="2010-11-21T07:41:46" updateDate="2010-11-21T07:41:46" nodeName="Pinal Bhatt (Author)" urlName="pinalbhatt(author)" writerName="Administrator" nodeTypeAlias="ContentWriter" path="-1,1124" loginName="pinalbhattauthor" email="[email protected]"><authorsName>Pinal Bhatt</authorsName><authorsEmail>[email protected]</authorsEmail><authorsWebsiteUrl>http:/www.P-Bhatt.com</authorsWebsiteUrl><authorsPicUrl /></node>

    Which is very much valid and expected output. Now how can i get individual piece of data from this?

    Thanks & Regards

    Pinal Bhatt

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Nov 22, 2010 @ 22:22
    Jan Skovgaard
    0

    Hi Pinal

    you're welcome, that's what we're here for, right? :-)

    Now you should be able to fetch the data you want by getting the content from the <authorsName> and <authorsEmail> elements...

    You can do that by writing

    Name: <xsl:value-of select="$member1/authorName" /><br />

    E-mail: <xsl:value-of select="$member1/authoerEmail" />

    This should work.

    /Jan

  • Pinal Bhatt 298 posts 389 karma points
    Nov 22, 2010 @ 22:43
    Pinal Bhatt
    0

    Nops.. sorry but thats not working: ( you can have a look at http://pbdesk.com/tech-news-articles/articles/umbraco/test-article.aspx )

    Following is the xslt code:

      <xsl:variable name="propertyAlias" select="string('articleAuthor')"/>
      <xsl:variable name="memberno" select="$currentPage/* [name() = $propertyAlias]"/>
      <xsl:variable name="member1" select="umbraco.library:GetMember($memberno)" />

    <xsl:template match="/">
       <div class="test">
       <textarea>
           <xsl:copy-of select="$member1" />
       </textarea>   
         Name: <xsl:value-of select="$member1/authorsName" /><br />
       E-mail: <xsl:value-of select="$member1/authorsEmail" />
        </div>
    </xsl:template>
    Also how can i get the values out of attrubutes: loginName,email?

  • Pinal Bhatt 298 posts 389 karma points
    Nov 22, 2010 @ 23:06
    Pinal Bhatt
    0

    Putting // works. 

    Name: <xsl:value-of select="$member1//authorsName" /><br />
    E-mail: <xsl:value-of select="$member1//authorsEmail" />
    Thanks for your support.
    - Pinal Bhatt

  • Pinal Bhatt 298 posts 389 karma points
    Nov 22, 2010 @ 23:11
    Pinal Bhatt
    0

    All of these works:

     

        Name: <xsl:value-of select="$member1//authorsName" /><br />
      E-mail: <xsl:value-of select="$member1/node/authorsEmail" /><br/>
             Login Name: <xsl:value-of select="$member1/node/@loginName" />
          Login Name: <xsl:value-of select="$member1//@loginName" />

     

  • Anders Brohäll 295 posts 561 karma points c-trib
    Dec 05, 2010 @ 14:47
    Anders Brohäll
    0

    Excellent, helped me out too!

    Why do you need the double slash?
    Anyone knows?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies