Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

FMP exported w/ XSLT to XML

Featured Replies

  • Newbies

All the examples I'm finding online and in my books seem to assume that I want to take xml, process it with an xslt, and create html output. (Even this XML forum is under the 'Publising FM Online' heading). Of course, xml isn't just for creating html output. What I'm having trouble with (beyond some really basic stuff) is taking xml, processing it with an xslt, and creating a new form of xml as my output.

To be more specific, I need to export output from FM (using FMPDSORESULT style), and use an xslt to turn it into an xml file that can be read by another program.

Can anyone point me in the right direction? Thanks!

Well, instead of HTML tags ... you use XML tags.

Instead of <xsl:output method="html" encoding="UTF-8"/> as a top-level element in your XSLT, you use <xsl:output method="xml" encoding="UTF-8"/>

Have a look at http://www.filemaker.com/products/technologies/xslt_library.html , you will find also examples for XML exporting. And have a look at the excellent book of Beverly Voth, FileMaker Pro 6 : Developer's Guide to XML/XSL, Wordware Publishing.

It is true that there is a difference between using XSL for strictly conversion, from (or to) FileMaker to (or from) another format or arrangement, and using it online. But there is also quite a bit of overlap in the techniques. I imagine xml/xsl is in the "Online" forum because that is the mainstream use. Most of us read "All Posts," so it doesn't matter much where it is.

There are a few posts here on using XSL for conversion. It's been a little while however. Since each is unique, you might want to post a sample of what the final result should look like (just a couple "records" worth, and only a few fields). And perhaps a small plain xml export from your FileMaker file. (I mostly use the fmpxmlresult format myself however. You might want to upload a small sample of your FileMaker file, zipped.)

Beverly Voth has written a book with an emphasis on just how to do this, both dso and xml.

http://www.amazon.com/exec/obidos/tg/detail/-/155622043X/102-5818944-6732958?v=glance

Is is also possible that you might want to import from the external files sometime? If so you'd want to use fmpxmlresult, which seems a little more abstract at first, but is much the same to work with.

Exporting with an xml result is different from an html result, but there are many things the same.

  • Author
  • Newbies

Thank you for the good replies. I just placed an order for the book. Is there a way to write an XSLT sheet that calls to a specific field in FMP? The examples I've seen seem to loop through every field. Also, an example of fields ending up in a element and an attribute would be helpful. Thanks again.

If it is possible one would want to write the xsl to loop through every field being exported, using a general test. This is seldom easy (or reasonable) when trying to match someone else's xml however. You limit which fields are exported from FileMaker, so you should not have to pick and choose in the xsl (in this case). It is more tedious to target each field specifically. But that is often what you have to do. Because of things like you say, the result has attributes which get the field contents sometimes.

Once you've got an xml element you can add an attribute with the attribute element (duh :-). You must add the attribute before you add the element's contents.

<their element name>

Hi, Matthew! You can download ALL the examples from the book: "http://www.moonbow.com/xml/". As Martin and Fenton have said, you can _output_ as HTML, XML or TEXT.

If you use the FMPDSORESULT, you can reference the fields by name:

'<xsl:value-of select="fm:FirstName" />

If you use the FMPXMLRESULT, you can reference the fields by the column order of the export:

'<xsl:value-of select="fm:COL[3]"/fm:DATA" />

Many of us use the FMPXMLRESULT a bit more, because it's the only grammar that can be used for _import_ into FileMaker Pro.

One of my examples show how to take the FMPDSORESULT and convert it into FMPXMLRESULT. Maybe the examples will help!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.