March 6, 201510 yr Hi! I have this persistant problem when I try to import my XLM data into filemaker. I use various XML inportations in my filemaker database and they all import perfect with the msdso_elem.xslt file, but not this xml type! I don't know what I'm doing wrong... I made this XSLT document, but when I try to import it, the actual record fields are empty!!! This is the XML document I would like to import: <Order url="https://api.fortnox.se/3/orders/3" urlTaxReductionList="https://api.fortnox.se/3/taxreductions?filter=orders&referencenumber=3"> <AdministrationFee>0</AdministrationFee> <AdministrationFeeVAT>0</AdministrationFeeVAT> <Address1>gurratheboy</Address1> <Address2>gurratheboy</Address2> <BasisTaxReduction>0</BasisTaxReduction> <Cancelled>false</Cancelled> <City>gurratheboy</City> <Comments/> <ContributionPercent>0</ContributionPercent> <ContributionValue>0</ContributionValue> <CopyRemarks>false</CopyRemarks> <Country>France</Country> <CostCenter/> <Currency>SEK</Currency> <CurrencyRate>1</CurrencyRate> <CurrencyUnit>1</CurrencyUnit> <CustomerName>gurratheboy</CustomerName> <CustomerNumber>2</CustomerNumber> <DeliveryAddress1/> <DeliveryAddress2/> <DeliveryCity/> <DeliveryCountry/> <DeliveryDate>2015-01-17</DeliveryDate> <DeliveryName/> <DeliveryZipCode/> <DocumentNumber>3</DocumentNumber> <EmailInformation>...</EmailInformation> <ExternalInvoiceReference1/> <ExternalInvoiceReference2/> <Freight>0</Freight> <FreightVAT>0</FreightVAT> <Gross>200</Gross> <HouseWork>false</HouseWork> <InvoiceReference>3</InvoiceReference> <Language>SV</Language> <Net>200</Net> <NotCompleted>false</NotCompleted> <OfferReference>0</OfferReference> <OrderDate>2015-01-17</OrderDate> <OrderRows> <OrderRow> <AccountNumber>3016</AccountNumber> <ArticleNumber>1</ArticleNumber> <ContributionPercent>0</ContributionPercent> <ContributionValue>0</ContributionValue> <CostCenter/> <DeliveredQuantity>1.00</DeliveredQuantity> <Description>Fortnox Bokföring</Description> <Discount>0</Discount> <DiscountType>PERCENT</DiscountType> <HouseWork>false</HouseWork> <OrderedQuantity>1.00</OrderedQuantity> <Price>100</Price> <Project/> <Total>100</Total> <Unit/> <VAT>25</VAT> </OrderRow> <OrderRow> <AccountNumber>3016</AccountNumber> <ArticleNumber>1</ArticleNumber> <ContributionPercent>0</ContributionPercent> <ContributionValue>0</ContributionValue> <CostCenter/> <DeliveredQuantity>1.00</DeliveredQuantity> <Description>Fortnox Bokföring</Description> <Discount>0</Discount> <DiscountType>PERCENT</DiscountType> <HouseWork>false</HouseWork> <OrderedQuantity>1.00</OrderedQuantity> <Price>100</Price> <Project/> <Total>100</Total> <Unit/> <VAT>25</VAT> </OrderRow> </OrderRows> <OrganisationNumber>gurratheboy</OrganisationNumber> <OurReference>API User</OurReference> <Phone1>gurratheboy</Phone1> <Phone2>gurratheboy</Phone2> <PriceList>A</PriceList> <PrintTemplate>oc</PrintTemplate> <Project>0</Project> <Remarks/> <RoundOff>0</RoundOff> <Sent>false</Sent> <TaxReduction/> <TermsOfDelivery/> <TermsOfPayment/> <Total>250</Total> <TotalToPay>250</TotalToPay> <TotalVAT>50</TotalVAT> <VATIncluded>false</VATIncluded> <WayOfDelivery/> <YourReference/> <YourOrderNumber/> <ZipCode>gurrathebo</ZipCode> </Order> This Is my XSLT document: <?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"> <METADATA> <FIELD NAME="AccountNumber" TYPE="NUMBER"/> <FIELD NAME="Address1" TYPE="TEXT"/> <FIELD NAME="Address2" TYPE="TEXT"/> <FIELD NAME="AdministrationFee" TYPE="NUMBER"/> <FIELD NAME="AdministrationFeeVAT" TYPE="NUMBER"/> <FIELD NAME="BasisTaxReduction" TYPE="NUMBER"/> <FIELD NAME="Cancelled" TYPE="TEXT"/> <FIELD NAME="City" TYPE="TEXT"/> <FIELD NAME="Comments" TYPE="TEXT"/> <FIELD NAME="ContributionPercent" TYPE="NUMBER"/> <FIELD NAME="ContributionPercent1" TYPE="NUMBER"/> <FIELD NAME="ContributionValue" TYPE="NUMBER"/> <FIELD NAME="ContributionValue1" TYPE="NUMBER"/> <FIELD NAME="CopyRemarks" TYPE="TEXT"/> <FIELD NAME="CostCenter" TYPE="TEXT"/> <FIELD NAME="CostCenter1" TYPE="NUMBER"/> <FIELD NAME="Country" TYPE="NUMBER"/> <FIELD NAME="Currency" TYPE="TEXT"/> <FIELD NAME="CurrencyRate" TYPE="NUMBER"/> <FIELD NAME="CurrencyUnit" TYPE="NUMBER"/> <FIELD NAME="CustomerName" TYPE="TEXT"/> <FIELD NAME="CustomerNumber" TYPE="NUMBER"/> <FIELD NAME="DeliveredQuantity" TYPE="NUMBER"/> <FIELD NAME="DeliveryAddress1" TYPE="TEXT"/> <FIELD NAME="DeliveryAddress2" TYPE="TEXT"/> <FIELD NAME="DeliveryCity" TYPE="TEXT"/> <FIELD NAME="DeliveryCountry" TYPE="TEXT"/> <FIELD NAME="DeliveryDate" TYPE="TIME"/> <FIELD NAME="DeliveryName" TYPE="TEXT"/> <FIELD NAME="Description" TYPE="TEXT"/> <FIELD NAME="DiscountType" TYPE="TEXT"/> <FIELD NAME="DocumentNumber" TYPE="NUMBER"/> <FIELD NAME="EmailAddressBCC" TYPE="TEXT"/> <FIELD NAME="EmailAddressCC" TYPE="TEXT"/> <FIELD NAME="EmailAddressFrom" TYPE="TEXT"/> <FIELD NAME="EmailAddressTo" TYPE="TEXT"/> <FIELD NAME="EmailSubject" TYPE="TEXT"/> <FIELD NAME="ExternalInvoiceReference1" TYPE="TEXT"/> <FIELD NAME="ExternalInvoiceReference2" TYPE="TEXT"/> <FIELD NAME="Freight" TYPE="NUMBER"/> <FIELD NAME="FreightVAT" TYPE="NUMBER"/> <FIELD NAME="Gross" TYPE="NUMBER"/> <FIELD NAME="HouseWork" TYPE="TEXT"/> <FIELD NAME="HouseWork1" TYPE="TEXT"/> <FIELD NAME="InvoiceReference" TYPE="NUMBER"/> <FIELD NAME="Language" TYPE="TEXT"/> <FIELD NAME="Net" TYPE="NUMBER"/> <FIELD NAME="NotCompleted" TYPE="TEXT"/> <FIELD NAME="OfferReference" TYPE="NUMBER"/> <FIELD NAME="OrderDate" TYPE="DATE"/> <FIELD NAME="OrderedQuantity" TYPE="NUMBER"/> <FIELD NAME="OrderRow" TYPE="TEXT"/> <FIELD NAME="OrderRows" TYPE="TEXT"/> <FIELD NAME="OrganisationNumber" TYPE="NUMBER"/> <FIELD NAME="OurReference" TYPE="NUMBER"/> <FIELD NAME="Phone1" TYPE="TEXT"/> <FIELD NAME="Phone2" TYPE="TEXT"/> <FIELD NAME="Price" TYPE="NUMBER"/> <FIELD NAME="PriceList" TYPE="TEXT"/> <FIELD NAME="PrintTemplate" TYPE="TEXT"/> <FIELD NAME="Project" TYPE="NUMBER"/> <FIELD NAME="Project1" TYPE="TEXT"/> <FIELD NAME="Remarks" TYPE="TEXT"/> <FIELD NAME="RoundOff" TYPE="NUMBER"/> <FIELD NAME="Sent" TYPE="TEXT"/> <FIELD NAME="TaxReduction" TYPE="TEXT"/> <FIELD NAME="TermsOfDelivery" TYPE="TEXT"/> <FIELD NAME="TermsOfPayment" TYPE="NUMBER"/> <FIELD NAME="Total" TYPE="NUMBER"/> <FIELD NAME="Total1" TYPE="NUMBER"/> <FIELD NAME="TotalToPay" TYPE="NUMBER"/> <FIELD NAME="TotalVAT" TYPE="NUMBER"/> <FIELD NAME="Unit" TYPE="TEXT"/> <FIELD NAME="VAT" TYPE="NUMBER"/> <FIELD NAME="VATIncluded" TYPE="TEXT"/> <FIELD NAME="WayOfDelivery" TYPE="TEXT"/> <FIELD NAME="YourOrderNumber" TYPE="TEXT"/> <FIELD NAME="YourReference" TYPE="TEXT"/> <FIELD NAME="ZipCode" TYPE="TEXT"/> </METADATA> <RESULTSET> <ROW> <COL> <DATA><xsl:value-of select="Order/AdministrationFee/@value"/></DATA> </COL> <COL> <DATA><xsl:value-of select="order/AdministrationFeeVAT/@value"/></DATA> </COL> <COL> <DATA><xsl:value-of select="order/Address1/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="order/Adress2/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="order/BasisTaxReduction/@value"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> <COL> <DATA><xsl:value-of select="current/clouds/@name"/></DATA> </COL> </ROW> </RESULTSET> </FMPXMLRESULT> </xsl:template> </xsl:stylesheet> This is only one record, and my XSLT won't work! Can someone please help me and point out what I'm doing wrong? If you have a working XSLT document please share!! Thanks!
March 6, 201510 yr I don't see the opening <?xml... prolog in your sample. Let's presume it's there. What ERROR(s) are you getting or is is simply NOT importing all values? The XPATH of the xml source is *case-sensitive*, so not all your values will import if you are using: <COL> <DATA><xsl:value-of select="Order/AdministrationFee/@value"/></DATA> </COL> <COL> <DATA><xsl:value-of select="order/AdministrationFeeVAT/@value"/></DATA> </COL> See how Order is not the same as order and Order is the correct PATH to the element. beverly
March 7, 201510 yr There are numerous issues here - let me start with this one: line #1 of your source XML document contains an unescaped ampersand (between "orders" and "referencenumber") : <Order url="https://api.fortnox.se/3/orders/3" urlTaxReductionList="https://api.fortnox.se/3/taxreductions?filter=orders&referencenumber=3"> This is not allowed in XML and no XSLT processor will transform this file. There is not much point in discussing the other issues until this one is fixed. Assuming it can be fixed, my next step would be to ask: what do you actually want to import? Your source XML contains a single parent <Order>, with multiple child <OrderRow> elements (two in your example). Your XSLT stylesheet creates a <RESULTSET> with only one <ROW>. This would be fine if your intention is to import this into a table of Orders, where the import is expected to create only one record. But your stylesheet also creates fields for information that is only found inside the <OrderRow> nodes. That just makes no sense - surely you don't expect to import multiple child data into a parent table?
March 7, 201510 yr I don't see the opening <?xml... prolog in your sample. Let's presume it's there. The XML declaration is optional.
March 7, 201510 yr Author I don't see the opening <?xml... prolog in your sample. Let's presume it's there. What ERROR(s) are you getting or is is simply NOT importing all values? The XPATH of the xml source is *case-sensitive*, so not all your values will import if you are using: <COL> <DATA><xsl:value-of select="Order/AdministrationFee/@value"/></DATA> </COL> <COL> <DATA><xsl:value-of select="order/AdministrationFeeVAT/@value"/></DATA> </COL> See how Order is not the same as order and Order is the correct PATH to the element. beverly This is not allowed in XML and no XSLT processor will transform this file. There is not much point in discussing the other issues until this one is fixed. I added the <?xml... statement and Put a capital O to orders. I Also added the ;amp. but this didn't change the problems I havme when I try to iport the data. The code is accepted by filemaker it seems, and I get to the Import Field Mapping but there's no records, only Field Names..... I don't know what I'm doing wrong. Does it have something todo with Child mapping???
March 7, 201510 yr How about answering my question? what do you actually want to import? Your source XML contains a single parent <Order>, with multiple child <OrderRow> elements (two in your example). Your XSLT stylesheet creates a <RESULTSET> with only one <ROW>. This would be fine if your intention is to import this into a table of Orders, where the import is expected to create only one record. But your stylesheet also creates fields for information that is only found inside the <OrderRow> nodes. That just makes no sense - surely you don't expect to import multiple child data into a parent table?
March 8, 201510 yr Author How about answering my question? Yes, I would like to import one record with all child data
March 8, 201510 yr Yes, I would like to import one record with all child data And how exactly do you plan on doing that? This part has nothing to do with XML/XSLT. What if I gave you a Filemaker file with two tables: Orders (containing one record) and OrderLines (containing two records, both related to the one record in Orders)? How would you import all of that into one record in your file?
March 8, 201510 yr Author And how exactly do you plan on doing that? This part has nothing to do with XML/XSLT. What if I gave you a Filemaker file with two tables: Orders (containing one record) and OrderLines (containing two records, both related to the one record in Orders)? How would you import all of that into one record in your file? I would Give the two child records the same ID nummber and filter them true a Portal I think
March 8, 201510 yr I would Give the two child records the same ID nummber and filter them true a Portal I think I don't see how this answers my question. You have three (1 + 2) records in the source file and you say you want to import all of them into a single record in the target file. Where will all that data go?
August 4, 201510 yr Author Hi It's me again I found a solution to the problem and it now works perfectly. I choose to make two imports. First all records then a second import for details in each created record. This I made via a script. Here is my functional stylesheet: <?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"> <METADATA> <FIELD NAME="DocumentNumber" TYPE="NUMBER"/> <FIELD NAME="CustomerNumber" TYPE="NUMBER"/> <FIELD NAME="AccountNumber" TYPE="NUMBER"/> <FIELD NAME="ArticleNumber" TYPE="NUMBER"/> <FIELD NAME="ContributionPercent" TYPE="NUMBER"/> <FIELD NAME="ContributionValue" TYPE="NUMBER"/> <FIELD NAME="CostCenter" TYPE="NUMBER"/> <FIELD NAME="DeliveredQuantity" TYPE="NUMBER"/> <FIELD NAME="Description" TYPE="TEXT"/> <FIELD NAME="Discount" TYPE="NUMBER"/> <FIELD NAME="DiscountType" TYPE="TEXT"/> <FIELD NAME="HouseWork" TYPE="NUMBER"/> <FIELD NAME="HouseWorkHoursToReport" TYPE="NUMBER"/> <FIELD NAME="HouseWorkType" TYPE="NUMBER"/> <FIELD NAME="OrderedQuantity" TYPE="NUMBER"/> <FIELD NAME="Price" TYPE="NUMBER"/> <FIELD NAME="Project" TYPE="NUMBER"/> <FIELD NAME="Total" TYPE="NUMBER"/> <FIELD NAME="Unit" TYPE="TEXT"/> <FIELD NAME="VAT" TYPE="NUMBER"/> </METADATA> <RESULTSET> <xsl:variable name="DocumentNumber" select="Order/DocumentNumber"> </xsl:variable> <xsl:variable name="CustomerNumber" select="Order/CustomerNumber"> </xsl:variable> <xsl:for-each select="Order/OrderRows/OrderRow"> <ROW> <COL> <DATA><xsl:copy-of select="$DocumentNumber"/></DATA> </COL> <COL> <DATA><xsl:copy-of select="$CustomerNumber"/></DATA> </COL> <COL> <DATA><xsl:value-of select="AccountNumber"/></DATA> </COL> <COL> <DATA><xsl:value-of select="ArticleNumber"/></DATA> </COL> <COL> <DATA><xsl:value-of select="ContributionPercent"/></DATA> </COL> <COL> <DATA><xsl:value-of select="ContributionValue"/></DATA> </COL> <COL> <DATA><xsl:value-of select="CostCenter"/></DATA> </COL> <COL> <DATA><xsl:value-of select="DeliveredQuantity"/></DATA> </COL> <COL> <DATA><xsl:value-of select="Description"/></DATA> </COL> <COL> <DATA><xsl:value-of select="Discount"/></DATA> </COL> <COL> <DATA><xsl:value-of select="DiscountType"/></DATA> </COL> <COL> <DATA><xsl:value-of select="HouseWork"/></DATA> </COL> <COL> <DATA><xsl:value-of select="@HouseWorkHoursToReport"/></DATA> </COL> <COL> <DATA><xsl:value-of select="@HouseWorkType"/></DATA> </COL> <COL> <DATA><xsl:value-of select="OrderedQuantity"/></DATA> </COL> <COL> <DATA><xsl:value-of select="Price"/></DATA> </COL> <COL> <DATA><xsl:value-of select="Project"/></DATA> </COL> <COL> <DATA><xsl:value-of select="Total"/></DATA> </COL> <COL> <DATA><xsl:value-of select="Unit"/></DATA> </COL> <COL> <DATA><xsl:value-of select="VAT"/></DATA> </COL> </ROW> </xsl:for-each> </RESULTSET> </FMPXMLRESULT> </xsl:template> </xsl:stylesheet>
Create an account or sign in to comment