Jump to content
Sign in to follow this  
sherzaad

saving file with a timestamp

Recommended Posts

Hi,

I'm absolutely new and novice to the concept of XML/xls but I have the following task that I would like to do.

I am using PicoScope which allows you to save macros as xml.

So far I am able to save the file on trigger to a specific location with a pre-defined name with this code:

<?xml version="1.0" encoding="utf-8" standalone="yes"?><document>
    <userealtime>False</userealtime>
    <event category="Interaction" time="05/06/17 15:39:59.162"> Run.Pressed=False</event>
    <event category="Interaction" time="05/06/17 15:40:00.060"> File.SaveAs.IO=C:\My Documents\Waveforms\temp_name.psdata</event>
</document>

What I would like now to do is along with the pre-defined name to add a timestamp to the filename.

I have found this online that would give me the current date/time but I have no idea how to integrate it into the above script:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="date">
    <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>
        </Contacts>
    </xsl:template>
</xsl:stylesheet>

Any insight on how to do this would be much appreciated.

Sherzaad

Share this post


Link to post
Share on other sites

You need to check the documentation of the program that you're using to see if it supports things like that, you can't necessarily just apply any XSL stylesheet to that and expect the program to know how to use it.  The program has to explicitly support what you're trying to do.

Share this post


Link to post
Share on other sites

You would have to use an XSL stylesheet like you showed, but in order for that to work the program has to support it.  If they support XSL then the documentation should mention that somewhere.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...