MARC-xml レコードを FGDC-xml メタデータに変換する xslt スタイルシートを作成しています。多くの MARC フィールドの末尾に不要な句読点 (ピリオド、コロン、コンマなど) があり、これを取り除きたいと考えています。ただし、行からすべての句読点を削除したくはありません。私の考えでは、 ifステートメントを使用してテンプレートを作成し、フィールドが指定された文字で終わるかどうかをテストしてから削除することですが、1) これが良いアプローチかどうか、2) そのプロセスを指定する方法はわかりません。
私のxsltを編集しました:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:marc="http://www.loc.gov/MARC21/slim" >
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="marc:collection/marc:record">
<xsl:result-document method="xml" href="banana_{marc:controlfield[@tag=001]}.xml">
<metadata>
<xsl:apply-templates select="self::marc:record"/>
</metadata>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
<xsl:template match="marc:record">
<pubinfo>
<pubplace><xsl:value-of select="marc:datafield[@tag=260]/marc:subfield[@code='a']"/></pubplace>
<publish><xsl:value-of select="marc:datafield[@tag=260]/marc:subfield[@code='b']" /></publish>
</pubinfo>
</xsl:template>
</xsl:stylesheet>
そして、ここに私のxmlドキュメント(または少なくともその代表的な部分)があります:
<?xml version="1.0" encoding="UTF-8"?>
<marc:collection xmlns:marc="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">
<marc:record>
<marc:leader>01502cfm a2200313 a 4500</marc:leader>
<marc:controlfield tag="001">7943586</marc:controlfield>
<marc:datafield tag="260" ind1=" " ind2=" ">
<marc:subfield code="a">[S.l. :</marc:subfield>
<marc:subfield code="b">s.n. ,</marc:subfield>
<marc:subfield code="c">18--]</marc:subfield>
</marc:datafield>
</marc:record>
<marc:record>
<marc:leader>01290cem a2200313 a 4500</marc:leader>
<marc:controlfield tag="001">8108664</marc:controlfield>
<marc:datafield tag="260" ind1=" " ind2=" ">
<marc:subfield code="a">Torino :</marc:subfield>
<marc:subfield code="b">Editore Gio. Batt. Maggi ,</marc:subfield>
<marc:subfield code="c">1863.</marc:subfield>
</marc:datafield>
</marc:record>
</marc:collection>