5 Replies Latest reply on Jun 3, 2015 11:58 PM by user19752

    Include current date with XML Export


      I'm working on an XML export from a Products table using a simple XSLT stylesheet with FileMaker Pro/Server v13.


      I've been asked to make one change to the export to include the date the file was generated in YYYY-MM-DD format. For example it currently starts like this:


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




      and they would like it to now start like this:


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

      <contacts Date="2015-06-02">



      My XSLT skills are pretty basic - can anyone show me how to include the date via XSLT? Do I need to create a field just for this purpose or can XSLT do this for me?




        • 1. Re: Include current date with XML Export

          Tested only FMPro13. FMS may have same version of Xalan...


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

          <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"



              <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>

              <xsl:template match="/">

                  <Contacts Date="{substring(date:date-time(),1,10)}">

                      <cd><xsl:value-of select="date:date-time()"/></cd>





          ASF: Extensions library


          Hmm, but this function returns UTC date time with local timezone. Is this bug??

          And, unfortunately date() is not implemented.


          Edit:string() is not need.

          • 2. Re: Include current date with XML Export

            Thanks for you reply.


            I've managed to get it working with this so far:


            <contacts Date="{substring-before(date:date-time(), 'T')}">

            • 3. Re: Include current date with XML Export

              I pretty much created field(s) for this sort of thing. XSLT 1.0 can process results of the export. Use a global field if needed, then call only one record:


              <xsl:variable name="myDate" select="ROW[1]/COL[1]/DATA"  />


              <contacts date={$myDate}>


              (or something like that, presuming the date is the first column in the export)


              remember to format the field as desired, AND use the export option of "Apply current layout’s data formatting to exported data". or use a template to extract the date bits and re-arrange in the YYYY-MM-DD format.


              • 4. Re: Include current date with XML Export

                yes, that works, too!

                • 5. Re: Include current date with XML Export

                  Or, if use field, make a (global) text field to hold whole xslt.


                  Let ( cd = Get ( CurrentDate ) ;

                  "<?xml version=\"1.0\" encoding=\"UTF-16\"?>

                  <xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">

                      <xsl:output method=\"xml\" version=\"1.0\" encoding=\"UTF-8\" indent=\"no\"/>

                      <xsl:template match=\"/\">

                          <Contacts Date=\"" &

                           Year ( cd )  & SerialIncrement ( "-00" ; Month ( cd ) ) & SerialIncrement ( "-00" ; Day ( cd ) ) &







                  Export Field content (as UTF-16 xslt to temporary folder), and use it in Export Records.


                  I embed xslt to Set Field calculation then backslash sucks, so using some place holder to replacing date string may be better.