开发者

Transform data in FMPXMLRESULT grammar into a "Content Standard for Digital Geospatial Metadata (CSDGM)" compliant XML

I have a problem in FileMaker; I wish to link the METADATA element/FIELD element “NAME” attribute to its corresponding data in the RESULTSET element/COL element.

However, I also wish to map the METADATA element/FIELD element “NAME” to "Content Standard for Digital Geospatial Metadata (CSDGM)" metadata elements

Sample XML Metadata Record with CSDGM Essential Elements

<?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>
    </desc开发者_如何学Goript>


I see it's a rather old post; do you still need an answer? If yes, then please clarify what you mean by ‘link element to element’ and whether you need to import this file, export it, or both.

Update: here's a basic XSLT that transforms FileMaker XML grammar into CSDGM. It assumes all data reside in a single table and are exported in the specified order. It also assumes that the GSDGM grammar has a single metadata as the root element and then repeats idinfo and children for every record.

Note that it won't convert FileMaker dates like 5/17/2010 to 20100517; it's possible to write this in XSLT, but it will be much faster to add a calculated field in the table that produces such a string and export this field instead of 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜