将FMPXMLRESULT语法中的数据转换为符合XML的“数字地理空间元数据内容标准(CSDGM)”XML

时间:2010-04-18 15:51:09

标签: xml filemaker

我在FileMaker中遇到问题;我希望将METADATA元素/ FIELD元素“NAME”属性链接到RESULTSET元素/ COL元素中的相应数据。

但是,我还希望将METADATA元素/ FIELD元素“NAME”映射到“数字地理空间元数据的内容标准(CSDGM)”元数据元素

使用CSDGM基本元素的XML元数据记录示例

<?xml version="1.0" encoding="ISO-8859-1" ?>
  <metadata>
   <idinfo>
      <citation>
       <citeinfo>
          <origin>Louisiana State University Coastal Studies Institute</origin>
          <pubdate>20010907</pubdate>
          <title>Geomorphology and Processes of Land Loss in Coastal Louisiana, 1932 –
          1990</title>
       </citeinfo>
     </citation>
     <descript>
      <abstract>A raster GIS file that identifies the land loss process and
       geomorphology associated with each 12.5 meter pixel of land loss between
       1932 and 1990. Land loss processes are organized into a hierarchical
       classification system that includes subclasses for erosion, submergence,
       direct removal, and undetermined. Land loss geomorphology is organized
       into a hierarchical classification system that includes subclasses for both
       shoreline and interior loss.</abstract>
     <purpose>The objective of the study was to determine the land loss
      geomorphologies associated with specific processes of land loss in coastal
      Louisiana.</purpose>
    </descript>

1 个答案:

答案 0 :(得分:0)

我认为这是一个相当古老的帖子;你还需要答案吗?如果是,那么请澄清'link element to element'的含义以及是否需要导入此文件,导出它或两者兼而有之。

更新:这是一个将FileMaker XML语法转换为CSDGM的基本XSLT。它假定所有数据都驻留在单个表中,并以指定的顺序导出。它还假设GSDGM语法有一个metadata作为根元素,然后为每条记录重复idinfo和子元素。

请注意,它不会将5/17/2010之类的FileMaker日期转换为20100517;可以在XSLT中编写它,但是在生成这样一个字符串的表中添加一个计算字段并导出该字段而不是 Date 会快得多。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fm="http://www.filemaker.com/fmpxmlresult"
  exclude-result-prefixes="fm">

  <!-- This transformation converts FileMaker FMPXMLRESULT into CSDGM. 
       The assumed source data structure is that:

    Origin
    Date
    Title
    Abstract
    Purpose -->

  <xsl:variable name="ORIG" select="1" />
  <xsl:variable name="DATE" select="2" />
  <xsl:variable name="TITL" select="3" />
  <xsl:variable name="ABST" select="4" />
  <xsl:variable name="PURP" select="5" />

  <!-- The resulting format is XML, ISO-8859-1 -->
  <xsl:output method="xml" encoding="ISO-8859-1" />

  <!-- Main -->
  <xsl:template match="/">
    <metadata>
      <xsl:for-each select="//fm:ROW">
        <idinfo>
          <citation>
            <citeinfo>
              <origin>
                <xsl:value-of select="fm:COL[$ORIG]" />
              </origin>
              <pubdate>
                <xsl:value-of select="fm:COL[$DATE]" />
              </pubdate>
              <title>
                <xsl:value-of select="fm:COL[$TITL]" />
              </title>
            </citeinfo>
          </citation>
          <descript>
            <abstract>
              <xsl:value-of select="fm:COL[$ABST]" />
            </abstract>
            <purpose>
              <xsl:value-of select="fm:COL[$PURP]" />
            </purpose>
          </descript>
        </idinfo>
      </xsl:for-each>
    </metadata>
  </xsl:template>

</xsl:stylesheet>