SharePoint XSL

I have a business data list that pulls info from External Content List (SQL).  I have one field that displays an email address.  I would like for users to be able to click on the email text and enter a mailto function.  I am unsure what to edit and how to edit the XSL format.

Here is the section of the XSL that probably needs to be edited:

Direction is appreciated.
<td class="ms-vb">
        <xsl:attribute name="style">
          <xsl:choose>
            <xsl:when test="$dvt_1_form_selectkey = @*[name()=$ColumnKey]">color:blue</xsl:when>
            <xsl:otherwise />
          </xsl:choose>
        </xsl:attribute>
        <xsl:variable name="fieldValue">
          <xsl:call-template name="LFtoBR">
            <xsl:with-param name="input">
              <xsl:value-of select="@primaryEmail" />
            </xsl:with-param>
          </xsl:call-template>
        </xsl:variable>
        <xsl:copy-of select="$fieldValue" />
      </td>

Open in new window

LVL 1
ICGAsked:
Who is Participating?
 
Geert BormansInformation ArchitectCommented:
<xsl:template name="mail">
  <xsl:param name="input"/>
  <a href="mailto:{$input}>
    <xsl:value-of select="$input"/>
  </a>
</xsl:template>

and call like this

          <xsl:call-template name="mail">
            <xsl:with-param name="input">
              <xsl:value-of select="@primaryEmail" />
            </xsl:with-param>
          </xsl:call-template>

instead of

          <xsl:call-template name="LFtoBR">
            <xsl:with-param name="input">
              <xsl:value-of select="@primaryEmail" />
            </xsl:with-param>
          </xsl:call-template>
0
 
ICGAuthor Commented:
@Gertone: Solution ended up being similiar to what you said, but your solution did not quite work (not sure if SP or something else).  I added mailto field through SharePoint designer and customized XSL code accordingly.

I posted template below.
<xsl:param name="input"/>
  <a href="mailto:{@Email}?subject=Happy Birthday"><xsl:value-of select="@Email" /></a>
</xsl:template>

Open in new window

0
 
ICGAuthor Commented:
Thanks for the help, Gertone.
0
 
Geert BormansInformation ArchitectCommented:
Well, this has nothing to do with the version of SP,
you are simply not passing the correct value to the template as a parameter
and you are using the attribute of the context node, which is just fine

but drop this line then
<xsl:param name="input"/>
you ar not using it

cheers
0
 
ICGAuthor Commented:
Gertone's solution was almost perfect, but template needed a little adjusting to work in SP2010.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.