diff --git a/settings.gradle b/settings.gradle index b2fbeb4..60603ed 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,13 @@ pluginManagement { repositories { mavenLocal() - mavenCentral() + mavenCentral { + metadataSources { + mavenPom() + artifact() + ignoreGradleMetadataRedirection() + } + } gradlePluginPortal() } } diff --git a/src/test/java/org/xbib/marc/MarcToModsTest.java b/src/test/java/org/xbib/marc/MarcToModsTest.java index c8963bb..d089091 100644 --- a/src/test/java/org/xbib/marc/MarcToModsTest.java +++ b/src/test/java/org/xbib/marc/MarcToModsTest.java @@ -45,163 +45,175 @@ public class MarcToModsTest { @Test public void testSax() throws Exception { String s = "summerland.mrc"; - InputStream marcInputStream = getClass().getResource(s).openStream(); - Marc marc = Marc.builder() - .setInputStream(marcInputStream) - .setCharset(Charset.forName("ANSEL")) - .setSchema(MARC21_FORMAT) - .build(); - Source source = new SAXSource(marc.iso2709XmlReader(), new InputSource(marcInputStream)); - StringWriter writer = new StringWriter(); - StreamResult streamResult = new StreamResult(writer); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer transformer = tf.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); - transformer.transform(source, streamResult); - assertThat(writer.toString(), - CompareMatcher.isIdenticalTo(getClass().getResource("summerland-sax-marc.xml").openStream())); + try (InputStream marcInputStream = getClass().getResource(s).openStream()) { + Marc marc = Marc.builder() + .setInputStream(marcInputStream) + .setCharset(Charset.forName("ANSEL")) + .setSchema(MARC21_FORMAT) + .build(); + Source source = new SAXSource(marc.iso2709XmlReader(), new InputSource(marcInputStream)); + StringWriter writer = new StringWriter(); + StreamResult streamResult = new StreamResult(writer); + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + transformer.transform(source, streamResult); + assertThat(writer.toString(), + CompareMatcher.isIdenticalTo(getClass().getResource("summerland-sax-marc.xml").openStream())); + } } @Test public void testDom() throws Exception { String s = "summerland.mrc"; - InputStream marcInputStream = getClass().getResource(s).openStream(); - Marc marc = Marc.builder() - .setInputStream(marcInputStream) - .setCharset(Charset.forName("ANSEL")) - .setSchema(MARC21_FORMAT) - .build(); - Sax2Dom sax2Dom = new Sax2Dom(marc.iso2709XmlReader(), new InputSource(marcInputStream)); - Document document = sax2Dom.document(); - StringWriter writer = new StringWriter(); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer transformer = tf.newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); - transformer.transform(new DOMSource(document), new StreamResult(writer)); - assertThat(writer.toString(), - CompareMatcher.isIdenticalTo(getClass().getResource("summerland-dom-marc.xml").openStream())); + try (InputStream marcInputStream = getClass().getResource(s).openStream()) { + Marc marc = Marc.builder() + .setInputStream(marcInputStream) + .setCharset(Charset.forName("ANSEL")) + .setSchema(MARC21_FORMAT) + .build(); + Sax2Dom sax2Dom = new Sax2Dom(marc.iso2709XmlReader(), new InputSource(marcInputStream)); + Document document = sax2Dom.document(); + StringWriter writer = new StringWriter(); + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + transformer.transform(new DOMSource(document), new StreamResult(writer)); + assertThat(writer.toString(), + CompareMatcher.isIdenticalTo(getClass().getResource("summerland-dom-marc.xml").openStream())); + } } @Test public void testStylesheetSax() throws Exception { String s = "summerland.mrc"; - InputStream marcInputStream = getClass().getResource(s).openStream(); - Marc marc = Marc.builder() - .setInputStream(marcInputStream) - .setCharset(Charset.forName("ANSEL")) - .setSchema(MARC21_FORMAT) - .build(); - Source source = new SAXSource(marc.iso2709XmlReader(), new InputSource(marcInputStream)); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - StreamResult streamResult = new StreamResult(out); - InputStream xslInputStream = getClass().getResourceAsStream("MARC21slim2MODS3-6.xsl"); - TransformerFactory factory = TransformerFactory.newInstance(); - factory.setURIResolver(new ClasspathResourceURIResolver()); - Transformer transformer = factory.newTemplates(new StreamSource(xslInputStream)).newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); - transformer.setErrorListener(new ErrorListener() { - @Override - public void warning(TransformerException exception) throws TransformerException { - exception.printStackTrace(); - } + try (InputStream marcInputStream = getClass().getResource(s).openStream()) { + Marc marc = Marc.builder() + .setInputStream(marcInputStream) + .setCharset(Charset.forName("ANSEL")) + .setSchema(MARC21_FORMAT) + .build(); + Source source = new SAXSource(marc.iso2709XmlReader(), new InputSource(marcInputStream)); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + StreamResult streamResult = new StreamResult(out); + InputStream xslInputStream = getClass().getResourceAsStream("MARC21slim2MODS3-6.xsl"); + TransformerFactory factory = TransformerFactory.newInstance(); + // required for realtive URI resolving in xsl:include + factory.setURIResolver(new ClasspathResourceURIResolver()); + Transformer transformer = factory.newTemplates(new StreamSource(xslInputStream)).newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + transformer.setErrorListener(new ErrorListener() { + @Override + public void warning(TransformerException exception) throws TransformerException { + exception.printStackTrace(); + } - @Override - public void error(TransformerException exception) throws TransformerException { - exception.printStackTrace(); - } + @Override + public void error(TransformerException exception) throws TransformerException { + exception.printStackTrace(); + } - @Override - public void fatalError(TransformerException exception) throws TransformerException { - exception.printStackTrace(); - } - }); - transformer.transform(source, streamResult); - marcInputStream.close(); - xslInputStream.close(); - assertThat(out.toByteArray(), - CompareMatcher.isIdenticalTo(getClass().getResource("summerland-sax-mods.xml").openStream())); + @Override + public void fatalError(TransformerException exception) throws TransformerException { + exception.printStackTrace(); + } + }); + transformer.transform(source, streamResult); + marcInputStream.close(); + xslInputStream.close(); + assertThat(out.toByteArray(), + CompareMatcher.isIdenticalTo(getClass().getResource("summerland-sax-mods.xml").openStream())); + } } @Test public void testStylesheetDom() throws Exception { String s = "summerland.mrc"; - InputStream marcInputStream = getClass().getResource(s).openStream(); - Marc marc = Marc.builder() - .setInputStream(marcInputStream) - .setCharset(Charset.forName("ANSEL")) - .setSchema(MARC21_FORMAT) - .build(); - Sax2Dom sax2Dom = new Sax2Dom(marc.iso2709XmlReader(), new InputSource(marcInputStream)); - Document document = sax2Dom.document(); - Source source = new DOMSource(document); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - StreamResult streamResult = new StreamResult(out); - InputStream xslInputStream = getClass().getResourceAsStream("MARC21slim2MODS3-6.xsl"); - TransformerFactory factory = TransformerFactory.newInstance(); - factory.setURIResolver(new ClasspathResourceURIResolver()); - Transformer transformer = factory.newTemplates(new StreamSource(xslInputStream)).newTransformer(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); - transformer.setErrorListener(new ErrorListener() { - @Override - public void warning(TransformerException exception) throws TransformerException { - exception.printStackTrace(); - } + try (InputStream marcInputStream = getClass().getResource(s).openStream()) { + Marc marc = Marc.builder() + .setInputStream(marcInputStream) + .setCharset(Charset.forName("ANSEL")) + .setSchema(MARC21_FORMAT) + .build(); + Sax2Dom sax2Dom = new Sax2Dom(marc.iso2709XmlReader(), new InputSource(marcInputStream)); + Document document = sax2Dom.document(); + Source source = new DOMSource(document); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + StreamResult streamResult = new StreamResult(out); + InputStream xslInputStream = getClass().getResourceAsStream("MARC21slim2MODS3-6.xsl"); + TransformerFactory factory = TransformerFactory.newInstance(); + factory.setURIResolver(new ClasspathResourceURIResolver()); + Transformer transformer = factory.newTemplates(new StreamSource(xslInputStream)).newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + transformer.setErrorListener(new ErrorListener() { + @Override + public void warning(TransformerException exception) throws TransformerException { + exception.printStackTrace(); + } - @Override - public void error(TransformerException exception) throws TransformerException { - exception.printStackTrace(); - } + @Override + public void error(TransformerException exception) throws TransformerException { + exception.printStackTrace(); + } - @Override - public void fatalError(TransformerException exception) throws TransformerException { - exception.printStackTrace(); - } - }); - transformer.transform(source, streamResult); - marcInputStream.close(); - xslInputStream.close(); - assertThat(out.toByteArray(), - CompareMatcher.isIdenticalTo(getClass().getResource("summerland-dom-mods.xml").openStream())); + @Override + public void fatalError(TransformerException exception) throws TransformerException { + exception.printStackTrace(); + } + }); + transformer.transform(source, streamResult); + marcInputStream.close(); + xslInputStream.close(); + assertThat(out.toByteArray(), + CompareMatcher.isIdenticalTo(getClass().getResource("summerland-dom-mods.xml").openStream())); + } } + /** + * With regard to sandboxed CI/CD platforms, we avoid loading external XSL style sheets from loc.gov + * We run the test with a local copy. + * + * @throws Exception if test fails + */ @Test - public void testLocStyleSheet() throws Exception { + public void testLocLocalCopyStyleSheet() throws Exception { String s = "summerland.mrc"; - InputStream marcInputStream = getClass().getResource(s).openStream(); - Marc marc = Marc.builder() - .setInputStream(marcInputStream) - .setCharset(Charset.forName("ANSEL")) - .setSchema(MARC21_FORMAT) - .build(); - StringWriter sw = new StringWriter(); - Result result = new StreamResult(sw); - System.setProperty("http.agent", "Java Agent"); - marc.transform(TransformerFactory.newInstance(), - new URL("http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3.xsl"), result); - assertThat(sw.toString(), - CompareMatcher.isIdenticalTo(getClass().getResource("summerland-mods-loc-goc.xml").openStream())); + try (InputStream marcInputStream = getClass().getResource(s).openStream()) { + Marc marc = Marc.builder() + .setInputStream(marcInputStream) + .setCharset(Charset.forName("ANSEL")) + .setSchema(MARC21_FORMAT) + .build(); + StringWriter sw = new StringWriter(); + Result result = new StreamResult(sw); + URL url = getClass().getResource("MARC21slim2MODS3.xsl"); + TransformerFactory factory = TransformerFactory.newInstance(); + factory.setURIResolver(new ClasspathResourceURIResolver()); + marc.transform(factory, url, result); + assertThat(sw.toString(), + CompareMatcher.isIdenticalTo(getClass().getResource("summerland-mods-loc-goc-local-copy.xml").openStream())); + } } - private static class ClasspathResourceURIResolver implements URIResolver { @Override - public Source resolve(String href, String base) throws TransformerException { + public Source resolve(String href, String base) { return new StreamSource(getClass().getResourceAsStream(href)); } } diff --git a/src/test/resources/org/xbib/marc/MARC21slim2MODS3.xsl b/src/test/resources/org/xbib/marc/MARC21slim2MODS3.xsl new file mode 100644 index 0000000..600490f --- /dev/null +++ b/src/test/resources/org/xbib/marc/MARC21slim2MODS3.xsl @@ -0,0 +1,5076 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BK + SE + + + BK + MM + CF + MP + VM + MU + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a + + + + + + + + + + + + + + + + + + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + + + + + <xsl:value-of select="$titleChop"/> + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <!-- 1/04 removed $h, b --> + <xsl:with-param name="codes">a</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + yes + + + yes + + + text + cartographic + notated music + sound recording-nonmusical + sound recording-musical + still image + moving image + three dimensional object + software, multimedia + mixed material + + + + globe + + + remote-sensing image + + + + + + map + + + atlas + + + + + + + + database + + + loose-leaf + + + series + + + newspaper + + + periodical + + + web site + + + + + + + + abstract or summary + + + bibliography + + + catalog + + + dictionary + + + encyclopedia + + + handbook + + + legal article + + + index + + + discography + + + legislation + + + theses + + + survey of literature + + + review + + + programmed text + + + filmography + + + directory + + + statistics + + + technical report + + + legal case and case notes + + + law report or digest + + + treaty + + + + + + conference publication + + + + + + + + numeric data + + + database + + + font + + + game + + + + + + patent + + + offprint + + + festschrift + + + + biography + + + + + essay + + + drama + + + comic strip + + + fiction + + + humor, satire + + + letter + + + novel + + + short story + + + speech + + + + + + + biography + + + conference publication + + + drama + + + essay + + + fiction + + + folktale + + + history + + + humor, satire + + + memoir + + + poetry + + + rehearsal + + + reporting + + + sound + + + speech + + + + + + + art original + + + kit + + + art reproduction + + + diorama + + + filmstrip + + + legal article + + + picture + + + graphic + + + technical drawing + + + motion picture + + + chart + + + flash card + + + microscope slide + + + model + + + realia + + + slide + + + transparency + + + videorecording + + + toy + + + + + + + + + + + + + + + + + + + + + + + + code + marccountry + + + + + + + + code + iso3166 + + + + + + + + text + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + :,;/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + monographic + continuing + multipart monograph + single unit + integrating resource + serial + + + + + + + ab + + + + + + + + + Annual + Bimonthly + Semiweekly + Daily + Biweekly + Semiannual + Biennial + Triennial + Three times a week + Three times a month + Continuously updated + Monthly + Quarterly + Semimonthly + Three times a year + Unknown + Weekly + Completely irregular + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + reformatted digital + + + digitized microfilm + + + digitized other analog + + + + + + + + + + + + + + + +
braille
+
+ +
print
+
+ +
electronic
+
+ + +
kit
+
+ +
microfiche
+
+ +
microfilm
+
+
+ + + +
+ + + + + +
+
+ +
+ + + + + +
+
+ +
+ + + + + +
+
+ +
+ + + + + +
+
+ +
+ + + + + +
+
+ +
+ + + + + +
+
+ +
+ + +
+ + + + access + + + preservation + + + replacement + + + + + +
electronic resource
+
chip cartridge
+
+ +
electronic resource
+
computer optical disc cartridge
+
+ +
electronic resource
+
magnetic disc
+
+ +
electronic resource
+
magneto-optical disc
+
+ +
electronic resource
+
optical disc
+
+ + + +
electronic resource
+
remote
+
+ + +
electronic resource
+
tape cartridge
+
+ +
electronic resource
+
tape cassette
+
+ +
electronic resource
+
tape reel
+
+ + +
globe
+
celestial globe
+
+ +
globe
+
earth moon globe
+
+ +
globe
+
planetary or lunar globe
+
+ +
globe
+
terrestrial globe
+
+ + +
kit
+
kit
+
+ + +
map
+
atlas
+
+ +
map
+
diagram
+
+ +
map
+
map
+
+ +
map
+
model
+
+ +
map
+
profile
+
+ +
remote-sensing image
+
+ +
map
+
section
+
+ +
map
+
view
+
+ + +
microform
+
aperture card
+
+ +
microform
+
microfiche
+
+ +
microform
+
microfiche cassette
+
+ +
microform
+
microfilm cartridge
+
+ +
microform
+
microfilm cassette
+
+ +
microform
+
microfilm reel
+
+ +
microform
+
microopaque
+
+ + +
motion picture
+
film cartridge
+
+ +
motion picture
+
film cassette
+
+ +
motion picture
+
film reel
+
+ + +
nonprojected graphic
+
chart
+
+ +
nonprojected graphic
+
collage
+
+ +
nonprojected graphic
+
drawing
+
+ +
nonprojected graphic
+
flash card
+
+ +
nonprojected graphic
+
painting
+
+ +
nonprojected graphic
+
photomechanical print
+
+ +
nonprojected graphic
+
photonegative
+
+ +
nonprojected graphic
+
photoprint
+
+ +
nonprojected graphic
+
picture
+
+ +
nonprojected graphic
+
print
+
+ +
nonprojected graphic
+
technical drawing
+
+ + +
notated music
+
notated music
+
+ + +
projected graphic
+
filmslip
+
+ +
projected graphic
+
filmstrip cartridge
+
+ +
projected graphic
+
filmstrip roll
+
+ +
projected graphic
+
other filmstrip type
+
+ +
projected graphic
+
slide
+
+ +
projected graphic
+
transparency
+
+ +
remote-sensing image
+
remote-sensing image
+
+ +
sound recording
+
cylinder
+
+ +
sound recording
+
roll
+
+ +
sound recording
+
sound cartridge
+
+ +
sound recording
+
sound cassette
+
+ +
sound recording
+
sound disc
+
+ +
sound recording
+
sound-tape reel
+
+ +
sound recording
+
sound-track film
+
+ +
sound recording
+
wire recording
+
+ + +
tactile material
+
braille
+
+ +
tactile material
+
combination
+
+ +
tactile material
+
moon
+
+ +
tactile material
+
tactile, with no writing system
+
+ + +
text
+
braille
+
+ +
text
+
large print
+
+ +
text
+
regular print
+
+ +
text
+
text in looseleaf binder
+
+ + +
videorecording
+
videocartridge
+
+ +
videorecording
+
videocassette
+
+ +
videorecording
+
videodisc
+
+ +
videorecording
+
videoreel
+
+ + + + + + + + + + abce3fg + + + + + + + + + : + + + abc + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + adolescent + + + adult + + + general + + + juvenile + + + preschool + + + specialized + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <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:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + aq + t + g + + + + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">dg</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + + + c + t + dgn + + + + + + + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + aqdc + t + gn + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfgklmorsv</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="marc:subfield[@code='a']"/> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + aq + t + g + + + + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">dg</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + + + c + t + dgn + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="specialSubfieldSelect"> + <xsl:with-param name="anyCodes">tfklsv</xsl:with-param> + <xsl:with-param name="axis">t</xsl:with-param> + <xsl:with-param name="afterCodes">g</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + aqdc + t + gn + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfgklmorsv</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + issue number + matrix number + music plate + music publisher + videorecording identifier + + + + + + ba + ab + + + + + + + + + + + + + + + + + + c + + + + + ab + + + + + + + + + + + doi + hdl + + + + + + + + + + + + y3z + + + + + + + + + + + + + + + + + + + + + doi + hdl + + + + + + + + + + + y3z + + + + + + + + + + + + + + + + + y3 + + + + + + + z + + + + + + + + + + + + aacr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Converted from MARCXML to MODS version 3.4 using MARC21slim2MODS3-4.xsl + (Revision 1.70) + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + n + n + fgkdlmor + + + + + p + p + fgkdlmor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + g + g + pst + + + + + p + p + fgkdlmor + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cdn + + + + + + + + + + aq + + + + :,;/ + + + + + + + + + + acdeq + + + + + + constituent + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="."/> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + code + marcgac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lcsh + lcshac + mesh + + nal + csh + rvm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Arab + Arab + Latn + Latn + CJK + Cyrl + Cyrl + Hebr + Grek + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + summary or subtitle + sung or spoken text + libretto + table of contents + accompanying material + translation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + summary or subtitle + sung or spoken text + libretto + table of contents + accompanying material + translation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Latn + Arab + Arab + Latn + Latn + CJK + Cyrl + Cyrl + Hebr + Grek + + + + + + + + + + + + + + + + + + + + + Latn + Arab + Arab + Latn + Latn + CJK + Cyrl + Cyrl + Hebr + Grek + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('s',@code))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if + test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('s',@code))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if + test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + + <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> + + + + + + + + + + + + + b + afgk + + + + + abfgk + + + + + + + + + + + + + + + + + + + + <xsl:value-of select="substring($titleChop,@ind2+1)"/> + + + + + <xsl:value-of select="$titleChop"/> + + + + + + + + + b + b + afgk + + + + + + + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <!-- 1/04 removed $h, $b --> + <xsl:with-param name="codes">af</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + 1 + + + + + <xsl:variable name="str"> + <xsl:for-each select="marc:subfield"> + <xsl:if test="(contains('s',@code))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if + test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))"> + <xsl:value-of select="text()"/> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:value-of select="substring($str,1,string-length($str)-1)"/> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">ah</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + primary + + + + + 1 + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + personal + + + + + + + + + + + + + + + + + + + + abcdef + - + + + + + + + + + + + abvxyz + - + + + + + + + + + + + + agrt + + + + + + + + + + + + ab + + + + + + + + + + + ab + + + + + + + + + + + + 00 + + + + c + + + + + + + + c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + defg + + + + + + + + + + + + + + + marcgac + + + + + + iso3166 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + aq + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">t</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + + + + + + + + + + + + cdnp + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">t</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + abcdeqnp + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">tpn</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + <xsl:call-template name="chopPunctuation"> + <xsl:with-param name="chopString"> + <xsl:call-template name="subfieldSelect"> + <xsl:with-param name="codes">adfhklor</xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + + + + + + + + + + + + + + + + + + + + + abcd + + + + + + + + + + + + + + + + + abcd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ab + + + + + + + + abx + + + + + + + + + + + + + ab + + + + + + + + + + + ab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <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> + + + + + + + + + + + + + + + abe + + + + + + + + u + + + + + + + hijklmt + + + + + + + + + + + + + + true + + true + + true + false + + + + primary display + + + + + + y3 + + + + + + + z + + + + + + + + + + + + + + + + abcd35 + + + + + + + + + abcde35 + + + + + + + + + + + + + +
diff --git a/src/test/resources/org/xbib/marc/summerland-mods-loc-goc-local-copy.xml b/src/test/resources/org/xbib/marc/summerland-mods-loc-goc-local-copy.xml new file mode 100644 index 0000000..d766c1d --- /dev/null +++ b/src/test/resources/org/xbib/marc/summerland-mods-loc-goc-local-copy.xml @@ -0,0 +1,54 @@ + + +Summerland + + +Chabon, Michael. + +text + + +nyu + + +New York + +Miramax Books/Hyperion Books for Children +c2002 +2002 +1st ed. +monographic + + + +eng + + +
print
+500 p. ; 22 cm. +
+Ethan Feld, the worst baseball player in the history of the game, finds himself recruited by a 100-year-old scout to help a band of fairies triumph over an ancient enemy. +juvenile + +Fantasy + + +Baseball +Fiction + + +Magic +Fiction + +0786808772 +0786816155 (pbk.) + +aacr +DLC +020805 +20030616111422.0 +12883376 +Converted from MARCXML to MODS version 3.4 using MARC21slim2MODS3-4.xsl + (Revision 1.70) + +