Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

How do I get the Author Login in the a CustomItemStyle.xsl file?

$
0
0

Hi,

Does anyone know how to get the Author Login? I am have a custom Content Type called "CustomAnnouncements" which the Content Query Web part picks up. Problem is I am trying to put the picture of the Author in the Content Query Web Part. We have a CustomItemnStyle.xsl file already used for this so all I wanted to do was put the Authors Picture in. When looking at the link $authorlogin is blank.  This is what I did, but the field is blank:

1. Put xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" at top of file. 

2. Added code in Bold

......

 <xsl:variable name="Author">
  <xsl:call-template name="OuterTemplate.GetGroupName">
   <xsl:with-param name="GroupName" select="@ModifiedBy" />
   <xsl:with-param name="GroupType" select="User" />
  </xsl:call-template>
 </xsl:variable>
 <xsl:variable name="authorlogin">
  <xsl:value-of select="translate(ddwrt:UserLookup(string(@Author) ,'Login'),'\','_')" />
 </xsl:variable>
 <xsl:variable name="Created">
  <xsl:call-template name="OuterTemplate.GetGroupName">
   <xsl:with-param name="GroupName" select="@CreatedOn" />
   <xsl:with-param name="GroupType" select="DateTime" />
  </xsl:call-template>
 </xsl:variable>

 <table id="announcementsTable">
  <tr>
   <td class="announcementTitle">
    <img src="http://oursite/User%20Photos/Profile%20Pictures/{$authorlogin}_LThumb.jpg" alt="" style="width:62px;"/>
    <br />
    <span class="title"><xsl:value-of select="$DisplayTitle"/></span>
    <br />
    <span class="editor">by: <xsl:value-of select="$Author" /></span>
    <br />
    <span class="date">on: <xsl:value-of select="$Created"/></span>
   </td>
   <td></td>
   <td class="announcmentBody">
    <xsl:value-of select="substring(@Body,0,500)" disable-output-escaping="yes"/>
   </td>
  </tr>
  <tr><td></td><td></td><td colspan="3"><a href="#" onclick="javascript: openPopup('{$SafeLinkUrl}','{$DisplayTitle}','{$Author}','{$Created}','{@Body}'); return false;" onmouseover="javascript:this.style.cursor='hand';">Read full announcement here</a></td></tr>
 </table>

                                                        


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>