Use marc21_test.xsl rather than marc21.xsl
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 22 Mar 2010 10:24:53 +0000 (11:24 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 22 Mar 2010 10:24:53 +0000 (11:24 +0100)
test/Makefile.am
test/gils_service.xml
test/marc21.xsl [deleted file]
test/test_http_urls
test/z3950_indexdata_com_marc.xml

index d026ca3..da05f87 100644 (file)
@@ -1,7 +1,7 @@
 # This file is part of Pazpar2.
 check_SCRIPTS = test_http.sh test_icu.sh test_post.sh test_settings.sh
 
-EXTRA_DIST = run_pazpar2.sh marc21.xsl z3950_indexdata_com_marc.xml \
+EXTRA_DIST = run_pazpar2.sh marc21_test.xsl z3950_indexdata_com_marc.xml \
        gils_service.xml marc_service.xml marc21.mmap \
        test_http.cfg test_http_urls \
        test_icu.cfg test_icu_urls \
index 6a888e8..8a43910 100644 (file)
@@ -18,7 +18,7 @@
 
        <!-- Result normalization settings -->
        <set name="pz:nativesyntax" value="iso2709"/>
-       <set name="pz:xslt" value="auto"/>
+       <set name="pz:xslt" value="marc21_test.xsl"/>
        
        <set name="pz:apdulog" value="1"/>
        
diff --git a/test/marc21.xsl b/test/marc21.xsl
deleted file mode 100644 (file)
index 71178b7..0000000
+++ /dev/null
@@ -1,345 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet
-    version="1.0"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
-    xmlns:marc="http://www.loc.gov/MARC21/slim">
-  
-  <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
-
-<!-- Extract metadata from MARC21/USMARC 
-      http://www.loc.gov/marc/bibliographic/ecbdhome.html
--->  
-  <xsl:template name="record-hook"/>
-
-  <xsl:template match="/">
-    <xsl:apply-templates/>
-  </xsl:template>
-
-  <xsl:template match="marc:record">
-    <xsl:variable name="title_medium" select="marc:datafield[@tag='245']/marc:subfield[@code='h']"/>
-    <xsl:variable name="journal_title" select="marc:datafield[@tag='773']/marc:subfield[@code='t']"/>
-    <xsl:variable name="electronic_location_url" select="marc:datafield[@tag='856']/marc:subfield[@code='u']"/>
-    <xsl:variable name="fulltext_a" select="marc:datafield[@tag='900']/marc:subfield[@code='a']"/>
-    <xsl:variable name="fulltext_b" select="marc:datafield[@tag='900']/marc:subfield[@code='b']"/>
-    <xsl:variable name="medium">
-      <xsl:choose>
-       <xsl:when test="$title_medium">
-         <xsl:value-of select="translate($title_medium, ' []/', '')"/>
-       </xsl:when>
-       <xsl:when test="$fulltext_a">
-         <xsl:text>electronic resource</xsl:text>
-       </xsl:when>
-       <xsl:when test="$fulltext_b">
-         <xsl:text>electronic resource</xsl:text>
-       </xsl:when>
-       <xsl:when test="$journal_title">
-         <xsl:text>article</xsl:text>
-       </xsl:when>
-       <xsl:otherwise>
-         <xsl:text>book</xsl:text>
-       </xsl:otherwise>
-      </xsl:choose>
-    </xsl:variable>
-
-    <pz:record>
-      
-      <xsl:for-each select="marc:controlfield[@tag='001']">
-        <pz:metadata type="id">
-          <xsl:value-of select="."/>
-        </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='010']">
-        <pz:metadata type="lccn">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='020']">
-        <pz:metadata type="isbn">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='022']">
-        <pz:metadata type="issn">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='027']">
-        <pz:metadata type="tech-rep-nr">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='035']">
-        <pz:metadata type="system-control-nr">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='100']">
-       <pz:metadata type="author">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-       <pz:metadata type="author-title">
-         <xsl:value-of select="marc:subfield[@code='c']"/>
-       </pz:metadata>
-       <pz:metadata type="author-date">
-         <xsl:value-of select="marc:subfield[@code='d']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='110']">
-       <pz:metadata type="corporate-name">
-           <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-       <pz:metadata type="corporate-location">
-           <xsl:value-of select="marc:subfield[@code='c']"/>
-       </pz:metadata>
-       <pz:metadata type="corporate-date">
-           <xsl:value-of select="marc:subfield[@code='d']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='111']">
-       <pz:metadata type="meeting-name">
-           <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-       <pz:metadata type="meeting-location">
-           <xsl:value-of select="marc:subfield[@code='c']"/>
-       </pz:metadata>
-       <pz:metadata type="meeting-date">
-           <xsl:value-of select="marc:subfield[@code='d']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='260']">
-       <pz:metadata type="date">
-           <xsl:value-of select="marc:subfield[@code='c']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='245']">
-        <pz:metadata type="title">
-          <xsl:value-of select="marc:subfield[@code='a']"/>
-        </pz:metadata>
-        <pz:metadata type="title-remainder">
-          <xsl:value-of select="marc:subfield[@code='b']"/>
-        </pz:metadata>
-        <pz:metadata type="title-responsibility">
-          <xsl:value-of select="marc:subfield[@code='c']"/>
-        </pz:metadata>
-        <pz:metadata type="title-dates">
-          <xsl:value-of select="marc:subfield[@code='f']"/>
-        </pz:metadata>
-        <pz:metadata type="title-medium">
-          <xsl:value-of select="marc:subfield[@code='h']"/>
-        </pz:metadata>
-        <pz:metadata type="title-number-section">
-          <xsl:value-of select="marc:subfield[@code='n']"/>
-        </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='250']">
-       <pz:metadata type="edition">
-           <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='260']">
-        <pz:metadata type="publication-place">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-        <pz:metadata type="publication-name">
-         <xsl:value-of select="marc:subfield[@code='b']"/>
-       </pz:metadata>
-        <pz:metadata type="publication-date">
-         <xsl:value-of select="marc:subfield[@code='c']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='300']">
-       <pz:metadata type="physical-extent">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-       <pz:metadata type="physical-format">
-         <xsl:value-of select="marc:subfield[@code='b']"/>
-       </pz:metadata>
-       <pz:metadata type="physical-dimensions">
-         <xsl:value-of select="marc:subfield[@code='c']"/>
-       </pz:metadata>
-       <pz:metadata type="physical-accomp">
-         <xsl:value-of select="marc:subfield[@code='e']"/>
-       </pz:metadata>
-       <pz:metadata type="physical-unittype">
-         <xsl:value-of select="marc:subfield[@code='f']"/>
-       </pz:metadata>
-       <pz:metadata type="physical-unitsize">
-         <xsl:value-of select="marc:subfield[@code='g']"/>
-       </pz:metadata>
-       <pz:metadata type="physical-specified">
-         <xsl:value-of select="marc:subfield[@code='3']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='440']">
-       <pz:metadata type="series-title">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag = '500' or @tag = '505' or
-               @tag = '518' or @tag = '520' or @tag = '522']">
-       <pz:metadata type="description">
-            <xsl:value-of select="*/text()"/>
-        </pz:metadata>
-      </xsl:for-each>
-      
-      <xsl:for-each select="marc:datafield[@tag='600' or @tag='610' or @tag='611' or @tag='630' or @tag='648' or @tag='650' or @tag='651' or @tag='653' or @tag='654' or @tag='655' or @tag='656' or @tag='657' or @tag='658' or @tag='662' or @tag='69X']">
-        <pz:metadata type="subject">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-       <pz:metadata type="subject-long">
-         <xsl:for-each select="marc:subfield">
-           <xsl:if test="position() > 1">
-             <xsl:text>, </xsl:text>
-           </xsl:if>
-           <xsl:value-of select="."/>
-         </xsl:for-each>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='856']">
-       <pz:metadata type="electronic-url">
-         <xsl:value-of select="marc:subfield[@code='u']"/>
-       </pz:metadata>
-       <pz:metadata type="electronic-text">
-         <xsl:value-of select="marc:subfield[@code='y' or @code='3']"/>
-       </pz:metadata>
-       <pz:metadata type="electronic-note">
-         <xsl:value-of select="marc:subfield[@code='z']"/>
-       </pz:metadata>
-       <pz:metadata type="electronic-format-instruction">
-         <xsl:value-of select="marc:subfield[@code='i']"/>
-       </pz:metadata>
-       <pz:metadata type="electronic-format-type">
-         <xsl:value-of select="marc:subfield[@code='q']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='773']">
-       <pz:metadata type="citation">
-             <xsl:for-each select="*">
-               <xsl:value-of select="normalize-space(.)"/>
-               <xsl:text> </xsl:text>
-         </xsl:for-each>
-        </pz:metadata>
-        <xsl:if test="marc:subfield[@code='t']">
-         <pz:metadata type="journal-title">
-               <xsl:value-of select="marc:subfield[@code='t']"/>
-          </pz:metadata>          
-        </xsl:if>
-        <xsl:if test="marc:subfield[@code='g']">
-         <pz:metadata type="journal-subpart">
-               <xsl:value-of select="marc:subfield[@code='g']"/>
-          </pz:metadata>          
-        </xsl:if>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='852']">
-        <xsl:if test="marc:subfield[@code='y']">
-         <pz:metadata type="publicnote">
-           <xsl:value-of select="marc:subfield[@code='y']"/>
-         </pz:metadata>
-       </xsl:if>
-       <xsl:if test="marc:subfield[@code='h']">
-         <pz:metadata type="callnumber">
-           <xsl:value-of select="marc:subfield[@code='h']"/>
-         </pz:metadata>
-       </xsl:if>
-      </xsl:for-each>
-
-      <pz:metadata type="medium">
-       <xsl:value-of select="$medium"/>
-      </pz:metadata>
-      
-      <xsl:for-each select="marc:datafield[@tag='900']/marc:subfield[@code='a']">
-        <pz:metadata type="fulltext">
-          <xsl:value-of select="."/>
-        </pz:metadata>
-      </xsl:for-each>
-
-      <!-- <xsl:if test="$fulltext_a">
-       <pz:metadata type="fulltext">
-         <xsl:value-of select="$fulltext_a"/>
-       </pz:metadata>
-      </xsl:if> -->
-
-      <xsl:for-each select="marc:datafield[@tag='900']/marc:subfield[@code='b']">
-        <pz:metadata type="fulltext">
-          <xsl:value-of select="."/>
-        </pz:metadata>
-      </xsl:for-each>
-
-      <!-- <xsl:if test="$fulltext_b">
-       <pz:metadata type="fulltext">
-         <xsl:value-of select="$fulltext_b"/>
-       </pz:metadata>
-      </xsl:if> -->
-
-      <xsl:for-each select="marc:datafield[@tag='907' or @tag='901']">
-        <pz:metadata type="iii-id">
-         <xsl:value-of select="marc:subfield[@code='a']"/>
-       </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='926']">
-        <pz:metadata type="holding">
-         <xsl:for-each select="marc:subfield">
-           <xsl:if test="position() > 1">
-             <xsl:text> </xsl:text>
-           </xsl:if>
-           <xsl:value-of select="."/>
-         </xsl:for-each>
-        </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='948']">
-        <pz:metadata type="holding">
-         <xsl:for-each select="marc:subfield">
-           <xsl:if test="position() > 1">
-             <xsl:text> </xsl:text>
-           </xsl:if>
-           <xsl:value-of select="."/>
-         </xsl:for-each>
-        </pz:metadata>
-      </xsl:for-each>
-
-      <xsl:for-each select="marc:datafield[@tag='991']">
-        <pz:metadata type="holding">
-         <xsl:for-each select="marc:subfield">
-           <xsl:if test="position() > 1">
-             <xsl:text> </xsl:text>
-           </xsl:if>
-           <xsl:value-of select="."/>
-         </xsl:for-each>
-        </pz:metadata>
-      </xsl:for-each>
-
-      <!-- passthrough id data -->
-      <xsl:for-each select="pz:metadata">
-          <xsl:copy-of select="."/>
-      </xsl:for-each>
-
-      <!-- other stylesheets importing this might want to define this -->
-      <xsl:call-template name="record-hook"/>
-
-    </pz:record>    
-  </xsl:template>
-  
-  <xsl:template match="text()"/>
-
-</xsl:stylesheet>
index 2ef6c62..3c2fa17 100644 (file)
@@ -13,7 +13,7 @@ http://localhost:9763/search.pz2?command=search&query=function%20()%20%7B%250A%2
 http://localhost:9763/search.pz2?session=1&command=show&sort=date:1&block=1
 http://localhost:9763/search.pz2?session=1&command=show&start=0&number=1
 http://localhost:9763/search.pz2?command=init&clear=1
-http://localhost:9763/search.pz2?session=2&command=settings&pz:name%5Bz3950.indexdata.com%2Fgils%5D=gils&pz:requestsyntax%5Bz3950.indexdata.com%2Fgils%5D=usmarc&pz:nativesyntax%5Bz3950.indexdata.com%2Fgils%5D=iso2709&pz:xslt%5Bz3950.indexdata.com%2Fgils%5D=marc21.xsl
+http://localhost:9763/search.pz2?session=2&command=settings&pz:name%5Bz3950.indexdata.com%2Fgils%5D=gils&pz:requestsyntax%5Bz3950.indexdata.com%2Fgils%5D=usmarc&pz:nativesyntax%5Bz3950.indexdata.com%2Fgils%5D=iso2709&pz:xslt%5Bz3950.indexdata.com%2Fgils%5D=marc21%5Ftest.xsl
 http://localhost:9763/search.pz2?session=2&command=search&query=computer
 2 http://localhost:9763/search.pz2?session=2&command=show&block=1
 http://localhost:9763/search.pz2?session=2&command=search&query=kubiak%20stanis%C5%82aw
@@ -31,7 +31,7 @@ http://localhost:9763/search.pz2?session=4&command=settings&pz:name%5Bz3950.inde
 http://localhost:9763/search.pz2?session=4&command=search&query=computer
 2 http://localhost:9763/search.pz2?session=4&command=show&block=1
 http://localhost:9763/search.pz2?command=init
-http://localhost:9763/search.pz2?session=5&command=settings&pz:name%5Bz3950.indexdata.com%2Fmarc%5D=marc&pz:requestsyntax%5Bz3950.indexdata.com%2Fmarc%5D=usmarc&pz:nativesyntax%5Bz3950.indexdata.com%2Fmarc%5D=iso2709&pz:xslt%5Bz3950.indexdata.com%2Fmarc%5D=marc21.xsl&pz:recordfilter%5Bz3950.indexdata.com%2Fmarc%5D=date
+http://localhost:9763/search.pz2?session=5&command=settings&pz:name%5Bz3950.indexdata.com%2Fmarc%5D=marc&pz:requestsyntax%5Bz3950.indexdata.com%2Fmarc%5D=usmarc&pz:nativesyntax%5Bz3950.indexdata.com%2Fmarc%5D=iso2709&pz:xslt%5Bz3950.indexdata.com%2Fmarc%5D=marc21%5Ftest.xsl&pz:recordfilter%5Bz3950.indexdata.com%2Fmarc%5D=date
 http://localhost:9763/search.pz2?session=5&command=search&query=computer&filter=pz%3Aid%3Dz3950.indexdata.com%2Fmarc
 2 http://localhost:9763/search.pz2?session=5&command=show&block=1
 http://localhost:9763/search.pz2?session=5&command=search&query=computer&filter=pz%3Aid%3Dunknown
index 65a3289..7792ece 100644 (file)
@@ -18,7 +18,7 @@
   <!-- Result normalization settings -->
 
   <set name="pz:nativesyntax" value="iso2709"/>
-  <set name="pz:xslt" value="auto"/>
+  <set name="pz:xslt" value="marc21_test.xsl"/>
   
   <set name="pz:apdulog" value="1"/>
   <set name="pz:pqf_strftime" value="@or %% %Y"/>