Bugzilla – Attachment 47414 Details for
Bug 15698
Include MARCMaker to export options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15698: XSLT for transmform UNIMARC to MARC21
Bug-15698-XSLT-for-transmform-UNIMARC-to-MARC21.patch (text/plain), 9.55 KB, created by
Héctor Eduardo Castro Avalos
on 2016-01-28 21:59:04 UTC
(
hide
)
Description:
Bug 15698: XSLT for transmform UNIMARC to MARC21
Filename:
MIME Type:
Creator:
Héctor Eduardo Castro Avalos
Created:
2016-01-28 21:59:04 UTC
Size:
9.55 KB
patch
obsolete
>From 0c81a7c423bcb4efb4107a1e8ffa4a9e7d8bcd78 Mon Sep 17 00:00:00 2001 >From: Hector Castro <hector.hecaxmmx@gmail.com> >Date: Thu, 28 Jan 2016 15:57:06 -0600 >Subject: [PATCH] Bug 15698: XSLT for transmform UNIMARC to MARC21 > >Add UNIMARC to MARC21 transformation >--- > .../intranet-tmpl/prog/en/xslt/UNIMARC2MARC21.xsl | 202 ++++++++++++++++++++ > 1 file changed, 202 insertions(+) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARC2MARC21.xsl > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARC2MARC21.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARC2MARC21.xsl >new file mode 100644 >index 0000000..be5c3a7 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARC2MARC21.xsl >@@ -0,0 +1,202 @@ >+<xsl:stylesheet version="1.0" >+ xmlns="http://www.loc.gov/MARC21/slim" >+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >+ xmlns:msxml="urn:schemas-microsoft-com:xslt" >+ > >+ <xsl:output encoding="UTF-8" indent="yes" method="xml"/> >+ <xsl:strip-space elements="*"/> >+ >+ <!-- >+ Transformation from UNIMARC XML representation to MARCXML. >+ Based upon http://www.loc.gov/marc/unimarctomarc21.html >+ >+ --> >+ <xsl:template match="/"> >+ <xsl:choose> >+ <xsl:when test="//collection"> >+ <collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"> >+ <xsl:for-each select="//collection/record"> >+ <record> >+ <xsl:call-template name="record"/> >+ </record> >+ </xsl:for-each> >+ </collection> >+ </xsl:when> >+ <xsl:otherwise> >+ <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"> >+ <xsl:for-each select="//record"> >+ <xsl:call-template name="record"/> >+ </xsl:for-each> >+ </record> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:template> >+ >+ <xsl:template name="record"> >+ <xsl:if test="@type"> >+ <xsl:attribute name="type"> >+ <xsl:value-of select="@type"/> >+ </xsl:attribute> >+ </xsl:if> >+ <xsl:call-template name="transform-leader"/> >+ <xsl:call-template name="copy-control"> >+ <xsl:with-param name="tag">001</xsl:with-param> >+ </xsl:call-template> >+ <xsl:call-template name="copy-control"> >+ <xsl:with-param name="tag">005</xsl:with-param> >+ </xsl:call-template> >+ <xsl:call-template name="transform-100"/> >+ >+ <!-- 200->245 --> >+ <xsl:call-template name="transform-datafield"> >+ <xsl:with-param name="srcTag">200</xsl:with-param> >+ <xsl:with-param name="dstTag">245</xsl:with-param> >+ <xsl:with-param name="srcCodes">aefb</xsl:with-param> >+ <xsl:with-param name="dstCodes">abch</xsl:with-param> >+ </xsl:call-template> >+ >+ <!-- 210->260 --> >+ <xsl:call-template name="transform-datafield"> >+ <xsl:with-param name="srcTag">210</xsl:with-param> >+ <xsl:with-param name="dstTag">260</xsl:with-param> >+ <xsl:with-param name="srcCodes">acd</xsl:with-param> >+ <xsl:with-param name="dstCodes">abc</xsl:with-param> >+ </xsl:call-template> >+ >+ <!-- 215->300 --> >+ <xsl:call-template name="transform-datafield"> >+ <xsl:with-param name="srcTag">215</xsl:with-param> >+ <xsl:with-param name="dstTag">300</xsl:with-param> >+ <xsl:with-param name="srcCodes">acde</xsl:with-param> >+ <xsl:with-param name="dstCodes">abce</xsl:with-param> >+ </xsl:call-template> >+ >+ <!-- 610->653 --> >+ <xsl:call-template name="transform-datafield"> >+ <xsl:with-param name="srcTag">610</xsl:with-param> >+ <xsl:with-param name="dstTag">653</xsl:with-param> >+ </xsl:call-template> >+ >+ <!-- 615->650 --> >+ <xsl:call-template name="transform-datafield"> >+ <xsl:with-param name="srcTag">615</xsl:with-param> >+ <xsl:with-param name="dstTag">650</xsl:with-param> >+ <xsl:with-param name="srcCodes">ax</xsl:with-param> >+ </xsl:call-template> >+ >+ <!-- 615->072 --> >+ <xsl:call-template name="transform-datafield"> >+ <xsl:with-param name="srcTag">615</xsl:with-param> >+ <xsl:with-param name="dstTag">072</xsl:with-param> >+ <xsl:with-param name="srcCodes">nm</xsl:with-param> >+ <xsl:with-param name="dstCodes">ax</xsl:with-param> >+ </xsl:call-template> >+ >+ <!-- 700->100 --> >+ <xsl:call-template name="transform-personal-name"> >+ <xsl:with-param name="srcTag">700</xsl:with-param> >+ <xsl:with-param name="dstTag">100</xsl:with-param> >+ </xsl:call-template> >+ >+ <!-- 701->700 --> >+ <xsl:call-template name="transform-personal-name"> >+ <xsl:with-param name="srcTag">701</xsl:with-param> >+ <xsl:with-param name="dstTag">700</xsl:with-param> >+ </xsl:call-template> >+ >+ <!-- 702->700 --> >+ <xsl:call-template name="transform-personal-name"> >+ <xsl:with-param name="srcTag">702</xsl:with-param> >+ <xsl:with-param name="dstTag">700</xsl:with-param> >+ </xsl:call-template> >+ </xsl:template> >+ >+ <xsl:template name="transform-leader"> >+ <xsl:variable name="leader" select="leader"/> >+ <xsl:variable name="leader05" select="translate(substring($leader,06,1), 'o', 'c')"/> >+ <xsl:variable name="leader06" select="translate(substring($leader,07,1), 'hmn', 'aor')"/> >+ <xsl:variable name="leader07" select="substring($leader,08,1)"/> >+ <xsl:variable name="leader08-16" select="' 22 '"/> >+ <xsl:variable name="leader17" select="translate(substring($leader,18,1), '23', '87')"/> >+ <xsl:variable name="leader18" select="translate(substring($leader,19,1), ' n', 'i ')"/> >+ <xsl:variable name="leader19-23" select="' 4500'"/> >+ <leader> >+ <xsl:value-of select="concat(' ', $leader05, $leader06, $leader07, $leader08-16, $leader17, $leader18, $leader19-23)"/> >+ </leader> >+ </xsl:template> >+ <xsl:template name="copy-control"> >+ <xsl:param name="tag"/> >+ <xsl:for-each select="controlfield[@tag=$tag]"> >+ <controlfield tag="{$tag}"> >+ <xsl:value-of select="text()"/> >+ </controlfield> >+ </xsl:for-each> >+ </xsl:template> >+ <xsl:template name="transform-100"> >+ <xsl:variable name="source" select="datafield[@tag='100']/subfield[@code='a']"/> >+ <xsl:variable name="dest00-05" select="substring($source,03,6)"/> >+ <xsl:variable name="dest06" select="translate(substring($source,09,1), 'abcdefghij', 'cdusrqmtpe')"/> >+ <xsl:variable name="dest07-14" select="substring($source,10,8)"/> >+ <xsl:variable name="dest15-21" select="' '"/> >+ <xsl:variable name="dest22" select="translate(substring($source,18,1), 'bcadekmu', 'abjcdeg ')"/> >+ <xsl:variable name="dest23-27" select="' '"/> >+ <xsl:variable name="dest28" select="translate(substring($source,21,1), 'abcdefghy', 'fsllcizo ')"/> >+ <xsl:variable name="dest29-32" select="' '"/> >+ <xsl:variable name="dest33" select="substring($source,35,1)"/> >+ <xsl:variable name="dest34-37" select="' '"/> >+ <xsl:variable name="dest38" select="translate(substring($source,22,1), '01', ' o')"/> >+ <xsl:variable name="dest39-40" select="' '"/> >+ <controlfield tag="008"> >+ <xsl:value-of select="concat($dest00-05, $dest06, $dest07-14, $dest15-21, $dest22, $dest23-27, $dest28, $dest29-32, $dest33, $dest34-37, $dest38, $dest39-40)"/> >+ </controlfield> >+ </xsl:template> >+ <xsl:template name="transform-datafield"> >+ <xsl:param name="srcTag"/> >+ <xsl:param name="dstTag" select="@srcTag"/> >+ <xsl:param name="srcCodes" select="$all-codes"/> >+ <xsl:param name="dstCodes" select="$srcCodes"/> >+ <xsl:if test="datafield[@tag=$srcTag]/subfield[contains($srcCodes, @code)]"> >+ <xsl:for-each select="datafield[@tag=$srcTag]"> >+ <datafield tag="{$dstTag}"> >+ <xsl:call-template name="copy-indicators"/> >+ <xsl:call-template name="transform-subfields"> >+ <xsl:with-param name="srcCodes" select="$srcCodes"/> >+ <xsl:with-param name="dstCodes" select="$dstCodes"/> >+ </xsl:call-template> >+ </datafield> >+ </xsl:for-each> >+ </xsl:if> >+ </xsl:template> >+ <xsl:template name="transform-personal-name"> >+ <xsl:param name="srcTag"/> >+ <xsl:param name="dstTag"/> >+ >+ <xsl:for-each select="datafield[@tag=$srcTag]"> >+ <datafield tag="{$dstTag}" ind1="{@ind2}" ind2=""> >+ <xsl:call-template name="transform-subfields"> >+ <xsl:with-param name="srcCodes" select="'acdfgp4'"/> >+ <xsl:with-param name="dstCodes" select="'acbdqu4'"/> >+ </xsl:call-template> >+ </datafield> >+ </xsl:for-each> >+ </xsl:template> >+ <xsl:template name="copy-indicators"> >+ <xsl:attribute name="ind1"> >+ <xsl:value-of select="translate(@ind1, '#', '')"/> >+ </xsl:attribute> >+ <xsl:attribute name="ind2"> >+ <xsl:value-of select="translate(@ind2, '#', '')"/> >+ </xsl:attribute> >+ </xsl:template> >+ <xsl:template name="transform-subfields"> >+ <xsl:param name="srcCodes" select="$all-codes"/> >+ <xsl:param name="dstCodes" select="$srcCodes"/> >+ <xsl:for-each select="subfield[contains($srcCodes, @code)]"> >+ <subfield code="{translate(@code, $srcCodes, $dstCodes)}"> >+ <xsl:value-of select="text()"/> >+ </subfield> >+ </xsl:for-each> >+ </xsl:template> >+ >+ <xsl:variable name="all-codes">abcdefghijklmnopqrstuvwxyz123456789</xsl:variable> >+</xsl:stylesheet> >\ No newline at end of file >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15698
:
47413
| 47414