Overriding the "Text" Label in Koha: A Step-by-Step Guide to Customizing XSLT Display

If you’ve ever looked at your Koha OPAC and wondered why your carefully cataloged Theses or Articles are simply showing up as the generic label "Text," you aren't alone.

While many believe this requires "pasting" raw XSLT code into a text box (like you might do with JavaScript), Koha actually handles XSLT through server-side files and administrative mappings. To change "Text" to "Thesis," you need to tell Koha to prioritize your custom descriptions over its default internal logic.

Here is exactly how to fix the "Text" label in the Koha Administration panel.

Step 1: Check Your Current XSLT Configuration

Before making changes, identify which display file your system is currently using.

  1. Navigate to Koha Administration $\rightarrow$ Global System Preferences.

  2. Search for the preference: OPACXSLTResultsDisplay.

  3. Analyze the value:

    • default: Koha is using its internal "Standard" display.

    • File Path (e.g., opac-main.xsl): Your library is using a custom file located on the server.

Step 2: The "Authorized Values" Solution (The Easiest Fix)

Most Koha XSLT files are programmed to look at your Item Type Descriptions first. If the display shows "Text," it usually means your Item Type "Description" is either empty or literally set to "Text."

  1. Go to Koha Administration $\rightarrow$ Item Types.

  2. Find the code for your category (e.g., THE for Thesis).

  3. Click Edit.

  4. In the Description field, type exactly what you want the user to see (e.g., Thesis).

  5. Crucial: Look for the Search category dropdown. If it is set to "Books" or "None," try changing it to a custom category or leaving it blank to see if the display updates.

  6. Repeat this for other types like BIB (Citation) or ART (Article).

Why this works: The XSLT logic is essentially: "If an Item Type Description exists, show it. Otherwise, fallback to the default 'Text' label based on the MARC Leader." By filling this in, your custom label "wins."

Step 3: Mapping 942$c (The Framework Fix)

For the XSLT to "see" the description you just created, your Bibliographic record must be properly linked to the Item Type.

  1. Go to Koha Administration $\rightarrow$ MARC Bibliographic Framework.

  2. Select your framework (e.g., Default) and click MARC structure.

  3. Search for Tag 942 and click Edit Subfields.

  4. Locate Subfield c and ensure the "Koha field" is mapped to biblioitems.itemtype.

  5. Save your changes.

Step 4: The Server-Side "Nuclear Option"

If you have access to the Linux terminal (via PuTTY/SSH) and the above steps don't yield the desired result, you can edit the physical XSLT file on the server.

  • File Path: /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl

  • Action: Search for the term "Material type." You will find a code block starting with <xsl:choose>. This is where you can manually insert logic to override the "Text" string with your preferred terminology.


Your Implementation Checklist

To ensure your changes take effect immediately, follow this quick checklist:

  • [ ] Item Types: Does the "Description" for THE say "Thesis"? (Check Admin > Item Types)

  • [ ] Framework Mapping: Is 942$c correctly mapped to biblioitems.itemtype? (Check Admin > Framework)

  • [ ] Index Refresh: After making these changes, you may need to run a rebuild of your search index from the terminal:

    koha-rebuild-zebra -v -f [instancename]

Comments

Popular posts from this blog

How to Link Calibre to Koha

On-Screen Keyboard Urdu/Arabic/Sindhi

Koha Installation Commands