3 Replies Latest reply on Oct 28, 2015 6:45 AM by SethRedlus

    XML / XSLT Import with Zero Records

    SethRedlus

      Hello All-

       

      Would really, really appreciate any insight anyone might have to what I'm assuming is bad XSLT, which is resulting in a rather large loss of hair on my end.

       

      I am attaching a sample of the XML (which I've reduced to just two elements), as well as my current XSLT.

      <Resources xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CablecastAPI.DTOs">
        <Producers>
        <Producer>
        <Active>true</Active>
        <Address i:nil="true"/>
        <Contact/>
        <Email/>
        <Id>3</Id>
        <Location>1</Location>
        <Name>Suburban Community Channels</Name>
        <Notes i:nil="true"/>
        <PhoneOne i:nil="true"/>
        <PhoneTwo i:nil="true"/>
        <Website/>
        </Producer>
        <Producer>
        <Active>true</Active>
        <Address i:nil="true"/>
        <Contact/>
        <Email/>
        <Id>5</Id>
        <Location>1</Location>
        <Name>TRMS</Name>
        <Notes i:nil="true"/>
        <PhoneOne i:nil="true"/>
        <PhoneTwo i:nil="true"/>
        <Website/>
        </Producer>
        </Producers>
      </Resources>
      

       

       

      I have to think that this is due to bad XPATH, but I have tried every variation - even excluding the xsl:for-each tags in the hopes of being able to import a single record, let alone the whole data set. I'm only trying to extract two of the elements: Id and Name.

       

      <?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:FMP="http://www.filemaker.com/fmpxmlresult">
        <METADATA>
        <FIELD EMPTYOK="NO" NAME="Id" TYPE="NUMBER" MAXREPEAT="1"/>
        <FIELD EMPTYOK="NO" NAME="ProducerName" TYPE="TEXT" MAXREPEAT="1"/>
        </METADATA>
        <RESULTSET>
      <!-- <xsl:for-each select="Resources/Producers"> -->
        <ROW>
        <COL>
        <DATA><xsl:value-of select="resources/producers/producer/id"/></DATA>
        </COL>
        <COL>
        <DATA><xsl:value-of select="resources/producers/producer/Name"/></DATA>
        </COL>
        </ROW>
      <!-- </xsl:for-each> -->
        </RESULTSET>
        </FMPXMLRESULT>
        </xsl:template>
      </xsl:stylesheet>
      

       

      Would be forever grateful for anyone that could point me in the right direction on this one. If I remove the xsl:value-of statements and just type in static text, it successfully adds to my database - so all I can think of is that I've screwed up something basic with the XPATH.

       

      Thanks again all.