I will be adding a few of my common XSLT (XML Stylesheet Language Transform). Sometimes I just need a quick table for Custom Functions, ValueList, Layouts, you know ... those places we don't have a "print" button under the File > Manage > menu items
The intent is to provide some of these "lists/tables" for those who may be interested. Please post any XSLT you may use frequently! The intent is also to teach a little of how import XML with XSLT can be used. The DDR is only one example of where XML is used in FileMaker Pro!
HOW TO USE
Using FileMaker Pro (Advanced Tools), select Tools > Database Design Report. While you can choose (check) various available file(s) and different items to "Include in report", always make sure you select Report Format: XML. I don't typically check the "Automatically open report when done". Just save it, by clicking the "Create" button.
Our first DDR XML Import with XSLT: Custom Functions
- Check only the Functions under "Include in report" (DDR, XML) as noted in the HOW TO USE section, above.
- Place the file created and the following XSLT in the same directory (easily found).
- Open any database where you want to Import XML data this table. You may optionally create a new table the first time you use this method in any file/database.
- Specify the DDR XML you created as the "Specify XML Data Source" in the "Specify XML and XSL Options" File
- Specify this XSLT as the "Use XSL style sheet" File
- After you click the Continue button, you get the dialog to "map" the fields and optionally choose a new "Target" (such as new table).
- Click the Import button and you are done!
A LITTLE XML/XSLT TUTORIAL
- The FileMaker uses the FMPXMLRESULT grammar for Import Records (XML).
- Learn more about XSLT (and XML) here: W3Schools
- This XSLT starts like this
We are setting up the fields we need to "map" in the table. The RESULTSET will call another "sub-routine" to get the elements and attributes for placing into the fields. See the full XSLT as an attachment. (Enclosed "XSLT_DDR_customFunctions.xsl".)
There are some great utilities that will analyze the DDR and give you this kind of inforamtion (& more!) This is not to replace those, but as a teaching tool and for those quick one-off moments you need.