xsl-list
[Top] [All Lists]

Re: [xsl] Date and Time of a File

2011-03-17 23:48:05
Here's an example (untested),

import java.util.Date;

public class DateUtil {

   public static String getDateTimeStamp(String filePath) {
        String dataTimeString = "File not found";
        File file = new File(filePath);
        if (file.exists()) {
            dataTimeString = (new Date(file.lastModified())).toString();
        }
        return dataTimeString;
   }

}

Then invoke above API using a processor specific way. An example using
Xalan (which will work in XSLT 1.0 environment) is here,

http://xml.apache.org/xalan-j/extensions.html#ex-java-namespace

Though I don't encourage to work in XSLT 1.0 environment. Please use
XSLT 2.0 if you can.

On Thu, Mar 17, 2011 at 7:24 PM, Terry Badger 
<terry_badger(_at_)yahoo(_dot_)com> wrote:
Is there an xsl example somewhere of using a java call to return the date and 
time stamp of an xml file?




-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>