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

moving from FMPDSORESULT to FMPXMLRESULT


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

Recommended Posts

Posted (edited)

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
Posted

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.

Posted

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#

Posted (edited)

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
Posted

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

Posted

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">

Posted (edited)

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
Posted

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.

Posted (edited)

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
Posted

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.

Posted

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.

Posted

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.

Posted

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?

Posted

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.

Posted (edited)

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
Posted

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:

Posted

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?

Posted

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.

Posted

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!

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