7 Replies Latest reply on Sep 23, 2016 10:17 AM by anna.antonioli

    XML Import


      Hi all,

      I need to import into filemaker table an XML file as this:


      <?xml version="1.0" encoding="utf-8"?>
        <Field APIName="WrntyID">6029065</Field>
        <Field APIName="ExternalID">1761A</Field>
        <Field APIName="Name">sayIT SA</Field>


      now I'am trying to create the xls file.

      This is my xls file....


      <?xml version='1.0' encoding='UTF-8'?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:template match="/">
              <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
                      <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="WrntyID" TYPE="TEXT"/>
                      <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ExternalID" TYPE="TEXT"/>
                      <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Name" TYPE="TEXT"/>           
                              <DATA><xsl:value-of select=“Account/Field[1]" /></DATA>
                              <DATA><xsl:value-of select=“Account/Field[2]” /></DATA>
                              <DATA><xsl:value-of select=“Account/Field[3]” /></DATA>


      This instruction <xsl:value-of select=“Account/Field[1]"/> doesn't work.


      What is the right syntax to retrive the value of the first TAG FIELD? Then the second end so on...?

      Many thanks


        • 1. Re: XML Import

          slightly wrong xpath, I think. Try this:


          <xsl:value-of select=“/Account/Field[1]” />


          or this:


          <xsl:value-of select=“//Account/Field[1]” />




          • 2. Re: XML Import

            Try this:


            <xsl:for-each select = "//Account"><ROW>

            <COL><DATA><xsl:value-of select="./Field[@APIName='WrntyID']" /></DATA></COL>

            <COL><DATA><xsl:value-of select="./Field[@APIName='ExternalID']" /></DATA></COL>

            <COL><DATA><xsl:value-of select="./Field[@APIName='Name']" /></DATA></COL>



            Part of the problem may also be that there are two FIELD/Field elements (in the Account and in METADATA).

            If the above doesn't work, we can address making these unique. (but the import worked for me)



            1 of 1 people found this helpful
            • 3. Re: XML Import

              yep! that works, too. However I also found the XSLT has curly quotes, so that may be part of the problem.



              • 4. Re: XML Import

                Quotation should be simple double quote. "

                Smart quotes don't work.

                • 5. Re: XML Import

                  Thanks, Beverly,


                  I also managed to miss the request to import all records which you put in your post. xsl:for-each is the way to import all records (well, it is according to your book )

                  • 6. Re: XML Import

                    there may NOT be multiple Account segments. I just always plan for every element to repeat in some way.

                    for the Field element, it had different attribute values that could be leveraged to make them distinct. The [n] method works, but leaves it vague as to how the Field values may be different. Otherwise I might even put them into a related table (as I do for most repeating child elements).


                    • 7. Re: XML Import


                      with simple double quote It's works.

                      I  tried the other syntax too and It's works.


                      Many thanks,