Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Librarians and Library Staff often are not programmers and vary wildly in their experience writing any sort of code. This works as a crash course in programing for Alma Letters. This is information I wish I knew before I started working on Letters. Provided information includes XSLT Basics and Specific codes to paste into Letters for desired effects.

Please note I am self taught and this is not comprehensive. If there is any information you want added or changed please let me know at cwlee@calstate.edu.

 Table of Contents and Links

Recommended Habits

Alma Letters can be complicated and are often edited by different people over time. To keep things simple, and to avoid issues, there are several habits you should consider developing when working with Letters.

  • Copy the Letter and save it in a folder on your computer, drive, or department server before editing. Then if something goes wrong you can easily restore the previous version of the letter.

  • Click Preview after every change to see if the change breaks the code.

  • Keep a change log of some sort. This can be a note in the code using Note Tags (<!-- Note Text -->).

  • Formatting and spacing in the code isn’t as strict as other forms of programming, but keeping things formatted will make it easier for you, and future code editors, to read and understand. I recommend pasting the code into a XML formatter to keep it formatted after editing. I use this one: https://www.freeformatter.com/xml-formatter.html

XSLT Basics

When writing XSLT you need to keep in mid that the code needs an opening and closing tag for each action. An opening tag is formatted as <X> and a closing tag is </X>. For every opening tag there must be a closing tag. Everything between the two tags has the effect of that tag, so it will be on the same row or cell, have the same font, or all be highlighted depending on the tag used.

Tags

Many tags and elements are used repeatedly to achieve desired formatting. This section will go over many common formatting codes in Rapido. Like many programming codes these tags need to be placed before text or element and the closing tag needs to be placed after the text or element.

Rows and Cells

The most common code in Alma Letters are the <tr>, <td>, and <th> tags.

  • <tr> is a row. Use this when you want the nested information on its own line. Close a row with </tr>

  • <td> is a basic cell. This is a space to add standard text or images. Close a cell with </td>

  • <th> is a header cell. Text in this cell will be bold and centered. Close a header with </th>

Formatting

  • <font color="X"> is used to change the following text’s basic color. For example <font color="red"> will make the text red. Close with </font> when you want the text to return to the default color.

  • <b> is used to make the text bold. Close with </b>.

Pulling Information from XML

Another common code is the <xsl> tag. This tag is used to tell the rest of the code what to do. I think of it as the “logic” rules of the code.

  • <xsl:value-of select="X" /> tells the XSLT code to input the information from a specific location in the XML generated in Alma. For example, the code <xsl:value-of select="notification_data/metadata/title" /> will pull the book title from the XML listed at notification_data/metadata/title. Since the tag contains a / it opens and closes itself and does not need a closing tag.

  • <xsl:if test="X='Y' "> For Example, <xsl:if test="notification_data/incoming_request/format='PHYSICAL' "> will only use the code between this opening and closing tag if the Alma generated XML lists PHYSICAL as the variable at notification_data/incoming_request/format. Close with </xsl:if>

Alma Specific Codes

Several codes are specific to Alma and pull information from behind the scenes in Alma. These include things such as Barcodes and Labels.

Barcodes

One of the most important codes for printed Letters are the barcode files. Technically you can use code to make anything a barcode with a barcode font, but those barcodes are often too big to scan with library scanners. Thankfully there are several codes for Alma specific barcode files generated in Alma. The following can be pasted into Letters to generate a barcode:

External ID (Full)

The following code will add a barcode for the full External Identifier. This version of the External ID may contain the 01// or 02// prefixes, which may prevent the barcode from scanning properly at the Borrowing Library. This is why this barcode works for articles and book chapters but not shipping items.

                                <tr>
                                   <td>
                                      <img src="cid:externalId.png" alt="externalId" />
                                   </td>
                                </tr>

External ID (truncated)

The following code will generate the External ID without the 01// or 02// prefixes. The official name of this ID is the Group Qualifier. This code works both at the Lending and Borrowing library and should be used when possible. This barcode is not available in all letters at the moment. Ex Libris will add it to more Letters in a future update.

                          <tr>
                             <td>
                                <img src="cid:group_qualifier.png" alt="group_qualifier" />
                             </td>
                          </tr>

Internal ID

The following code will add a barcode for the Internal ID. This barcode is important for the article and book chapter paperwork because the scanned or downloaded files need to be saved as the Internal Identifier.

                                <tr>
                                   <td>
                                      <img src="cid:resource_sharing_request_id.png" />
                                   </td>
                                </tr>
  • No labels