Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

I am trying to import from XML using the basic msdso_elem.xslt style sheet I came across. Things work well if all field names remain the same in the XML.

I have a script that automatically imports from the URL using that stylesheet. The problem is in mapping fields:

One record in the XML contains 20 fields, the last two, desciption1 and description2 my not be on the next record, but description3 and description4 are there instead. I have in my filemaker database, all four of these fields that need to be properly mapped to automatically.

My question is what do I need to do change in the stylesheet to propely translate all field names in the xml to to format filemaker will recognize. I do not have much experience with the Filemaker grammer.

Posted

I believe that xslt file is for the purpose of translating FileMaker DSO output into FileMaker XML grammar, so that it could be imported. It has no intelligence to deal with missing elements.

What you need is a custom-build FMXMLRESULT grammar xslt, which specifies each possible element. In other words, it creates a

for each element which COULD exist in the XML to import, whether it actually exists in the XML or not. That way it would not care if an element was missing from the XML. It picks out the data if it is there, and creates a "field" placeholder if it does not; using the element name.

There are several examples here of such specific xslt stylesheets. But each is specific to its xml. Yours would be different, but the principle is the same. It's not usually difficult, just tedious. 20 is not so bad though.

  • Newbies
Posted

Here is what I have so far. The stylesheet works, but the field names do not represent the data anymore. Any ideas?

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

0

Posted

Well, the field (element) names at the top, in the METADATA, should match the FileMaker field names. It is not imperative that they do, I don't think, but it sure makes it easier to line them up with the real FileMaker fields in the Import dialog.

The fields names at the bottom should match the elements in your XML text file. It is imperative that they match, because they are being used to "select" the data out of the XML (it does not matter if they are in a different order in the XML).

It matter a great deal that the fields in the lower section match the order of the fields in the upper section.

It is best to not post xml/xsl code directly, except for snippets, within Code tags. Because the PHP parser messes them up; look at your xsl to see. Here is the file run thru Tidy and saved.

import_order.xsl.zip

  • Newbies
Posted

Thanks a lot for the help, this was my first attempt at any XML/XSLT writing as has been a success so far due to people like you helping people like me get a grasp ofthe concepts.

With the last changes you suggested, everything is working as it should, now I can use a variation of this in about twenty more sheets.

Thanks again

This topic is 5797 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.