Answers to Common Questions related to XSLT

If you've ever wondered how to do a specific cool thing with your letter, look no further! Here are some common solutions to questions we have received. If there's a question you have that is not answered here, please email natasha. 

How to add a label to your letter's sender

Some of you may have noticed after sending a letter to your patron that the sender label only shows the email address. This is easily fixed with the following steps. 


  1. Go to Alma > Administration > General Configuration > Letter Emails 
  2. Find the letter you want to edit > Click Actions > Edit
  3. Find the addressFrom Code and add your label and the email address. 
  4. Save the change, then send the letter out again. You should see something like this:

 For more information: 

https://knowledge.exlibrisgroup.com/Alma/Product_Documentation/Alma_Online_Help_(English)/Administration/050Configuring_General_Alma_Functions/070Configuring_Alma_Letters#Configuring_Letter_Labels

How to create a "My Account" Link in emails

Do you want to add a link to a patron's Primo account in their emails? Here's how to do this. Note: you must have the letter administrator role to make edits. 

  1. Go to General Configuration > Configuration Menu > Other Settings
  2. Find the email_my_account parameter and add the direct link to your log in page. If you are finding that your page is not linking directly to the log in page, make a one small edit and replace "search" or "login" with "account": https://sjsu-primo.hosted.exlibrisgroup.com/primo-explore/account?vid=[your school code]&sortby=rank&lang=en_US. For your convenience, I have included some parameters that may or may not need editing. 

    1. 8. Email contact: ex libris does not use this field anything. In fact, if you try to edit it, it will tell you it can't save it. 
      9. email_contact_us: You can put an email or link in here. We linked out to our Ask a Librarian page.
      10. email_deposit_contact: Ex Libris does not use this field. Do not customize.
      11. email_deposit_sender: Not in use
      12. email_my_account: this is what the My Account link in the footer will link out to. 

      More info is here: https://knowledge.exlibrisgroup.com/Alma/Product_Documentation/Alma_Online_Help_(English)/Administration/050Configuring_General_Alma_Functions/080Configuring_Other_Settings 




  3. For each letter, you will need to edit your footer to include these links. Go to General Configuraton > Configuration Menu > Customize letters > Find the letter you want to edit > click customize > edit > replace the footer.xsl area with this code:



  4. Click save and send out a test letter. Your letter should now have the account link included.


How to Add a Social Log In to Your Letter Footer

Note: this may not work for Gmail users

  1.  Add this section to your footer.xsl. Replace all links with your own library's week.


<xsl:template name="socialMediaLinks">

<div align="center">

<a href="https://www.snapchat.com/add/sdsulibrary">
  <img src="http://tylerrogers.sdsu.edu/social_logos/Snapchat-crimson.png" alt="SDSU Library on Snapchat" style="width:42px;height:42px;border:0;"></img>
</a>
<a href="https://www.facebook.com/SDSULibrary">
  <img src="http://tylerrogers.sdsu.edu/social_logos/Facebook-crimson.png" alt="SDSU Library on Facebook" style="width:42px;height:42px;border:0;"></img>
</a>
<a href="https://www.youtube.com/channel/UCRPX9VGLzTkJB0HjPNo3ABw">
  <img src="http://tylerrogers.sdsu.edu/social_logos/Youtube-crimson.png" alt="SDSU Library on Youtube" style="width:42px;height:42px;border:0;"></img>
</a>
<a href="https://twitter.com/sdsulibrary">
  <img src="http://tylerrogers.sdsu.edu/social_logos/Twitter-crimson.png" alt="SDSU Library on Twitter" style="width:42px;height:42px;border:0;"></img>
</a>
<a href="https://www.instagram.com/sdsulibrary/">
  <img src="http://tylerrogers.sdsu.edu/social_logos/Instagram-crimson.png" alt="SDSU Library on Instagram" style="width:42px;height:42px;border:0;"></img>
</a>
</div>

</xsl:template>

2. Add this section in the .xsl file of the letter that is to be sent:

        <!-- footer.xsl -->

        <xsl:call-template name="lastFooter" />
         <xsl:call-template name="myAccount" />
         <xsl:call-template name="contactUs" />
         <xsl:call-template name="socialMediaLinks" />

How to Add an IF/WHEN Statement to Your Letter

This applies to letters where you only want certain information to be sent to a patron based on certain criteria. In the below example, a line of text is added for only specific patron groups.  

  1. Add this to to the letter you are editing and change the wording/patron groups as you see fit. 

    1. <!-- Send a message only to undergraduates about returning books. -->
      <xsl:choose>
      <xsl:when test="notification_data/item_loan/user_type='UNDERGRADUATE'">
      <h><b>A HOLD has been placed on your academic record until the item is returned and/or all charges on your library record are paid.</b></h>
           </xsl:when>
      <xsl:when test="notification_data/item_loan/user_type='GRADUATE'">
      <h><b>A HOLD has been placed on your academic record until the item is returned and/or all charges on your library record are paid.</b></h>
           </xsl:when>
                                 <xsl:otherwise> 
                                    <h><b>Please contact us if you have questions or need assistance.</b></h>
                                 </xsl:otherwise> 
      </xsl:choose> 


How to Add Spacing between colons and other areas of a letter. 

This might apply to a letter such as the FulLostLoan Letter or Lost and Overdue Letter. 

Find the area you want to edit, then format it like this:

  1. <table>
    <tr>
    <td>
    <b>@@lost_item@@ :</b> <xsl:value-of select="item_loan/title"/>
    <br />
    <b>@@description@@ :</b><xsl:value-of select="item_loan/description"/>
    <br />
    <b> @@by@@ :</b><xsl:value-of select="item_loan/author"/>
    <br />
    <b>@@library@@ :</b><xsl:value-of select="organization_unit/name"/>
    <br />
    <b>@@loan_date@@ :</b><xsl:value-of select="item_loan/loan_date"/>
    <br />
    <b>@@due_date@@ :</b><xsl:value-of select="item_loan/due_date"/>
    <br />
    <b>@@barcode@@ :</b><xsl:value-of select="item_loan/barcode"/>
    <br />
    <b>@@call_number@@ :</b><xsl:value-of select="phys_item_display/call_number"/>
    <br />
    <b>@@charged_with_fines_fees@@ </b>
    </td>
    </tr>
    </table>