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.

XSL Embedded in Solution File

Featured Replies

Is there a way to import data from an XML file by using an XSLT sheet that is imbedded in the FileMaker solution?

The normal way to write such a script step is

-


  • (1) select an external XML file with the data;
    (2) select an external XSL file that tells FM how to interpret the XML file.

I would like to avoid using a text file separate from the solution, so that the whole solution, including the XSL, is in one file.

In the Script step "Import Records", under “Specify XML and XSL Options”, you may specify a Calculation instead of a file. I have tried to make this calculation

-


  • (1) a text field that contains the XSL text
    (2) a container field that contains the Style Sheet document.

Both methods return a runtime error. Has anyone been able to do this?

The only thing that comes close is to export the data to a local file, "say the FileMaker Pro folder" and then exports blank data to the same location at the end of the script. Allow user abort [off] is enabled of course.

In the Script step "Import Records", under “Specify XML and XSL Options”, you may specify a Calculation instead of a file

I don't see anything about a calculation in the Import XML dialog; there is only a choice of file path or http path; either of which could come from calculations; but that's very different from saying you could use a calculation of the xsl content itself.

As Stuart says, you can store the xsl stylesheet in a FileMaker text field, or better, a file in a container field,* then export it to a file at a known location, then use that path for the Import XML dialog.

A good example of this is the Process DDR file of Jonathan Starks.

http://www.jonathanstark.com/downloads.php

*You may have trouble on Windows, if you use the text-in-a-field method however, 'cause of the utf-16. I did anyway. FileMaker uses utf-16 for Export Field Contents of a text field. Easy to fix manually, by changing the encoding back to utf-8. Exporting a file would get around that problem

[His file uses AppleScript, just a little, so it's not made to work directly on Windows; but I wanted to see if it would; conclusion, yes, with the caveat above.]

Edited by Guest

  • Author

Works like a charm.

Two important rules not explained in the manual:


  • (1) When you export the contents of a container field that contains a file, you must give the newly-created file the same name as the source file in the container field.
    (2) The file created by exporting the contents of a field replaces any existing file with the same name--unceremoniously, and without warning. Not behavior I would expect, but exactly what I need!

Thank you, gentlemen.

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.