Skip to Main Content
the logo for the Library Services Platform: California Community Colleges

Systems Work Group

LSP Systems Work Group Main LibGuide- information on events, documentation, and resources

Letter Configuration Components

Letters in Alma have 3 primary components:

  • XML
    • Dynamic data generated by Alma
  • Labels
    • Static text
  • XSL
    • Formatting template and logic

XML

What is XML?

  • eXstensible Markup Language
  • Used to store and move data

How XML is used in Alma Letters

XML contains the dynamic data used to generate letters and notifications. This can be thought of as context-specific, event-driven data.

  • For example, the XML for an overdue notification will contain the details of the loan, including user information (user group, primary ID, roles), physical item information (barcode, description, call number), loan specific information (loan desk, library id, location code).

XML Components

Element
  • In XML, an element is a component of the document that either begins with a start-tag and ends with a matching end-tag or consists only of an empty-element tag. The characters between the start-tag and end-tag, if any, are the element’s content.

Path

  • path in XML is a sequence of elements, separated by slashes (/), that leads to a specific element in the document.

XML Path Example

<user_for_printing>
    <active_balance>
        <currency></currency>
        <normalized_sum></normalized_sum>
        <sum></sum>
        <vat></vat>
    </active_balance>
    <address1></address1>
    <address2></address2>
    <address3></address3>
    <address4></address4>
    <address5></address5>
    <blocks></blocks>
    <city></city>
    <country></country>
    <country_display></country_display>
    <email></email>
    <first_name></first_name>
    <gender></gender>
    <identifiers>
        <code_value>
            <code>Primary Identifier</code>
            <value>12345678</value>
        </code_value>
    </identifiers>
    <last_name></last_name>
    <middle_name></middle_name>
    <name></name>
    <phone></phone>
    <postal_code></postal_code>
    <preferred_first_name></preferred_first_name>
    <preferred_last_name></preferred_last_name>
    <preferred_middle_name></preferred_middle_name>
    <state></state>
    <title></title>
    <user_group></user_group>
    <user_title></user_title>
</user_for_printing>

In this example, <user_for_printing> is the root element. It contains child elements such as <active_balance><address1>, and <identifiers>. The relative path to the <value> element inside the <identifiers> element, which contains the user's Primary Identifier, would be /user_for_printing/identifiers/code_value/value. The full path would be /notification_data/user_for_printing/identifiers/code_value/value

Labels

  • Static strings of text that can be easily updated or translated
  • Allow end-users to adjust the language used in a letter without modifying the XSL template
  • Represented in the XSL template by @@label_code@@
  • Can be toggled on/off

XSLT

XSLT (Extensible Stylesheet Language Transformations) documents transform XML data into an HTML document. Here’s a high-level breakdown of the structure and components of the XSLT in an Alma loan receipt notification:

  1. Includes: The XSLT document begins by including several other XSL files, each defining templates for different parts of the final HTML document. These include header.xslsenderReceiver.xslmailReason.xslfooter.xslstyle.xsl, and recordTitle.xsl.

  2. Main Template: The main template matches the root of the XML input document (match="/") and generates the HTML document’s structure. It includes the HTML, head, and body elements.

  3. Conditional Language Attribute: Inside the HTML element, there’s a conditional statement that checks if a language string exists in the XML input (notification_data/languages/string). If it does, it sets the lang attribute of the HTML element to this value.

  4. Head Element: The head element includes a title, which is set to the subject from the XML input (notification_data/general_data/subject), and calls a template named generalStyle.

  5. Body Element: The body element includes several called templates (headsenderReceivertoWhomIsConcernedlastFooter) that generate different parts of the HTML body. It also includes a div for the message area, which contains a table for displaying loan information.

  6. Loan Information Table: The table includes a loop (xsl:for-each) that iterates over each loan in the XML input (notification_data/loans_by_library/library_loans_for_display) and generates a row in the table for each one.