2012-08-26 1 views
1

Zotero 데이터베이스에서 FileMaker Pro로 항목을 가져와야합니다. 가장 확실한 방법은 Zotero에서 xml로 내보내고 xml을 FMPXMLRESULT xml 형식으로 변환 한 다음 FileMaker Pro로 가져 오는 것입니다.Zotero xml 출력을 FMPXMLRESULT xml로 변환하는 XSLT?

저는 XML 형식의 번역을 다루는 완전한 초보자입니다.

누구나 그렇게 할 수있는 xslt가 있습니까? 아니면이 두 xml 형식 (일반 xslt/xml 참조가 아닌)에 대한 제안을 제게 제공합니까?

Zotero xml 출력물은 의회 도서관 MODS 양식에 있습니다 : http://www.loc.gov/standards/mods/.

FileMaker Pro FMPXMLRESULT xml 형식은 여기에 설명되어 있습니다. http://www.filemaker.com/help/html/import_export.16.30.html.

다음은 Zotero MODS 내보내기 예제입니다. (죄송합니다, 들여 쓰기 중 일부는이 게시물의 코드 블록을 형성 할 수있는 파일을 복사에 열중하고 있었다 여기에 실제 파일에 드롭 박스 링크입니다 :. https://www.dropbox.com/s/otrwr7xk0uwmff7/From_Zotero_MODS.xml를)

<?xml version="1.0"?> 
<modsCollection xsi:schemaLocation="http://www.loc.gov/mods/v3  
http://www.loc.gov/standards/mods/v3/mods-3-2.xsd" xmlns="http://www.loc.gov/mods/v3"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <mods> 
<titleInfo> 
    <title>Roberto Giobbi's Card college. Volume 1</title> 
</titleInfo> 
<typeOfResource>text</typeOfResource> 
<genre authority="local">book</genre> 
<genre authority="marcgt">book</genre> 
<name type="personal"> 
    <namePart type="family">Giobbi</namePart> 
    <namePart type="given">Roberto</namePart> 
    <role> 
    <roleTerm type="code" authority="marcrelator">aut</roleTerm> 
    </role> 
</name> 
<originInfo> 
    <place> 
    <placeTerm type="text">Seattle, Wash.</placeTerm> 
    </place> 
    <publisher>Hermetic Press</publisher> 
    <copyrightDate>1996</copyrightDate> 
    <issuance>monographic</issuance> 
</originInfo> 
<identifier type="isbn">0945296185</identifier> 
<subject> 
    <topic>Card tricks</topic> 
</subject> 
<note>External Resources: Cite This Item Search for versions with same title and author  
| Advanced options ... 
Uniform Title: Grosse kartenschule. Band 1. English 
Edition: Rev. 2nd ed. ; English language ed. 
Language: English 
Note(s): Includes bibliographical references (p. [245]-247) and index. 
Other Titles: Card college 
Responsibility: illustrated by Barbara Giobbi-Ebnöther ; translated from the German by  
Richard Hatch. 
Vendor Info: Baker &amp; Taylor YBP Library Services (BKTY YANK) 32.00 Status:     
active Note:    B&amp;T Title: Card College 
Entry: 19960709 
Update: 20091103 
Provider: OCLC</note> 
</mods> 
<mods> 
<titleInfo> 
    <title>Book of magic.</title> 
</titleInfo> 
<typeOfResource>text</typeOfResource> 
<genre authority="local">book</genre> 
<genre authority="marcgt">book</genre> 
<name type="personal"> 
    <namePart type="family">Warlock</namePart> 
    <namePart type="given">Peter</namePart> 
    <role> 
    <roleTerm type="code" authority="marcrelator">aut</roleTerm> 
    </role> 
</name> 
<originInfo> 
    <publisher>London New York, Arco</publisher> 
    <copyrightDate>1956</copyrightDate> 
    <issuance>monographic</issuance> 
</originInfo> 
<subject> 
    <topic>Magic tricks</topic> 
</subject> 
<note>External Resources: Cite This Item Search for versions with same title and author 
| Advanced options ... 
Edition: [1st ed.] 
Language: English 
Class Descriptors: LC: GV1547; Dewey: 793.8 
Entry: 19750729 
Update: 20120116 
Provider: OCLC</note> 
</mods> 
<mods> 
<titleInfo> 
    <title>The amateur magician's handbook,</title> 
</titleInfo> 
<typeOfResource>text</typeOfResource> 
<genre authority="local">book</genre> 
<genre authority="marcgt">book</genre> 
<name type="personal"> 
    <namePart type="family">Hay, Henry</namePart> 
    <namePart type="given"/> 
    <role> 
    <roleTerm type="code" authority="marcrelator">aut</roleTerm> 
    </role> 
</name> 
<name type="personal"> 
    <namePart type="family">Mussey</namePart> 
    <namePart type="given">June Barrows</namePart> 
    <role> 
    <roleTerm type="code" authority="marcrelator">aut</roleTerm> 
    </role> 
</name> 
<originInfo> 
    <publisher>New York, Crowell</publisher> 
    <copyrightDate>1972</copyrightDate> 
    <issuance>monographic</issuance> 
</originInfo> 
<identifier type="isbn">0690057113</identifier> 
<subject> 
    <topic>Magic tricks</topic> 
</subject> 
<note>External Resources: Cite This Item Search for versions with same title and author 
| Advanced options ... 
Edition: 3d ed., rev. and expanded. 
Language: English 
Note(s): Bibliography: p. 365-373. 
Class Descriptors: LC: GV1547; Dewey: 793.8 
Responsibility: by Henry Hay. Photos. by Audrey Alley. 
Vendor Info: Baker and Taylor (BTCP) 
Entry: 19720814 
Update: 20080829 
Provider: OCLC</note> 
</mods> 
</modsCollection> 
+0

Zotero XML 스펙에 대한 링크를 제공해 주시겠습니까? 빠른 검색을 수행했지만 아무 것도 발견하지 못했습니다 (HTML 및 RTF 내보내기 만 가능). –

+0

샘플 소스 XML 문서와 정확한 결과를 제공하십시오. 하나의 문서 유형에서 다른 문서 유형으로의 일반적인 변환은 너무 많은 자원을 필요로 할 수 있으므로 매우 적은 수의 사람들이이를 수행하는 데 필요한 시간을 가질 수 있습니다. –

답변

1

은 그래서 참고 문헌 같다. 음, FileMaker에서 어떻게 가져갈 지에 달려 있습니다. 기본 FileMaker XSLT는 다음과 같습니다.

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="1.0" 
    xmlns:mod="http://www.loc.gov/mods/v3" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

    <xsl:template match="/"> 
    <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> 
     <ERRORCODE>0</ERRORCODE> 
     <PRODUCT NAME="N/A" BUILD="N/A" VERSION="N/A"/> 
     <DATABASE NAME="N/A" LAYOUT="N/A" RECORDS="1" 
     DATEFORMAT="M/d/yyyy" TIMEFORMAT="h:mm:ss a"/> 
     <METADATA> 
     <!-- 1 --> 
     <FIELD EMPTYOK="YES" MAXREPEAT="1" TYPE="NUMBER" 
      NAME="Title" /> 
     <!-- More field definitions --> 
     </METADATA> 
     <RESULTSET> 
     <xsl:for-each select="mod:modsCollection/mod:mods"> 
      <ROW MODID="1" RECORDID="1"> 
      <!-- 1. Title --> 
      <COL> 
       <DATA> 
       <xsl:value-of select="mod:titleInfo/mod:title" /> 
       </DATA> 
      </COL> 
      <!-- More COL's in the same order as the fields --> 
      </ROW> 
     </xsl:for-each> 
     </RESULTSET> 
    </FMPXMLRESULT> 
    </xsl:template> 
</xsl:stylesheet> 

이 파일은 제목을 가져와야합니다. template match="/"은 C에서 main()과 비슷하지만 (일반적인) 진입 점입니다. 도착하면 XML 결과의 골격을 출력합니다.

일단 행을 가져 오면 XSLT 명령을 사용하여 테이블의 레코드가 될 요소를 반복합니다. 우리의 경우 이들은 mod:modsCollection/mod:mods입니다. 즉, 참고 문헌 항목입니다. 예를 들어 모든 이름을 반복 할 수 있습니다 (//mod:name). mod: 접두어는 Zotero 네임 스페이스 (http://www.loc.gov/mods/v3)의 바로 가기입니다. 원래 XML에서는 기본 네임 스페이스로 지정되므로 접두사없이 사용되지만 XSLT에서는 FileMaker XML 네임 스페이스를 기본값으로 사용하고 (FMPXMLRESULT에서이 이름을 지정하는 방법 참조) Zotero 요소를 참조하는 접두어를 정의합니다 .

루핑 표현식은 XPath 식입니다. 구글 전체 사양을 찾을 수 있습니다. 여기에 간단한 표현을 사용하여 모두 mods 요소를 가져 왔습니다. 필자는 FileMaker 편지지 (ROW)를 출력 한 다음 각 필드에 대해 COLDATA을 출력합니다. 자, 첫 번째 필드에 대해 DATA 제목 데이터를 읽어야합니다. 내가 mods 요소에 있기 때문에 데이터 경로는 titleInfo/title입니다. 값을 얻으려면 xsl:value-of 요소를 사용합니다.

필드를 더 가져 오려면 필드 정의를 더 추가하고 을 더 추가하십시오. 다른 항목 (예 : 항목은 아니지만 모든 사람)을 가져 오려면 xsl:for-each에 다른 표현식을 사용하십시오. 이것은 당신을 시작할 것입니다 :)

+0

많은 감사합니다! 이것은 나를 시작하게하고 (그리고 더 많은 필드를 추가하는 것처럼) 보인다. 내가 이해하지 못했던 부분은 주변의'modsCollection' 태그 쌍 내에서 원래 DOCS XML의 모든 항목을 중첩 처리하는 방법이었습니다. – murray