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.

moving from FMPDSORESULT to FMPXMLRESULT

Featured Replies

I'm wanting to update my xsl's for a potential move to FMPXMLRESULT - as DSO is depreciated. I lament the loss of DSO - it was so easy to create an xml document where all of the field names were tags with all of the data contained within. Is there any dynamic way to say with an xsl - match the

data to the appropriate element? My starter xsl below.

FYI - I use this stylesheet to tag InDesign documents for data merging.

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

xmlns:fmp="http://www.filemaker.com/fmpdsoresult" exclude-result-prefixes="fmp">

Edited by Guest

Do you know something we don't? DSO has been deprecated since version 7.

  • Author

I do not know something you don't. I don't expect with the next future release that it will removed - as its so popular. However when my clients see "don't use - its depreciated" in their xml - they get nervous about the long term application of my xsl. Just trying to be tidy.

LOL, perhaps you could use a stylesheet on the DSO result just to remove that comment.

  • Author

you know thats a really good idea. Still I'd like to see the code to line up the metadata/field info with the col.

I suppose you could use count to search out the col#

I think it needs to be done the other way round: for each COL, find its matching field name in the METADATA.

  • Author

That does make sense...I'll see if I can piece it together.

  • Author

OK - so I think I found the xsl I want to use to figure out the FIELD to connect to COL.:)

Unfortunately my basic matching of elements is messing up. XSL below - what am I doing wrong? I've tried a lot of variations of:

"fmp:FMPXMLRESULT/fmp:METADATA/fmp:ROW/fmp:COL"

no success?!

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

">

, ">

">

]>

xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp">

here

here2

here3

Edited by Guest

I'm afraid you have lost me there. There's no such thing as "fmp:FMPXMLRESULT/fmp:METADATA/fmp:ROW/fmp: COL".

  • Author

Sorry about that - typing in an earlier version. Jumping back and forth between working with fmp Metadata and data

  • Author

OK - now just for the selection of the name of each FIELD element.The position count is working correctly - any thoughts on how to select FIELD

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

xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp">

There are several ways to this. I think this may be the simplest one:


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



xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:fmp="http://www.filemaker.com/fmpxmlresult"

exclude-result-prefixes="fmp">



















































Note that this requires the original fields to have names that can be valid element names (e.g. no spaces), or more processing is needed when naming the field element.

---

The forum's software tampers with the initial xml declaration, so you'll have to replace it with your own.

Edited by Guest

  • Author

Interesting - it seems to be dropping a few elements. I thought it could be because of a mismatch in data elements with data in them and number of field elements. Tried the code below with no luck. It skipped creating the first two Field elements but used the data anyways. I'll have to play more tomorrow.

Do you have repeating fields or related fields in your export?

  • Author

nope - I'll post something tomorrow. The info is very sensitive so I'll have to clean it up first.

  • Author

Looks like the FMPXMLRESULT export does not replace spaces in field names with underscores. So METADATA/FIELD name="my field" appears instead of METADATA/FIELD name="my_field".

The resulting xml just ignored tags with spaces in the name attribute.

PS - did you have to create a metadata variable in order for the path $metadata/fmp:FIELD[$pos]/@NAME} to work?

Also - 'translate' worked below:

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

">

, ">

">

]>

xmlns:fmp="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fmp">

Edited by Guest

FMPXMLRESULT export does not replace spaces in field names with underscores

No, it doesn't - why should it? That's one of the reasons why it's preferred over DSO. As I mentioned earlier, you could wrap another function around $metadata/fmp:FIELD[$pos]/@NAME to make sure only valid characters are passed out. Or just change your field names.

did you have to create a metadata variable in order for the path $metadata/fmp:FIELD[$pos]/@NAME} to work?

Sort of. There's an issue of context and scope here. The $pos variable wouldn't work if you left the current node to go hunting directly in the METADATA element. Placing the node-set into a top-level variable upfront makes it then available when you are deep in rows and columns.

  • Author

Indeed - should have paid attention to valid characters. Thanks for all of your help on this. Right now I'm not going to deal with other characters besides spaces - likely I'll clean it up. This client deals with films - often Foreign, special characters seem to abound. Russian xml dontchaknow.

AFAIK, element names can be in Russian, or Chinese or whatever you like. It's mostly white spaces they don't like, and there are further restrictions on the first character. In any case, I think the issue here are field NAMES - not whatever may be IN the fields themselves.

If you want to play it safe, you could let Filemaker take care of it as suggested in my second post.

  • Author

Ok - here's another one for ya. Lets say I don't transform FMPXMLRESULT to look more like DSO. how do I figure out what node I'm at if I'm doing a data comparison. For example:

Lets say I set a variable - $myData to equal the value "dog". In my FMPXMLRESULT.xml COL[1] lists a grouping of animal names:

cat

dog

mouse

COL[2] lists the food I want to give them.

tuna

bones

cheese

How do I count which DATA node to select so that I get "bones" - essentially matching the node that passes my if test?

Hard to say which might work best without knowing the context. Is this a test that runs for each record? Will the test value be "dog" every time, and for every record? And so on. Better present the real issue - it always goes amiss with abstract examples.

  • Author

Its a pretty giant xsl - lets see if this paired down info makes sense -

I'm looking for a way to select the correct where there is a match with my concatenated variables.

Edited by Guest

It's not your stylesheet that I need. I'd just like to know what are you doing with this in general - and why. Where are the variables $timeName1, $venue 1, $myDate coming from, and at what level are they defined?

It seems you are exporting from a parent record with related child data (or worse, from a repeating field?). I think you could save yourself this entire issue by exporting from the child. Then you could test at ROW level: if COL[5] = testValue, fetch data from COL[3]. Actually, you could just select rows that meet the condition to begin with and get their data directly, without looping.

In any case, you could do the same thing here as before: for each ROW, dump the entire COL[3] into a variable.

Loop through the DATA of COL[5], and when you find one that matches your testValue, save its position in another variable. Now you can fetch the corresponding value using:

  • Author

I'm essentially creating a large grid of events. And yes I am exporting parent/child records. I may re-write it to export from the child records and pull down the redundant parent info.

I was hoping to just "match" a data node and grab its number - but it sounds like looping is required?

Well, if you're worried about redundancy, you could export the parent first, then refer to it in your stylesheet. That would be going by the XSLT book.

However, I don't see much point in bothering with this, because... where exactly does this redundancy live? Filemaker passes the raw XML directly to the XSLT processor, and all you ever see is the final result. Perhaps the raw XML exists as a file in some temp directory - I've never looked for it, so I don't know. Suppose it does, and suppose it is larger than it really needs to be. So what?

I was hoping to just "match" a data node and grab its number - but it sounds like looping is required?

Not really. I think you could select the index node directly by using a predicate, then count its preceding siblings - instead of using position(), which is context-dependent.

  • Author

I went with exporting from child - worked seamlessly. Its an old multi-file system with some legacy interface issues that made parent exporting desirable - but not THAT desirable.

With regards to language within the xml tags - as I'm going to html there are a few wrinkles that make content an issue. Otherwise I'm good to go.

Thanks for all of your input!

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.