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

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
Sign in to follow this  

×