使用XSLT转换修改后的Dublin Core XML

如何解决使用XSLT转换修改后的Dublin Core XML

我想将已用唯一标识符标记的自定义xml转换为MARCXML,但是我不知道从哪里开始。例如,我需要输入<untl:title qualifier="officialtitle" >Equation of State and Heat Content of Uranium</untl:title>并将其分配给245字段。这是我尝试提取标题的尝试,但是我不知道在哪里指定从正确的元素中提取哪个限定词。我对XSLT的了解非常稀疏,对您的帮助非常感激。

<xsl:for-each select="untl:title">
<datafield tag="245" ind1="1" ind2="0">
<subfield code="a">
<xsl:value-of select="."/>
</subfield>
</datafield>
</xsl:for-each>

Edit(8/17/2020):我正在使用一个名为MarcEdit的程序,他已经创建了XSLT工作表的预设,我相信可以针对UNTL进行修改,但是我目前不具备自定义的知识或专业技能他们。您将在下面看到目标结构表,我的当前代码以及我正在用作参考的预设XSLT。

到目前为止,

代码:并不很多,实际上是试图确定UNTL的命名空间。通过在线阅读,我对xsl:import的理解是,它可以将目标结构(MARC21slimUtils)导入到我当前的XSL文件中。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:untl="https://library.unt.edu/digital-projects-unit/metadata/input-guidelines-descriptive/"
    xmlns:untlterms ="https://library.unt.edu/digital-projects-unit/metadata/input-guidelines-descriptive/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://digital2.library.unt.edu/untl.xsd"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.loc.gov/MARC21/slim"  exclude-result-prefixes=" untl untlterms ">
 
    <xsl:import href="MARC21slimUtils.xsl"/>
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">
    <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:apply-templates />
    </collection>
    </xsl:template>
</xsl:stylesheet>

示例记录:

<record>
  <header>
    <identifier>info:ark/67531/metadc714189</identifier>
    <datestamp>2019-04-23T20:54:10Z</datestamp>
    <setSpec>partner:UNTGD</setSpec>
    <setSpec>collection:TRAIL</setSpec>
    <setSpec>collection:TRAMC</setSpec>
    <setSpec>access_rights:public</setSpec>
  </header>
  <metadata>
    <untl:metadata xmlns:untl="http://digital2.library.unt.edu/untl/">
      <untl:title qualifier="officialtitle">Critical-Assembly Studies on an Intermediate Reactor for Aircraft Propulsion</untl:title>
      <untl:title qualifier="seriestitle">BMI (Series)</untl:title>
      <untl:title qualifier="seriestitle">Battelle Memorial Institute Reports</untl:title>
      <untl:title qualifier="addedtitle">Battelle Memorial Institute Report BMI-1209</untl:title>
      <untl:creator qualifier="aut">
        <untl:name>Marinaccio,Lawrence F.</untl:name>
        <untl:type>per</untl:type>
      </untl:creator>
      <untl:creator qualifier="aut">
        <untl:name>Jung,Richard G.</untl:name>
        <untl:type>per</untl:type>
      </untl:creator>
      <untl:creator qualifier="aut">
        <untl:name>Jankowski,Francis J.</untl:name>
        <untl:type>per</untl:type>
      </untl:creator>
      <untl:creator qualifier="aut">
        <untl:name>Dingee,David A.</untl:name>
        <untl:type>per</untl:type>
      </untl:creator>
      <untl:creator qualifier="aut">
        <untl:name>Chastain,Joel W.</untl:name>
        <untl:type>per</untl:type>
      </untl:creator>
      <untl:contributor qualifier="org">
        <untl:name>U.S. Atomic Energy Commission</untl:name>
        <untl:type>org</untl:type>
      </untl:contributor>
      <untl:contributor qualifier="org">
        <untl:name>Battelle Memorial Institute</untl:name>
        <untl:type>org</untl:type>
      </untl:contributor>
      <untl:publisher>
        <untl:location>Columbus,Ohio</untl:location>
        <untl:name>Battelle Memorial Institute</untl:name>
      </untl:publisher>
      <untl:date qualifier="creation">1957-07-15</untl:date>
      <untl:language>eng</untl:language>
      <untl:description qualifier="content">The following report studies an intermediate solid-fuel reactor system for aircraft propulsion.</untl:description>
      <untl:description qualifier="physical">[87] p. : ill.,tables ; 28 cm.</untl:description>
      <untl:subject qualifier="LCSH">Airplanes -- Nuclear power plants.</untl:subject>
      <untl:subject qualifier="LCSH">Liquid metal cooled reactors.</untl:subject>
      <untl:primarySource>1</untl:primarySource>
      <untl:coverage qualifier="placeName">United States</untl:coverage>
      <untl:collection>TRAIL</untl:collection>
      <untl:collection>TRAMC</untl:collection>
      <untl:institution>UNTGD</untl:institution>
      <untl:rights qualifier="note">The contents of TRAIL Microcard Collection,hosted by the University of North Texas Libraries (digital content including images,text,and sound and video recordings) are made publicly available by the collection-holding partners for use in research,teaching,and private study. For the full terms of use,see https://digital.library.unt.edu/terms-of-use/</untl:rights>
      <untl:resourceType>text_report</untl:resourceType>
      <untl:format>text</untl:format>
      <untl:identifier qualifier="itemURL">https://digital.library.unt.edu/ark:/67531/metadc714189/</untl:identifier>
      <untl:identifier qualifier="OCLC">922939295</untl:identifier>
      <untl:identifier qualifier="SUDOC">Y 3.AT 7:22/BMI-1209</untl:identifier>
      <untl:identifier qualifier="REP-NO">BMI-1209</untl:identifier>
      <untl:identifier qualifier="thumbnailURL">https://digital.library.unt.edu/ark:/67531/metadc714189/small/</untl:identifier>
      <untl:identifier qualifier="ARK">ark:/67531/metadc714189</untl:identifier>
      <untl:identifier qualifier="iiif-manifest">https://digital.library.unt.edu/ark:/67531/metadc714189/manifest/</untl:identifier>
      <untl:note qualifier="display">Digitized from microopaque cards.</untl:note>
      <untl:meta qualifier="system">DC</untl:meta>
      <untl:meta qualifier="ark">ark:/67531/metadc714189</untl:meta>
      <untl:meta qualifier="metadataCreationDate">2018-02-12,07:42:45</untl:meta>
      <untl:meta qualifier="metadataModifier">htarver</untl:meta>
      <untl:meta qualifier="metadataModificationDate">2019-04-23,20:54:10</untl:meta>
      <untl:meta qualifier="hidden">False</untl:meta>
    </untl:metadata>
  </metadata>
</record>

目标结构(MARC21slimUtils):

xsd:schema xmlns="http://www.loc.gov/MARC21/slim" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.loc.gov/MARC21/slim" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.1" xml:lang="en">
<xsd:annotation>
<xsd:documentation> MARCXML: The MARC 21 XML Schema Prepared by Corey Keith May 21,2002 - Version 1.0 - Initial Release ********************************************** Changes. August 4,2003 - Version 1.1 - Removed import of xml namespace and the use of xml:space="preserve" attributes on the leader and controlfields. Whitespace preservation in these subfields is accomplished by the use of xsd:whiteSpace value="preserve" May 21,2009 - Version 1.2 - in subfieldcodeDataType the pattern "[\da-z!"#$%&'()*+,-./:;<=>?{}_^`~\[\]\\]{1}" changed to: "[\dA-Za-z!"#$%&'()*+,-./:;<=>?{}_^`~\[\]\\]{1}" i.e "A-Z" added after "[\d" before "a-z" to allow upper case. This change is for consistency with the documentation. ************************************************************ This schema supports XML markup of MARC21 records as specified in the MARC documentation (see www.loc.gov). It allows tags with alphabetics and subfield codes that are symbols,neither of which are as yet used in the MARC 21 communications formats,but are allowed by MARC 21 for local data. The schema accommodates all types of MARC 21 records: bibliographic,holdings,bibliographic with embedded holdings,authority,classification,and community information. </xsd:documentation>
</xsd:annotation>
<xsd:element name="record" type="recordType" nillable="true" id="record.e">
<xsd:annotation>
<xsd:documentation>record is a top level container element for all of the field elements which compose the record</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="collection" type="collectionType" nillable="true" id="collection.e">
<xsd:annotation>
<xsd:documentation>collection is a top level container element for 0 or many records</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:complexType name="collectionType" id="collection.ct">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="record"/>
</xsd:sequence>
<xsd:attribute name="id" type="idDataType" use="optional"/>
</xsd:complexType>
<xsd:complexType name="recordType" id="record.ct">
<xsd:sequence minOccurs="0">
<xsd:element name="leader" type="leaderFieldType"/>
<xsd:element name="controlfield" type="controlFieldType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="datafield" type="dataFieldType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="type" type="recordTypeType" use="optional"/>
<xsd:attribute name="id" type="idDataType" use="optional"/>
</xsd:complexType>
<xsd:simpleType name="recordTypeType" id="type.st">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="Bibliographic"/>
<xsd:enumeration value="Authority"/>
<xsd:enumeration value="Holdings"/>
<xsd:enumeration value="Classification"/>
<xsd:enumeration value="Community"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="leaderFieldType" id="leader.ct">
<xsd:annotation>
<xsd:documentation>MARC21 Leader,24 bytes</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="leaderDataType">
<xsd:attribute name="id" type="idDataType" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="leaderDataType" id="leader.st">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:pattern value="[\d ]{5}[\dA-Za-z ]{1}[\dA-Za-z]{1}[\dA-Za-z ]{3}(2| )(2| )[\d ]{5}[\dA-Za-z ]{3}(4500| )"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="controlFieldType" id="controlfield.ct">
<xsd:annotation>
<xsd:documentation>MARC21 Fields 001-009</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="controlDataType">
<xsd:attribute name="id" type="idDataType" use="optional"/>
<xsd:attribute name="tag" type="controltagDataType" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="controlDataType" id="controlfield.st">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="controltagDataType" id="controltag.st">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:pattern value="00[1-9A-Za-z]{1}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="dataFieldType" id="datafield.ct">
<xsd:annotation>
<xsd:documentation>MARC21 Variable Data Fields 010-999</xsd:documentation>
</xsd:annotation>
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="subfield" type="subfieldatafieldType"/>
</xsd:sequence>
<xsd:attribute name="id" type="idDataType" use="optional"/>
<xsd:attribute name="tag" type="tagDataType" use="required"/>
<xsd:attribute name="ind1" type="indicatorDataType" use="required"/>
<xsd:attribute name="ind2" type="indicatorDataType" use="required"/>
</xsd:complexType>
<xsd:simpleType name="tagDataType" id="tag.st">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:pattern value="(0([1-9A-Z][0-9A-Z])|0([1-9a-z][0-9a-z]))|(([1-9A-Z][0-9A-Z]{2})|([1-9a-z][0-9a-z]{2}))"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="indicatorDataType" id="ind.st">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:pattern value="[\da-z ]{1}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="subfieldatafieldType" id="subfield.ct">
<xsd:simpleContent>
<xsd:extension base="subfieldDataType">
<xsd:attribute name="id" type="idDataType" use="optional"/>
<xsd:attribute name="code" type="subfieldcodeDataType" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="subfieldDataType" id="subfield.st">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="subfieldcodeDataType" id="code.st">
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
<xsd:pattern value="[\dA-Za-z!"#$%&'()*+,-./:;<=>?{}_^`~\[\]\\]{1}"/>
<!--  "A-Z" added after "\d" May 21,2009  -->
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="idDataType" id="id.st">
<xsd:restriction base="xsd:ID"/>
</xsd:simpleType>
</xsd:schema>

MarcEdit的XSLT参考表:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:dc="http://purl.org/dc/elements/1.1/" 
    xmlns:dcterms="http://purl.org/dc/terms/1.1" 
    xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
        http://www.openarchives.org/OAI/2.0/oai_dc.xsd"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.loc.gov/MARC21/slim"  exclude-result-prefixes="dc dcterms oai_dc">
 
    <xsl:import href="MARC21slimUtils.xsl"/>
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    
  
    <xsl:template match="/">
        <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:apply-templates />
        </collection>
    </xsl:template>
    
    <xsl:template name="OAI-PMH">
             <xsl:for-each select = "ListRecords/record/metadata/oai_dc:dc">
                <xsl:apply-templates  />
             </xsl:for-each>
             <xsl:for-each select = "GetRecord/record/metadata/oai_dc:dc">
                <xsl:apply-templates  />
             </xsl:for-each>
    </xsl:template>

    <xsl:template match="text()" />
    <xsl:template match="oai_dc:dc">
        <record>
            <xsl:element name="leader">
                <xsl:variable name="type" select="dc:type"/>
                <xsl:variable name="leader06">
                    <xsl:choose>
                        <xsl:when test="$type='collection'">p</xsl:when>
                        <xsl:when test="$type='dataset'">m</xsl:when>
                        <xsl:when test="$type='event'">r</xsl:when>
                        <xsl:when test="$type='image'">k</xsl:when>
                        <xsl:when test="$type='interactive resource'">m</xsl:when>
                        <xsl:when test="$type='service'">m</xsl:when>
                        <xsl:when test="$type='software'">m</xsl:when>
                        <xsl:when test="$type='sound'">i</xsl:when>
                        <xsl:when test="$type='text'">a</xsl:when>
                        <xsl:otherwise>a</xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>
                <xsl:variable name="leader07">
                    <xsl:choose>
                        <xsl:when test="$type='collection'">c</xsl:when>
                        <xsl:otherwise>m</xsl:otherwise>
                    </xsl:choose>
                </xsl:variable>
                <xsl:value-of select="concat('      ',$leader06,$leader07,' a       3u     ')"/>
            </xsl:element>

            <datafield tag="042" ind1=" " ind2=" ">
                <subfield code="a">dc</subfield>
            </datafield>


            
            <xsl:for-each select="dc:creator">
                <xsl:choose>
                    <xsl:when test="(.!='') and (position()=1)">
                        <xsl:call-template name="persname_template">
                            <xsl:with-param name="string" select="." />
                            <xsl:with-param name="field" select="'100'" />
                            <xsl:with-param name="ind1" select = "'1'" />
                            <xsl:with-param name="ind2" select = "'0'" />
                            <xsl:with-param name="type" select="'author'" />
                        </xsl:call-template>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:if test=".!=''">
                            <xsl:call-template name="persname_template">
                                <xsl:with-param name="string" select="." />
                                <xsl:with-param name="field" select="'700'" />
                                <xsl:with-param name="ind1" select = "'1'" />
                                <xsl:with-param name="ind2" select = "'0'" />
                                <xsl:with-param name="type" select="'author'" />
                            </xsl:call-template>
                        </xsl:if>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
            
        
            <xsl:for-each select="dc:title[1]">
                <datafield tag="245" ind1="0" ind2="0">
                    <subfield code="a">
                        <xsl:value-of select="."/>
                    </subfield>
                </datafield>
            </xsl:for-each>

            <xsl:for-each select="dc:title[position()>1]">
                <xsl:if test=".!=''">
                    <datafield tag="246" ind1="3" ind2="3">
                        <subfield code="a">
                            <xsl:value-of select="."/>
                        </subfield>
                    </datafield>
                </xsl:if>
            </xsl:for-each>

            <xsl:choose>
                <xsl:when test="dc:publisher">
                    <xsl:if test="translate(dc:publisher/.,'.,:;','')!=''">
                        <datafield tag="260" ind1=" " ind2=" ">
                        <xsl:choose>
                            <xsl:when test="dc:date">   
                                <subfield code="b"><xsl:value-of select="dc:publisher[1]"/>,</subfield>    
                                <xsl:if test="translate(dc:date[1]/.,'')!=''">
                                    <subfield code="c"><xsl:value-of select="dc:date[1]" />.</subfield>
                                </xsl:if>
                            </xsl:when>
                            <xsl:otherwise>
                                <subfield code="b"><xsl:value-of select="dc:publisher[1]"/>.</subfield> 
                            </xsl:otherwise>
                        </xsl:choose>
                        </datafield>
                    </xsl:if>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:if test="translate(dc:date[1],'')!=''">
                        <datafield tag="260" ind1=" " ind2=" ">
                            <subfield code="c"><xsl:value-of select="dc:date[1]" />.</subfield>
                        </datafield>
                    </xsl:if>
                </xsl:otherwise>
            </xsl:choose>

            <xsl:for-each select="dc:coverage">
                <xsl:choose>
                    <xsl:when test="translate(.,'0123456789-.?','')=''">
                        <!--Likely;this is a date-->
                        <datafield tag="500" ind1=" " ind2=" ">
                            <subfield code="a"><xsl:value-of select="."/></subfield>
                        </datafield>
                    </xsl:when>
                    <xsl:otherwise>
                        <!--likely a geographic subject,we will print this later-->
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>

            <xsl:for-each select="dc:identifier">
                <xsl:if test="position()!=last()">
                    <datafield tag="500" ind1=" " ind2=" ">
                        <subfield code="a"><xsl:value-of select="." /></subfield>
                    </datafield>
                </xsl:if>
            </xsl:for-each>
            
            <xsl:for-each select="dc:description">
                <datafield tag="520" ind1=" " ind2=" ">
                    <subfield code="a">
                        <xsl:value-of select="normalize-space(.)"/>
                    </subfield>
                </datafield>
            </xsl:for-each>


            <xsl:for-each select="dc:rights">
                <datafield tag="540" ind1=" " ind2=" ">
                    <subfield code="a">
                        <xsl:value-of select="."/>
                    </subfield>
                </datafield>
            </xsl:for-each>


            <xsl:for-each select="dc:language">
                <datafield tag="546" ind1=" " ind2=" ">
                    <subfield code="a">
                        <xsl:value-of select="."/>
                    </subfield>
                </datafield>
            </xsl:for-each>



            <xsl:for-each select="dc:subject">
                <datafield tag="690" ind1=" " ind2=" ">
                    <subfield code="a">
                        <xsl:value-of select="."/>
                    </subfield>
                </datafield>
            </xsl:for-each>
            
            <xsl:for-each select="dc:coverage">
                <xsl:choose>
                    <xsl:when test="translate(.,'')=''">
                        <!--Likely; this is a date-->
                    </xsl:when>
                    <xsl:otherwise>
                        <!--likely a geographic subject-->
                        <datafield tag="691" ind1=" " ind2=" ">
                            <subfield code="a"><xsl:value-of select="." /></subfield>
                        </datafield>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
                                                                                            

            <xsl:for-each select="dc:type">
                <datafield tag="655" ind1="7" ind2=" ">
                    <subfield code="a">
                        <xsl:value-of select="."/>
                    </subfield>
                    <subfield code="2">local</subfield>
                </datafield>
            </xsl:for-each>

            

            <xsl:for-each select="dc:contributor">
                    <xsl:call-template name="persname_template">
                        <xsl:with-param name="string" select="." />
                        <xsl:with-param name="field" select="'100'" />
                        <xsl:with-param name="ind1" select = "'1'" />
                        <xsl:with-param name="ind2" select = "'0'" />
                        <xsl:with-param name="type" select="'contributor'" />
                    </xsl:call-template>
            </xsl:for-each>
            
            <xsl:for-each select="dc:source">
                <datafield tag="786" ind1="0" ind2=" ">
                    <subfield code="n">
                        <xsl:value-of select="."/>
                    </subfield>
                </datafield>
            </xsl:for-each>

            <xsl:for-each select="dc:relation">
                <datafield tag="787" ind1="0" ind2=" ">
                    <subfield code="n">
                        <xsl:value-of select="."/>
                    </subfield>
                </datafield>
            </xsl:for-each>

            <xsl:if test="dc:identifier">
                <datafield tag="856" ind1="4" ind2="1">
                    <subfield code="u"><xsl:value-of select="dc:identifier[last()]" /></subfield>
                    <subfield code="z">Connect to this object online.</subfield>
                </datafield>
            </xsl:if>
        </record>       

    </xsl:template>
<xsl:template name="persname_template">
      <xsl:param name="string" />
      <xsl:param name="field" />
      <xsl:param name="ind1" />
      <xsl:param name="ind2" />
      <xsl:param name="type" />
      <datafield>
         <xsl:attribute name="tag">
            <xsl:value-of select="$field" />
         </xsl:attribute>
         <xsl:attribute name="ind1">
            <xsl:value-of select="$ind1" />
         </xsl:attribute>
         <xsl:attribute name="ind2">
            <xsl:value-of select="$ind2" />
         </xsl:attribute>

         <!-- Sample input: Brightman,Samuel C. (Samuel Charles),1911-1992 -->
         <!-- Sample output: $aBrightman,Samuel C. $q(Samuel Charles),$d1911-. -->
         <!-- will handle names with dashes e.g. Bourke-White,Margaret -->

         <!-- CAPTURE PRIMARY NAME BY LOOKING FOR A PAREN OR A DASH OR NEITHER -->
         <xsl:choose>
            <!-- IF A PAREN,STOP AT AN OPENING PAREN -->
            <xsl:when test="contains($string,'(')!=0">
               <subfield code="a">
                  <xsl:value-of select="substring-before($string,'(')" />
               </subfield>
            </xsl:when>
            <!-- IF A DASH,CHECK IF IT'S A DATE OR PART OF THE NAME -->
            <xsl:when test="contains($string,'-')!=0">
               <xsl:variable name="name_1" select="substring-before($string,'-')" />
               <xsl:choose>
                  <!-- IF IT'S A DATE REMOVE IT -->
                  <xsl:when test="translate(substring($name_1,(string-length($name_1)),1),'0123456789','9999999999') = '9'">
                     <xsl:variable name="name" select="substring($name_1,1,(string-length($name_1)-6))" />
                     <subfield code="a">
                        <xsl:value-of select="$name" />
                     </subfield>
                  </xsl:when>
                  <!-- IF IT'S NOT A DATE,CHECK WHETHER THERE IS A DATE LATER -->
                  <xsl:otherwise>
                     <xsl:variable name="remainder" select="substring-after($string,'-')" />
                     <xsl:choose>
                        <!-- IF THERE'S A DASH,ASSUME IT'S A DATE AND REMOVE IT -->
                        <xsl:when test="contains($remainder,'-')!=0">
                           <xsl:variable name="tmp" select="substring-before($remainder,'-')" />
                           <xsl:variable name="name_2" select="substring($tmp,(string-length($tmp)-6))" />
                           <subfield code="a">
                              <xsl:value-of select="$name_1" />-<xsl:value-of select="$name_2" />
                           </subfield>
                        </xsl:when>
                        <!-- IF THERE'S NO DASH IN THE REMAINDER,OUTPUT IT -->
                        <xsl:otherwise>
                           <subfield code="a">
                              <xsl:value-of select="$string" />
                           </subfield>
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:when>
            <!-- NO DASHES,NO PARENS,JUST OUTPUT THE NAME -->
            <xsl:otherwise>
               <subfield code="a">
                  <xsl:value-of select="$string" />
               </subfield>
            </xsl:otherwise>
         </xsl:choose>

         <!-- CAPTURE SECONDARY NAME IN PARENS FOR SUBFIELD Q -->
         <xsl:if test="contains($string,'(')!=0">
            <xsl:variable name="subq_tmp" select="substring-after($string,'(')" />
            <xsl:variable name="subq" select="substring-before($subq_tmp,')')" />
            <subfield code="q">
               (<xsl:value-of select="$subq" />)
            </subfield>
         </xsl:if>

         <!-- CAPTURE DATE FOR SUBFIELD D,ASSUME DATE IS LAST ITEM IN FIELD -->
         <!-- Note: does not work if name has a dash in it -->
         <xsl:if test="contains($string,'-')!=0">
            <xsl:variable name="date_tmp" select="substring-before($string,'-')" />
            <xsl:variable name="remainder" select="substring-after($string,'-')" />
            <xsl:choose>
               <!-- CHECK SECOND HALF FOR ANOTHER DASH; IF PRESENT,ASSUME THAT IS DATE -->
               <xsl:when test="contains($remainder,'-')!=0">
                  <xsl:variable name="tmp" select="substring-before($remainder,'-')" />
                  <xsl:variable name="date_1" select="substring($remainder,(string-length($tmp)-3))" />
                  <!-- CHECK WHETHER IT HAS A NUMBER BEFORE IT AND IF SO,OUTPUT IT AS DATE -->
                  <xsl:if test="translate(substring($date_1,'9999999999') = '9'">
                     <subfield code="d">
                        <xsl:value-of select="$date_1" />.
                     </subfield>
                  </xsl:if>
               </xsl:when>
               <!-- OTHERWISE THIS IS THE ONLY DASH SO TAKE IT -->
               <xsl:otherwise>
                  <xsl:variable name="date_2" select="substring($string,(string-length($date_tmp)-3))" />
                  <!-- CHECK WHETHER IT HAS A NUMBER BEFORE IT AND IF SO,OUTPUT IT AS DATE -->
                  <xsl:if test="translate(substring($date_2,'9999999999') = '9'">
                     <subfield code="d">
                        <xsl:value-of select="$date_2" />.
                     </subfield>
                  </xsl:if>
               </xsl:otherwise>
            </xsl:choose>
         </xsl:if>
         <subfield code="e"><xsl:value-of select="$type" /></subfield>
      </datafield>
   </xsl:template>
    
</xsl:stylesheet>

解决方法

我认为这会让您入门。它显示了如何输出字段100(作者):

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:untl="http://digital2.library.unt.edu/untl/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://www.loc.gov/MARC21/slim"
    exclude-result-prefixes="untl"
>
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:strip-space elements="*" />

    <xsl:template match="/">
        <collection xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
            <xsl:apply-templates select="record" />
        </collection>
    </xsl:template>

    <xsl:template match="record">
        <record>
            <xsl:apply-templates select="metadata/untl:metadata" />
        </record>
    </xsl:template>

    <xsl:template match="untl:metadata">
        <!-- add more <xsl:apply-templates> in the desired field output order -->
        <xsl:apply-templates select="untl:creator[@qualifier='aut']" />
    </xsl:template>
    
    <!-- write one template for each field -->
    <xsl:template match="untl:creator[@qualifier='aut']">
        <datafield tag="100" ind1="1" ind2=" ">
            <subfield code="a">
                <xsl:value-of select="untl:name" />
                <xsl:text>,</xsl:text>
            </subfield>
        </datafield>
    </xsl:template>
</xsl:stylesheet>

我故意为每个节点使用一个模板,因此您可以看到程序如何从输入(/的根节点流出,然后继续选择每个都有自己的模板的特定节点。 / p>

我认为您根本不需要包含MARC21slimUtils.xsl-我已经看过了,在这种情况下,其中的实用程序功能没有任何实际价值。

输出(与official MARCXML sample对齐),其格式具有可读性:

<collection xmlns="http://www.loc.gov/MARC21/slim" 
    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"
>
  <record>
    <datafield tag="100" ind1="1" ind2=" ">
      <subfield code="a">Marinaccio,Lawrence F.,</subfield>
    </datafield>
    <datafield tag="100" ind1="1" ind2=" ">
      <subfield code="a">Jung,Richard G.,</subfield>
    </datafield>
    <datafield tag="100" ind1="1" ind2=" ">
      <subfield code="a">Jankowski,Francis J.,</subfield>
    </datafield>
    <datafield tag="100" ind1="1" ind2=" ">
      <subfield code="a">Dingee,David A.,</subfield>
    </datafield>
    <datafield tag="100" ind1="1" ind2=" ">
      <subfield code="a">Chastain,Joel W.,</subfield>
    </datafield>
  </record>
</collection>

我不确定具体的内容,例如作者姓名中的结尾逗号或ind1ind2的含义,您会比我理解得更好。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-