1 Reply Latest reply on Jan 7, 2011 9:54 PM by FentonJones

    Need one field with two names?

      Title

      Need one field with two names?

      Post

      I am using FileMaker for the inventory for an online store. However, I need to output the inventory data in two different XML schemas, which have different field names (or labels) for the same data. How can I output the same data with different field names for each of the two schemas?

      Thanks

        • 1. Re: Need one field with two names?
          FentonJones

          I don't know what XML grammar you're going to use to Export XML, but the following XSL will transform a normal DSO grammar export (which exports the names of the fields), allowing you to change the name of one specified field ("id" in this case; changes it to "Donuts").

          It also adds a "root" element (one and only one is required in XML), and a "row" Element, which is what you could use (optionally) to name each FileMaker record row. The rest is fields.

          <?xml version="1.0" encoding="UTF-8"?>
          <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:fmp="http://www.filemaker.com/fmpdsoresult" exclude-result-prefixes="fmp">
          <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
          <xsl:template match="/">
          <xsl:element name="RootElement">
          <xsl:for-each select="fmp:FMPDSORESULT/fmp:ROW/.">
          <xsl:element name="RowElement">
          <xsl:for-each select="./*">
          <xsl:choose>
          <xsl:when test="name()='id'">
          <xsl:element name="Donuts">
          <xsl:value-of select="."/>
          </xsl:element>
          </xsl:when>
          <xsl:otherwise>
          <xsl:element name="{name()}">
          <xsl:value-of select="."/>
          </xsl:element>
          </xsl:otherwise>
          </xsl:choose>
          </xsl:for-each>
          </xsl:element>
          </xsl:for-each>
          </xsl:element>
          </xsl:template>
          </xsl:stylesheet>