Koha Test Wiki Canasta - March 2024
One of a series of test instances for migrating the Koha Wiki MediaWiki database.
For the current Koha Wiki, visit https://wiki.koha-community.org .OAI-PMH XSLT library
Jump to navigation
Jump to search
You can use XSLT to alter the MARCXML output by Koha's OAI-PMH server. This paqe aims to collect some tips and tricks that might be useful.
See the documentation for advice on how you configure Koha to use custom XSLT for OAI-PMH output.
Put the biblionumber in 001
This transformation will remove the existing 001 field, and add a new 001 field that hs the biblionumber as its value.
<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:items="http://www.koha-community.org/items" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:package="info:srw/extension/13/package-v1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="marc:controlfield[@tag=001]"/> <xsl:template match="marc:leader"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> <xsl:if test="not(marc:controlfield[@tag=001])"> <xsl:text> </xsl:text><xsl:element name="controlfield" xmlns="http://www.loc.gov/MARC21/slim"> <xsl:attribute name="tag">001</xsl:attribute> <xsl:value-of select="//marc:datafield[@tag=999]/marc:subfield[@code='c']/text()"/> </xsl:element> </xsl:if> </xsl:template> </xsl:stylesheet>