How do I add the preferred name fields to my Alma letters?
Answer
In order to add the preferred name fields to your Alma letters, you will need to edit the senderReceiver and mailReason letter component templates. Information on how to edit letter components can be found here:
https://sunyolis.libanswers.com/faq/277717
Code for the senderReceiver and mailReason components that includes the preferred name fields can be found below. This code will add the preferred name fields to your letters if they have values in them. If they don;t, the regular name fields will be added to your letters. The portions of the code that specifically refer to the name fields are in bold.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="senderReceiver">
<table cellspacing="0" cellpadding="5" border="0" width="100%">
<tr>
<td width="50%">
<xsl:choose>
<xsl:when test="notification_data/user_for_printing">
<table cellspacing="0" cellpadding="5" border="0">
<xsl:attribute name="style">
<xsl:call-template name="listStyleCss" /> <!-- style.xsl -->
</xsl:attribute>
<tr><td><b>
<xsl:choose>
<xsl:when test="notification_data/user_for_printing/preferred_first_name !=''">
<xsl:value-of select="notification_data/user_for_printing/preferred_first_name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="notification_data/user_for_printing/first_name"/>
</xsl:otherwise>
</xsl:choose>
 
<xsl:choose>
<xsl:when test="notification_data/user_for_printing/preferred_last_name !=''">
<xsl:value-of select="notification_data/user_for_printing/preferred_last_name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="notification_data/user_for_printing/last_name"/>
</xsl:otherwise>
</xsl:choose>
</b></td></tr>
<tr><td><xsl:value-of select="notification_data/user_for_printing/address1"/></td></tr>
<tr><td><xsl:value-of select="notification_data/user_for_printing/address2"/></td></tr>
<tr><td><xsl:value-of select="notification_data/user_for_printing/address3"/></td></tr>
<tr><td><xsl:value-of select="notification_data/user_for_printing/address4"/></td></tr>
<tr><td><xsl:value-of select="notification_data/user_for_printing/address5"/></td></tr>
<tr><td><xsl:value-of select="notification_data/user_for_printing/city"/> <xsl:value-of select="notification_data/user_for_printing/postal_code"/></td></tr>
<tr><td><xsl:value-of select="notification_data/user_for_printing/state"/> <xsl:value-of select="notification_data/user_for_printing/country"/></td></tr>
</table>
</xsl:when>
<xsl:when test="notification_data/receivers/receiver/user">
<xsl:for-each select="notification_data/receivers/receiver/user">
<table>
<xsl:attribute name="style">
<xsl:call-template name="listStyleCss" /> <!-- style.xsl -->
</xsl:attribute>
<tr><td><b>
<xsl:choose>
<xsl:when test="notification_data/receivers/receiver/user/preferred_first_name !=''">
<xsl:value-of select="notification_data/receivers/receiver/user/preferred_first_name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="notification_data/receivers/receiver/user/first_name"/>
</xsl:otherwise>
</xsl:choose>
 
<xsl:choose>
<xsl:when test="notification_data/receivers/receiver/user/preferred_last_name !=''">
<xsl:value-of select="notification_data/receivers/receiver/user/preferred_last_name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="notification_data/receivers/receiver/user/last_name"/>
</xsl:otherwise>
</xsl:choose>
</b></td></tr>
<tr><td><xsl:value-of select="user_address_list/user_address/line1"/></td></tr>
<tr><td><xsl:value-of select="user_address_list/user_address/line2"/></td></tr>
<tr><td><xsl:value-of select="user_address_list/user_address/city"/> <xsl:value-of select="user_address_list/user_address/postal_code"/></td></tr>
<tr><td><xsl:value-of select="user_address_list/user_address/state_province"/> <xsl:value-of select="user_address_list/user_address/country"/></td></tr>
</table>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</td>
<td width="50%" align="right">
<xsl:for-each select="notification_data/organization_unit">
<table>
<xsl:attribute name="style">
<xsl:call-template name="listStyleCss" /> <!-- style.xsl -->
</xsl:attribute>
<tr><td><xsl:value-of select="name"/></td></tr>
<tr><td><xsl:value-of select="address/line1"/></td></tr>
<tr><td><xsl:value-of select="address/line2"/></td></tr>
<tr><td><xsl:value-of select="address/city"/></td></tr>
<tr><td><xsl:value-of select="address/postal_code"/></td></tr>
<tr><td><xsl:value-of select="address/country"/></td></tr>
</table>
</xsl:for-each>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="toWhomIsConcerned">
<table cellspacing="0" cellpadding="5" border="0">
<tr>
<td>
<xsl:for-each select="notification_data">
<p>
<xsl:attribute name="style">
display:block; font-size:1.17em; margin-left:0; margin-right:0; font-weight:bold;
</xsl:attribute>
<xsl:choose>
<xsl:when test="receivers/receiver/user/preferred_first_name !=''">
<xsl:value-of select="receivers/receiver/user/preferred_first_name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="receivers/receiver/user/first_name"/>
</xsl:otherwise>
</xsl:choose>
 
<xsl:choose>
<xsl:when test="receivers/receiver/user/preferred_last_name !=''">
<xsl:value-of select="receivers/receiver/user/preferred_last_name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="receivers/receiver/user/last_name"/>
</xsl:otherwise>
</xsl:choose>
</p>
</xsl:for-each>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>