This project is read-only.

Use of GetUserName

May 26, 2011 at 9:42 PM
Edited May 26, 2011 at 9:44 PM

I am trying to use the Getusername template in SP1010. I have the following but is not working. I get a Named Template GetuserName does not exist in the stylesheet error? what am I doing wrong? thanks

Dean

<Xsl>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
  <xsl:import href="http://parsharesites.parsons.com/corp/Policies/Style%20Library/XSL%20Style%20Sheets/GetUserName.xsl"/>
<xsl:output method="html" indent="no"></xsl:output>
  <xsl:include href="/_layouts/xsl/main.xsl"/>
  <xsl:include href="/_layouts/xsl/internal.xsl"/>
        <xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]"/>
        <xsl:param name="dvt_apos">&#39;</xsl:param>
      <xsl:template match="FieldRef[(@Encoded) and @Name='Role']" ddwrt:dvt_mode="body" mode="Lookup_body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
          <xsl:param name="thisNode" select="."/>
    <xsl:value-of select="substring-after(substring-before($thisNode/@*[name()=current()/@Name],'&lt;/a&gt;'),'&gt;')" />
  </xsl:template>
 <xsl:template name="FieldRef_User_body.Person" ddwrt:dvt_mode="body" match="FieldRef[@Name='Person']" mode="User_body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
     <xsl:param name="thisNode" select="."/>
     <xsl:variable name="ID">
   <xsl:call-template name="ResolveId">
    <xsl:with-param name="thisNode" select="$thisNode" />
   </xsl:call-template>
  </xsl:variable>
    <xsl:call-template name="GetUserName">
      <xsl:with-param name="Person" select="@Person"/>
    </xsl:call-template>

  </xsl:template></xsl:stylesheet></Xsl>
</WebPartPages:XsltListViewWebPart>

Coordinator
May 26, 2011 at 10:05 PM

Dean:

It doesn't look like you have the GetUserName template in your XSL, though you are calling it. Odds are that the href you are specifying in the xsl:import isn't valid.

Also, remember that case matters in XSL.

M.

May 27, 2011 at 4:05 PM

Marc, i have doubled checked the url in the xsl:import statement by clicking on it in SPD and it opens the xls file so it appears to be correct. Any other suggestions?

TIA

Dean

Coordinator
May 28, 2011 at 5:04 AM

Dean:

Well, without seeing all the piece parts, I'm guessing, but you're calling:

<xsl:call-template name="GetUserName">

You've got an xsl:import and two xsl:includes:

<xsl:import href="http://parsharesites.parsons.com/corp/Policies/Style%20Library/XSL%20Style%20Sheets/GetUserName.xsl"/>
<xsl:output method="html" indent="no"></xsl:output>
<xsl:include href="/_layouts/xsl/main.xsl"/> 
<xsl:include href="/_layouts/xsl/internal.xsl"/>

Note that the GetUserName.xsl import iss prior to the xsl:output and the other two are after. Try reordering?

Also, as I mentioned, case matters. Is the template spelled exactly GetUserName?

M.