XSLT Library

This page lists custom XSLT created by various Koha users so that everyone can benefit. Keep in mind that not all code has been tested and should be read thoroughly before applying to your own system. 
== XSLT Template ==
=== XSLT Title ===
*Developer: Name of XSLT developer 
*Module: OPAC / STAFF / BOTH 
*Purpose: Purpose of the XSLT
Some XSLT code
== XSLT Snippets ==
=== Hide Literary From ===
*Developer: Ed Veal, ByWater Solutions
*Module: OPAC 
*Purpose: This will hide the literary form from the line added by DisplayOPACiconsXSLT by commenting it out
<!-- Commenting out the "Literary Form" code. 
 
 <!-- <xsl:if test="$controlField008-33 and $controlField008-33!='|' and $controlField008-33!='u' and $controlField008-33!=' '">
 ; Literary form: 
 </xsl:if> -->
 <!-- <xsl:choose>
 <xsl:when test="$controlField008-33='0'">
 not fiction
 </xsl:when>
 <xsl:when test="$controlField008-33='1'">
 fiction
 </xsl:when>
 <xsl:when test="$controlField008-33='e'">
 essay
 </xsl:when>
 <xsl:when test="$controlField008-33='d'">
 drama
 </xsl:when>
 <xsl:when test="$controlField008-33='c'">
 comic strip
 </xsl:when>
 <xsl:when test="$controlField008-33='l'">
 fiction
 </xsl:when>
 <xsl:when test="$controlField008-33='h'">
 humor, satire
 </xsl:when>
 <xsl:when test="$controlField008-33='i'">
 letter
 </xsl:when>
 <xsl:when test="$controlField008-33='f'">
 novel
 </xsl:when>
 <xsl:when test="$controlField008-33='j'">
 short story
 </xsl:when>
 <xsl:when test="$controlField008-33='s'">
 speech
 </xsl:when>
 </xsl:choose> -->
-->
=== Add AR/Lexile to display ===
*Developer: Ed Veal, ByWater Solutions
*Module: OPAC / Staff
*Purpose: This will allow you to add reading level to the detail display
<!-- 538a added EV -->
 <xsl:if test="marc:datafield[@tag=538]">
 
 <xsl:for-each select="marc:datafield[@tag=538]">
 <xsl:call-template name="chopPunctuation">
 <xsl:with-param name="chopString">
 <xsl:call-template name="subfieldSelect">
 <xsl:with-param name="codes">a</xsl:with-param>
 </xsl:call-template>
 </xsl:with-param>
 </xsl:call-template>
 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
 </xsl:for-each>
 
 </xsl:if>
<!-- 521ab added EV -->
 <xsl:if test="marc:datafield[@tag=521]">
 Lexile score: 
 <xsl:for-each select="marc:datafield[@tag=521]">
 <xsl:call-template name="chopPunctuation">
 <xsl:with-param name="chopString">
 <xsl:call-template name="subfieldSelect">
 <xsl:with-param name="codes">ab</xsl:with-param>
 </xsl:call-template>
 </xsl:with-param>
 </xsl:call-template>
 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
 </xsl:for-each>
 
 </xsl:if>
 
<!-- 526abcd added EV -->
 <xsl:if test="marc:datafield[@tag=526]">
 AR/Lexile score: 
 <xsl:for-each select="marc:datafield[@tag=526]">
 <xsl:call-template name="chopPunctuation">
 <xsl:with-param name="chopString">
 <xsl:call-template name="subfieldSelect">
 <xsl:with-param name="codes">abcd</xsl:with-param>
 </xsl:call-template>
 </xsl:with-param>
 </xsl:call-template>
 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
 </xsl:for-each>
 
 </xsl:if> 
=== Display Series Data (490ab) ===
*Developer: Ed Veal 
*Module: OPAC 
*Purpose: Display Series Data from the 490 field
<!-- 490 Series data added -->
 <xsl:if test="marc:datafield[@tag=490]">
 Series: 
 <xsl:for-each select="marc:datafield[@tag=490]">
 <xsl:call-template name="chopPunctuation">
 <xsl:with-param name="chopString">
 <xsl:call-template name="subfieldSelect">
 <xsl:with-param name="codes">av</xsl:with-param>
 </xsl:call-template>
 </xsl:with-param>
 </xsl:call-template>
 <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
 </xsl:for-each>
 
 </xsl:if>
=== Display control number in staff client ===
*Developer: Ed Veal 
*Module: STAFF 
*Purpose: Display the control number found in the 001 field
<!-- OCLC Control Number EV -->
<xsl:if test="marc:controlfield[@tag=001]">
 
 OCLC Control number:
 <xsl:value-of select="marc:controlfield[@tag=001]"/>
 
 
 </xsl:if>
<!-- End OCLC Control Number EV -->
Category:Customisation
Category:Resources
Category:Documentation
Category:Tips_&_Tricks
Category:Library