Newbies Princebaskar Posted May 29, 2011 Newbies Posted May 29, 2011 As a Newbie in Filemaker, I'm having a hard time trying to import a XML feed from a web service, transform it with a XSLT stylesheet and import it in a Filemaker DB. The import script is giving me an error: "Invalid Document Structure" Any help will be grateful! The document structure is <itemList> <Item> <product_id>Product ID</product_id> <manufacturer_part_number>Manufacturer PN<manufacturer_part_number /> <product_dateadded>M/D/YYYY</product_dateadded> <category_ids>0123</category_ids> <product_shortdesc>Product Short Desc</product_shortdesc> <product_detail>Product detail</product_detail> <product_univ>false</product_univ> <product_barcode>0123456789</product_barcode> <product_blu>false</product_blu> <product_25mm>false</product_25mm> <product_picture_0>picture.jpg</product_picture_0> <model_ids>0123</model_ids> <quantity>1</quantity> <price>2.2500</price> <product_msrp>19.9900</product_msrp> <product_manufacture>BRAND</product_manufacture> </Item> <Item> The XSLT is: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> <ERRORCODE>0</ERRORCODE> <PRODUCT BUILD="" NAME="" VERSION=""/> <DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="/itemList" TIMEFORMAT="h:mm:ss"/> <xsl:template match='/Item'> <METADATA> <FIELD EMPTYOK="No" MAXREPEAT="1" NAME="product_id" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="manufacturer_part_number" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_dateadded" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="category_ids" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_shortdesc" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_detail" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_univ" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_barcode" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_blu" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_25mm" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_picture_0" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="model_ids" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="quantity" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="price" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_msrp" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="product_manufacture" TYPE="TEXT"/> </METADATA> <RESULTSET FOUND=""> <xsl:for-each select="/Item"> <ROW MODID="0" RECORDID="0"> <COL><DATA><xsl:value-of select="./product_id"/></DATA></COL> <COL><DATA><xsl:value-of select="./manufacturer_part_number"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_dateadded"/></DATA></COL> <COL><DATA><xsl:value-of select="./category_ids"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_shortdesc"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_detail"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_univ"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_barcode"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_blu"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_25mm"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_picture_0"/></DATA></COL> <COL><DATA><xsl:value-of select="./model_ids"/></DATA></COL> <COL><DATA><xsl:value-of select="./quantity"/></DATA></COL> <COL><DATA><xsl:value-of select="./price"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_msrp"/></DATA></COL> <COL><DATA><xsl:value-of select="./product_manufacture"/></DATA></COL> </ROW> </xsl:for-each> </RESULTSET> </xsl:template> </FMPXMLRESULT> </xsl:stylesheet>
comment Posted May 29, 2011 Posted May 29, 2011 If that is the exact XML document you are trying to import, then it is indeed invalid. The <itemList> element is never closed, and a new <Item> is opened at the end. This, too is invalid: <manufacturer_part_number>Manufacturer PN<manufacturer_part_number /> It should be: <manufacturer_part_number>Manufacturer PN</manufacturer_part_number>
beverly Posted October 4, 2011 Posted October 4, 2011 You have: <xsl:template match='/Item'> AND: <xsl:for-each select="/Item"> This is causing the <METADATA> and actually *everything* to repeat for each /Item. Change the xsl:template match='/' (root of the document you are importing). And put it right after your opening xsl:stylesheet. What no xsl:output ?? And this: </xsl:template> </FMPXMLRESULT> should be: </FMPXMLRESULT> </xsl:template>
Recommended Posts
This topic is 4867 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 accountSign in
Already have an account? Sign in here.
Sign In Now