Koha Test Wiki MW Canasta on Koha Portainer

Test major Koha Wiki changes or bug fixes here without fear of breaking the production wiki.

For the current Koha Wiki, visit https://wiki.koha-community.org .

XSLT Library

From Koha Test Wiki MW Canasta on Koha Portainer
Jump to navigation Jump to search

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!=' '">
            <span class="label">; Literary form: </span>
            </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]">
          <span class="results_summary description">
           <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>
        </span>
       </xsl:if>

<!-- 521ab added EV -->
      <xsl:if test="marc:datafield[@tag=521]">
         <span class="results_summary description"><span class="label">Lexile score: </span>
           <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>
        </span>
       </xsl:if>
       
<!-- 526abcd added EV -->
      <xsl:if test="marc:datafield[@tag=526]">
        <span class="results_summary description"><span class="label">AR/Lexile score: </span>
           <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>
        </span>
       </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]">
         <span class="results_summary series"><span class="label">Series: </span>
           <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>
        </span>
       </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]">
   <span class="results_summary oclc">
    <li class="label">OCLC Control number:
       <xsl:value-of select="marc:controlfield[@tag=001]"/>
     </li>
    </span>
   </xsl:if>
<!-- End OCLC Control Number EV -->