
Field Types
❘
103
3. Replace the <your token> section of the snippet with the public key token you obtained in
step 5 of the previous steps.
Creating the XSL Style Sheet
Now that you created your eld denition, you can create your XSL Style Sheet, which handles ren-
dering of the eld when it appears in the list view. For this view, you need to mask the value of the
SSN so that only the last four digits of the SSN display.
Edit the
fldtypes_Wrox.SSNField.xsl and replace the contents of the file with the following
XML snippet:
<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”>
<xsl:template match=”FieldRef[@FieldType = ‘SocialSecurityNumber’]“
mode=”Text_body”>
<xsl:param name=”thisNode” select=”.” />
<xsl:param name=”value” select=”$thisNode/@*[name()=current()/@Name]“ />
<xsl:choose>
<xsl:when test=”string-length($value) = 11”>
<span>
XXX-XX-<xsl:value-of select=
“substring($value, ...