Tech Blog

Replace Content of Specific MARC Field in Voyager WebVoyage with a Graphic


This blog post provides basic instructions for replacing  a MARC field (for example, the 590) with a graphic in the Voyager WebVoyage (“Tomcat”) OPAC.

This is accomplished by matching content in the MARC field’s subfield (for example, the 590a).

In these instructions, a custom template is created within the display.xsl file to handle the processing for the 590 field.  It inserts a small graphic and optional text (to exclude any optional text, simply insert a space as per the instructions that follow).

When the content of the subfield is matched, the entire content of the MARC field is replaced by the graphic.

A number of individuals were involved in the development of this code.  It is supplied “as is,” and is confirmed to be working in Voyager version 10.1.


Small graphic image for insertion into OPAC to place in /images

Edit /xsl/contentLayout/display/display.xsl and /xsl/contentLayout/configs/displaycfg.xml 


Step 1

Create your graphic and place it in the vwebv/ui/your_skin/images directory

Step 2

Backup display.xsl before editing it.

Locate this section of code in the processDisplay Tags template:

<xsl:when test="@field &lt; '1000'">
<xsl:call-template name="BMDProcessMarcTags">
<xsl:with-param name="field" select="@field"/>
<xsl:with-param name="indicator1" select="@indicator1"/>
<xsl:with-param name="indicator2" select="@indicator2"/>
<xsl:with-param name="subfield" select="@subfield"/>
<xsl:with-param name="mfhdID" select="$mfhdID"/>
<xsl:with-param name="recordType" select="$recordType"/>

Insert the following after the above code:

<xsl:when test="@field='MORI'">
<xsl:call-template name="special590Display">
<xsl:with-param name="marc" select="$bibRecord/hol:marcRecord"/>

Note that you can substitute any code for “MORI” but it must be four characters and you must also change the code in Step 5 accordingly.

Step 3

Locate </xsl:stylesheet> at the bottom of the file

Insert the following code just above </xsl:stylesheet>:

<xsl:template name="special590Display">
<xsl:param name="marc"/>
<xsl:variable name="MEMList">
<xsl:for-each select="$marc/slim:datafield[@tag='590']">
<xsl:if test="slim:subfield[@code='a']">
<xsl:variable name="memorialCheck">
<xsl:for-each select="slim:subfield[@code='a']">
<xsl:value-of select="."/>
<xsl:if test="contains($memorialCheck,'In memory of')">
<img src="" />
<xsl:value-of select="memorialCheck" />
<br />

<xsl:if test=”string-length($MEMList)”>
<xsl:copy-of select=”$MEMList”/>

Note that your image source needs to be what the browser can read, not the path from the root of the server.

To not include any optional text, you can use a blank character. Example: <xsl:text> </xsl:text>

Also note that this line specifies the match code: <xsl:if test=”contains($memorialCheck,’In memory of’)”>

Step 4 

Save the file

Step 5

Backup displaycfg.xml before editing it.

Comment out the displayTag code for the MARC field you want to change and insert the code for your new displaTag:

<!-- <displayTag field="590" indicator1="X" indicator2="X" subfield="a"/> -->
<displayTag field="MORI"/>

Step 6

Save the file.

Step 7

Test.  If you experience problems, check your catalina.out log file in /tomcat/logs


In the following example the “SFX” image has replaced the 590 field. The “Test” content following the image comes from the display.xsl file and can be whatever text you choose, or left blank (see preceding instructions).



You can also have the image appear along with your MARC field code.  

Simply do not comment out the displayTag:

<displayTags label="Local Notes:">
<displayTag field="590" indicator1="X" indicator2="X" subfield="a"/>
<displayTag field="MORI"/>


Leave a Reply