Jump to content

Include current date with XML Export


fmdataweb

This topic is 3222 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

<contacts>

  <contact>

 and they would like it to now start like this:

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

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

  <contact>

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 without needing to reference a FileMaker field?

 

thanks,

Steve

Link to comment
Share on other sites

Filemaker's XSLT engine can do this for you without requiring a Filemaker field, with the help of an EXSLT extension function. It would be helpful to see your existing stylesheet to give more precise instructions, but it's probably only a matter of replacing:

<contacts>

with:

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

and adding the extension's namespace declaration to the stylesheet element, so that it looks like:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="fmp date">

 

Link to comment
Share on other sites

Thank you so much - that's awesome and it worked perfectly. I wasn't sure if you could generate the current date string via XSLT or whether I would need to add a field for this.

Many thanks again.

 

Filemaker's XSLT engine can do this for you without requiring a Filemaker field, with the help of an EXSLT extension function. It would be helpful to see your existing stylesheet to give more precise instructions, but it's probably only a matter of replacing:

<contacts>

with:

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

and adding the extension's namespace declaration to the stylesheet element, so that it looks like:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="fmp date">

 

Filemaker's XSLT engine can do this for you without requiring a Filemaker field, with the help of an EXSLT extension function. It would be helpful to see your existing stylesheet to give more precise instructions, but it's probably only a matter of replacing:

<contacts>

with:

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

and adding the extension's namespace declaration to the stylesheet element, so that it looks like:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="fmp date">

 

Filemaker's XSLT engine can do this for you without requiring a Filemaker field, with the help of an EXSLT extension function. It would be helpful to see your existing stylesheet to give more precise instructions, but it's probably only a matter of replacing:

<contacts>

with:

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

and adding the extension's namespace declaration to the stylesheet element, so that it looks like:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="fmp date">

 

Link to comment
Share on other sites

This topic is 3222 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.