NICE! thanks, Jens!! I like that there is a choice of ";" or "," as field separator. I bet you could add a choice of to quote or not, too.
position() < last()
I think I would use:
position() != last()
The option to use quotes or not is actually in there already:
<!-- if next line is active, strings will be wrapped in `"' -->
<!-- if next line is active, strings will not be wrapped at all -->
<!-- xsl:template name="wrap-strings"><xsl:text></xsl:text></xsl:template -->
Thanks, David! I missed that.
Thank you for this file. You have helped expand my understanding of XSLT greatly.
How do you actually use this file?
copy the XSLT and save to wherever you can find it. make sure the extension is .xsl (not .xsl or .xml)
when Export (as XML) from your database table/layout. when the dialog appears select FMPXMLRESULT and specify the XSLT (that you saved).
Thanks Beverly for that. Extension is .xslt. You might name it 'export.xslt'.
If file 'export.xslt' is in the same folder as your database, the path is 'file:export.xslt'.
I recommend using .xsl for the extension so that it's more apt to be read correctly by other apps.
And if the FM Export is scripted, the path can be any valid path for the platform.
I called it
Thank you again for your great contributions to the FM-XML community!
Sent from miPhone
A question for my future knowledge.
Is it, (for distribution purposes), possible to store the XSLT-code inside your FileMaker solution, (preferably in a text field), and export it prior to the XML-export?
I only need a yes or no answer and some indication on difficulty level for now, so that I know in advance, if it should come up in the future.
With best regards Magnus Fransson.
Magnus, the export-field-contents (script step) is apt to munge the text if stored in a global TEXT field. If you followed my example XSLT, I recommend that you store the XSLT file in a CONTAINER field, then export when needed with Export Field Contents.
no: as text in a text field
yes: as a document in a container field
This is a very nice way to output headers with CSV data.
thanks for posting your work,
Maybe one could add an xslt to export the xslt as UTF-8?
I would perhaps myself also amend user4078's (Jens') xslt to use variables and and xsl-ifs or something to set each variable options at the top of the document, just for readability and easier modification. I don't know xml as well as you do, but hopefully that could be doable?
If you put your xslt in text field, use UTF-16.
Put it in a container field and you don't need to make the XSLT as UTF-16.
Sent from miPhone