Jump to content

XML export with XLST results in one long row of data


justakid

This topic is 3007 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hey Guys
,

I've been going crazy trying to get this work, but just don't know what I'm doing wrong...

This is the xml exported from FM Pro v14

<?xml version="1.0" encoding="utf-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
  <ERRORCODE>0</ERRORCODE>
  <PRODUCT BUILD="10-26-2015" NAME="FileMaker" VERSION="ProAdvanced 14.0.4" />
  <DATABASE DATEFORMAT="D/m/yyyy" LAYOUT="" NAME="TEST_v02.fmp12" RECORDS="2749" TIMEFORMAT="h:mm:ss a" />
  <METADATA>
    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Shot" TYPE="TEXT" />
    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ShotInCut" TYPE="TEXT" />
    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="LustreSrcINFrame" TYPE="NUMBER" />
    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="LustreSrcOut" TYPE="NUMBER" />
    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="LustreStart" TYPE="TEXT" />
    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="LustreEnd" TYPE="NUMBER" />
  </METADATA>
  <RESULTSET FOUND="4">
    <ROW MODID="0" RECORDID="22355">
      <COL>
        <DATA>abc0198</DATA>
      </COL>
      <COL>
        <DATA>abc0198_cpa_v090_ww_v002</DATA>
      </COL>
      <COL>
        <DATA>1016</DATA>
      </COL>
      <COL>
        <DATA>1076</DATA>
      </COL>
      <COL>
        <DATA>98471</DATA>
      </COL>
      <COL>
        <DATA>98531</DATA>
      </COL>
    </ROW>
    <ROW MODID="0" RECORDID="22357">
      <COL>
        <DATA>abc0198</DATA>
      </COL>
      <COL>
        <DATA>abc0198_cpa_v090_ww_v002</DATA>
      </COL>
      <COL>
        <DATA>1016</DATA>
      </COL>
      <COL>
        <DATA>1052</DATA>
      </COL>
      <COL>
        <DATA>98569</DATA>
      </COL>
      <COL>
        <DATA>98605</DATA>
      </COL>
    </ROW>
    <ROW MODID="0" RECORDID="22359">
      <COL>
        <DATA>abc0198</DATA>
      </COL>
      <COL>
        <DATA>abc0198_cpa_v090_ww_v002</DATA>
      </COL>
      <COL>
        <DATA>1016</DATA>
      </COL>
      <COL>
        <DATA>1057</DATA>
      </COL>
      <COL>
        <DATA>98630</DATA>
      </COL>
      <COL>
        <DATA>98671</DATA>
      </COL>
    </ROW>
    <ROW MODID="0" RECORDID="22608">
      <COL>
        <DATA>xyz0570</DATA>
      </COL>
      <COL>
        <DATA>xyz0570_cpa_v0008</DATA>
      </COL>
      <COL>
        <DATA>0</DATA>
      </COL>
      <COL>
        <DATA>26</DATA>
      </COL>
      <COL>
        <DATA>111424</DATA>
      </COL>
      <COL>
        <DATA>111450</DATA>
      </COL>
    </ROW>
  </RESULTSET>
</FMPXMLRESULT>

This is the XLST I Made:

<?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">
    <xsl:for-each select="RESULTSET/ROW">
      <clipitem>
        <name>
          <xsl:value-of select="COL[2]/DATA" />
        </name>
        <in>
          <xsl:value-of select="COL[3]/DATA" />
        </in>
        <out>
          <xsl:value-of select="COL[4]/DATA" />
        </out>
        <start>
          <xsl:value-of select="COL[5]/DATA" />
        </start>
        <end>
          <xsl:value-of select="COL[6]/DATA" />
        </end>
        <file>
          <name>
            <xsl:value-of select="COL[2]/DATA" />
          </name>
          <pathurl>"filepath"</pathurl>
          <timecode>
            <rate>
              <timebase>24</timebase>
            </rate>
            <string>00:00:00:00</string>
            <frame>0</frame>
            <displayformat>NDF</displayformat>
            <source>source</source>
            <reel>
              <name>
                <xsl:value-of select="COL[1]/DATA" />
              </name>
            </reel>
          </timecode>
        </file>
      </clipitem>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

This is my result:

<?xml version="1.0" encoding="UTF-8"?>0abc0198abc0198_cpa_v090_ww_v002101610769847198531abc0198abc0198_cpa_v090_ww_v002101610529856998605abc0198abc0198_cpa_v090_ww_v002101610579863098671xyz0570xyz0570_cpa_v0008026111424111450

This is what the result should look like:

      <clipitem>
        <name>
          abc0198_cpa_v090_ww_v002
        </name>
        <in>
          1016
        </in>
        <out>
          1076
        </out>
        <start>
          98471
        </start>
        <end>
          98531
        </end>
        <file>
          <name>
            abc0198_cpa_v090_ww_v002
          </name>
          <pathurl>"filepath"</pathurl>
          <timecode>
            <rate>
              <timebase>24</timebase>
            </rate>
            <string>00:00:00:00</string>
            <frame>0</frame>
            <displayformat>NDF</displayformat>
            <source>source</source>
            <reel>
              <name>
                abc0198
              </name>
            </reel>
          </timecode>
        </file>
      </clipitem>
      <clipitem>
        <name>
          abc0198_cpa_v090_ww_v002
        </name>
        <in>
          1016
        </in>
        <out>
          1052
        </out>
        <start>
          98569
        </start>
        <end>
          98605
        </end>
        <file>
          <name>
            abc0198_cpa_v090_ww_v002
          </name>
          <pathurl>"filepath"</pathurl>
          <timecode>
            <rate>
              <timebase>24</timebase>
            </rate>
            <string>00:00:00:00</string>
            <frame>0</frame>
            <displayformat>NDF</displayformat>
            <source>source</source>
            <reel>
              <name>
                abc0198
              </name>
            </reel>
          </timecode>
        </file>
      </clipitem>
      <clipitem>
        <name>
          abc0198_cpa_v090_ww_v002
        </name>
        <in>
          1016
        </in>
        <out>
          1057
        </out>
        <start>
          98630
        </start>
        <end>
          98671
        </end>
        <file>
          <name>
            abc0198_cpa_v090_ww_v002
          </name>
          <pathurl>"filepath"</pathurl>
          <timecode>
            <rate>
              <timebase>24</timebase>
            </rate>
            <string>00:00:00:00</string>
            <frame>0</frame>
            <displayformat>NDF</displayformat>
            <source>source</source>
            <reel>
              <name>
                abc0198
              </name>
            </reel>
          </timecode>
        </file>
      </clipitem>
      <clipitem>
        <name>
          xyz0570_cpa_v0008
        </name>
        <in>
          1016
        </in>
        <out>
          1057
        </out>
        <start>
          98630
        </start>
        <end>
          98671
        </end>
        <file>
          <name>
            xyz0570_cpa_v0008
          </name>
          <pathurl>"filepath"</pathurl>
          <timecode>
            <rate>
              <timebase>24</timebase>
            </rate>
            <string>00:00:00:00</string>
            <frame>0</frame>
            <displayformat>NDF</displayformat>
            <source>source</source>
            <reel>
              <name>
                xyz0570
              </name>
            </reel>
          </timecode>
        </file>
      </clipitem>

 

Edited by justakid
Link to comment
Share on other sites

The problem is that you are ignoring the namespace in which Filemaker places the exported elements - see:
http://fmforums.com/topic/98384-issue-with-creating-a-xsl-for-xml-having-namespace/?do=findComment&comment=447288

Note also that the output you are trying to produce is not a well-formed XML document (read: not an XML document at all), since it has no single root element. XSLT will allow it - but I doubt you will be able to do anything useful with it.

 

Link to comment
Share on other sites

This topic is 3007 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.