Wednesday, February 29, 2012

Person fields (createdBy, ModifiedBy) field in XSLT

Created By  and Modified fields are shown as rich text in SPD.
If we convert to Text format we can see the html as below

<nobr><span><A HREF="/sites/home/_layouts/userdisp.aspx?ID=100">Rajesh Pillai</A><img border="0" height="1" width="3" src="/_layouts/images/blank.gif"/><a href='javascript:' onclick='IMNImageOnClick();return false;' class='ms-imnlink'><img name='imnmark' title='' border='0' height='12' width='12' src='/_layouts/images/blank.gif' alt='No presence information' sip='rajesh.pillai@live.com' id='imn_2225,type=smtp'/></a></span></nobr>

To customize these fields in xslt we need to write some extra steps
1. To get the Email address
<xsl:value-of select= 'substring-before(substring-after(@Author, concat("sip=",$dvt_apos)), $dvt_apos)' disable-output-escaping="no"/>

2. To show only the name
<xsl:variable name="Name" select="substring-before(substring-after(string(@Author),'&quot;&gt;'),'&lt;/A&gt;'"/>

1 comment:

  1. Hello Sir,

    Since i am new to SharePoint and XSLT, not able to find the error.

    In SharePoint template Absence and responsibility adoption i have applied for 7 days leave in the calendar with enabling the Recurrence column.
    The record is created in the List... that is fine.

    I have entered few records in Responsibility Adoption. I can't see these few of matched records by clicking on the calendar record(Leave with recurrence) which i have applied.


    If i applied without recurrence, then i am able to see those matched records.

    May i know the reason why?... Thank you.


    Regards
    Yogi

    ReplyDelete