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.

Simple XSL transform question

Featured Replies

I am new to the world of XML and XSL and am struggling with how to transform a Filemaker output which is a series of table outputs all related back to a single record of the form:

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

0

249

250

251

252

253

254

255

256

257

258

259

260

261

249

250

251

252

253

254

255

256

257

258

259

260

261

MLP

John

Bill

James

Andy

Jamie

Danny

Chris

Tom

Arianna

George

Beth

Charlie

249

249

249

249

250

251

252

252

252

253

253

253

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

M1

M2

M3

JJ1

JJ2

JJ3

B1

B2

B3

J1

J2

J3

A1

A2

A3

JJJ1

JJJ2

JJJ3

D1

D2

D3

C1

C2

C3

249

249

249

250

250

250

251

251

251

252

252

252

253

253

253

254

254

254

255

255

255

256

256

256

Into a form that will simply import one of the sets of Data into a table of the form:

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

0

249

MLP

250

John

249

251

Bill

249

252

James

249

253

Andy

249

254

Jamie

250

255

Danny

251

256

Chris

252

257

Tom

252

258

Arianna

252

259

George

253

260

Beth

253

261

Charlie

253

Ie data from a single table. Can anyone point me to an easy reference that will get me there.

Thanks, Jim

Why is this necessary? Can't you export from the Persons table in the original file?

  • Author

No, I wish to create a single export XML file that contains the data of multiple tables, that I can then re-import as needed to the relevant tables one at a time.

Jim

I see - but you are not making it easy for yourself. IMHO, it would be much simpler to deal with a flat file exported from the Comments table, or (if there may be a person without any comments) at least from the Persons table.

That is, if one excludes the most straightforward approach of exporting each table separately.

Edited by Guest

Anyway, I believe this should do what you want:


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













0



















































  • Author

Many thanks - that does help my understanding a lot.

Obviously I would like to find a way of doing this that minimises the amount of effort. If I do as you say and export to separate flat files for each table - then I end up with a series of files that the user has to ensure he keeps together. Unless there's a way of combining them into another file or package. The purpose is to be able to archive and share data between users, eg by sending files via email for import into someone elses client. There's no server available.

My challenge is that the real application has about 10 tables, some related data, some not. Each table may have 20 or so fields. So writing XML and XSL this way is likely to be error prone.

What would be the recommended approach to this?

When I said "flat file", I meant export from the most atomic table, with related parent data included (and duplicated for each child).

It seems you are now exporting from some "super-parent" table which holds no meaningful data. As a result, the real data is scattered and needs to be collected carefully - while exporting from a "real" table would enclose each record in its own element.

Unrelated data is another issue. I believe it should be possible, with some very careful scripting, to export all tables one-by-one, with the last one "collecting" all previously exported files into a single document - but I don't recall if I actually ever tried this.

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.