Improving OPAC Displays Through XSLT: A Koha Success Story

advertisement
Sam Cook, Public Services Librarian
Allen Library, University of Hartford
NEMLA Spring Meeting
May 10, 2013
100 1 _aBeethoven, Ludwig van,
_d1770-1827
240 10 _aConcertos,
_mViolin, orchestra,
_nop. 61,
_rD major
700 12 _aBrahms, Johannes,
_d1833-1897
_tConcertos,
_mviolin, orchestra,
_nop. 77,
_rD major
January 2012: Customizable XSLT added to
LibLime Academic Koha. There was much
rejoicing.
MARC
MARCXML
100 10 $aCopland, Aaron, $d1900-1990.
<datafield tag="100" ind1="1" ind2="0">
<subfield code="a">Copland, Aaron,</subfield>
<subfield code="d">1900-1990.</subfield>
</datafield>
XSLT
<h5 class="author">By Copland, Aaron, 1900-1990.</h5>
HTML
1
2
3
4
5
6
7
8
9
<xsl:if test="marc:datafield[@tag=100]">
<h5 class="author">
By
<xsl:for-each select="marc:datafield[@tag=100]”>
<xsl:value-of select="marc:subfield[@code='a']"/>
<xsl:value-of select="marc:subfield[@code='d']"/>
</xsl:for-each>
</h5>
</xsl:if>
Translates to…
1
2
3
4
5
6
7
8
9
If there is a 100 field, do this:
Enter an <h5> HTML tag with class of author
Enter the word “By”
For every 100 field (ever though there is only one) do this:
Insert the subfield a
Insert the subfield d
Stop repeating lines 5 and 6 for every 100 field
Enter a </h5> HTML end tag
The if statement is over
Ifs
•If this is a sound recording…
•If this record has a 240 field…
•If this field has a subfield t…
•If this is an RDA record…
•If the text in this field matches
text in the previous field…
•If the first indicator is 1…
•If the 100 field has the word
“Batman” in it…
Thens
•… then use this font style.
•… then remove this text.
•… then enter this text.
•… then leave out this field.
•… then link this using the text in
this other subfield.
•… then insert this HTML.
•… then display the subfields in this
order.
•… then insert a Batman logo.
Changes made:
•Added 245 subfield c
•Put 245 subfields in order they are cataloged in, rather than in a
specified order
•Removed everything from subfield h for sound recordings except
for forward slash (/)
Changes made:
•Placed 1XX with 240
•Placed 1XX/240 with name/title 7XXs
•Line breaks between name/titles to make it easier to read
•Separated name-only 7XXs into their own list
•Included all subfields in proper order
Changes made:
•Placed subjects in vertical list to make them easier to read
•Made links sensitive to what portion of subject is clicked on
(required some javascript)
Changes made:
•Included (nearly) complete 245 in title line
•Removed everything from subfield h except for forward slash (/)
•If item is a sound recording with a 245 $c, it no longer includes
“by” line
•Added 511 performer note instead of 7XXs
Changes made:
•Consolidated author entries
Changes made:
•Replaced generic “sound disc” format with more specific CD or LP
designation
•Modified icon to reflect proper format
•Removed “Literary form” from sound recordings
Changes made:
•Made sure all items were accounted for
•Clarified withdrawn vs. available status
•Added easy to browse through icons showing overall availability
1)This is not an attempt to promote Koha.
2)This shows a model for how systems should be
handling displays. There is no more begging for
individual fields and subfields to display.
3)Different systems that use customizable XSLT
could theoretically share the code
1)My tutorial at:
http://libill.hartford.edu/koha/docs/koha_XSLT_howto.pdf
2)Tutorials at w3schools:
XSLT: http://www.w3schools.com/xsl/
XPATH: http://www.w3schools.com/xpath/default.asp
3) Google searches
Download