AnsweredAssumed Answered

XSL

Question asked by BlackMicro on Nov 9, 2010
Latest reply on Nov 11, 2010 by BlackMicro

Title

XSL

Post

I'm fairly new to XML and one the tasks I've been assigned at my job is to import some XML data into our database.  I've created a XSL style sheet but when I go to import no data is imported.  The correct number of records are created in the database but they are all blank.  Any help would be appreciated.

XML:

<purchases> <purchases_meta> <total_products>3</total_products> <total_sales>899.90</total_sales> </purchases_meta> <accounts cnt='1'> <account id='15140'> <sales>899.9</sales> <users cnt='1'> <user id='14224'> <name>larry reed</name> <email>test@test.state.ia.us</email> <sales>899.9</sales> <products cnt='3'> <product id='2' name='compliance' price='399.95' /> <product id='3' name='cpt_assist' price='199.95' /> <product id='4' name='facility' price='300.00' /> </products> </user> </users> </account> </accounts></purchases>

XSL:

<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:eng="http://tempuri.org/EngravingDataSet.xsd" exclude-result-prefixes="eng"><xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>    <xsl:template match="/">        <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">            <ERRORCODE>0</ERRORCODE>            <DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT="h:mm:ss a"/>            <METADATA>           <FIELD EMPTYOK="NO" MAXREPEAT="1" NAME="AccountID" TYPE="NUMBER"/> <FIELD EMPTYOK="NO" MAXREPEAT="1" NAME="ContactID" TYPE="NUMBER"/> <FIELD EMPTYOK="NO" MAXREPEAT="1" NAME="ProductID" TYPE="NUMBER"/>           <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Name" TYPE="TEXT"/>           <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Price" TYPE="NUMBER"/>            </METADATA>            <RESULTSET FOUND="">                <xsl:for-each select="./purchases/accounts/account/users/user/products/product">                    <ROW MODID="" RECORDID="">                        <COL>                            <DATA>                                <xsl:value-of select="../../@ID"/>                            </DATA>                        </COL>                        <COL>                            <DATA>                                <xsl:value-of select="../../../../../@ID"/>                            </DATA>                        </COL>                        <COL>                            <DATA>                                <xsl:value-of select="../../../../../../../@ID"/>                            </DATA>                        </COL>                        <COL>                            <DATA>                                <xsl:value-of select="./name"/>                            </DATA>                        </COL>                        <COL>                            <DATA>                                <xsl:value-of select="./price"/>                            </DATA>                        </COL>                        </ROW>                </xsl:for-each>            </RESULTSET>        </FMPXMLRESULT>    </xsl:template></xsl:stylesheet>

Outcomes