OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: DOCBOOK-APPS: Re: Problems with Website 2.0


/ Daniel Veillard <veillard@redhat.com> was heard to say:
|   Hum, 'foo' as a file I would expect it to be a test w.r.t the curent
| directory following the POSIX semantic. 'foo' as an URI, I would expect
| it to be an URI-Reference and in that case relative to the base and
| hence in general to the containing stylesheet. I really don't see how
| those two semantic could match, so which one is it really ;-) ?

You're right. For consistency with XSLT, I suppose it should take a
second argument to compute the base URI, but you know what, I wouldn't
know how to implement needsUpdate() if we did that :-) So I guess it's
the former.

// Website.java - Saxon extensions supporting Website2

package com.nwalsh.saxon;

import java.io.File;
import java.lang.NullPointerException;

public class Website {
  public Website() {
  }

  public static boolean exists(String filename) {
    try {
      File file = new File(filename);
      return file.exists();
    } catch (NullPointerException npe) {
      return false;
    }
  }

  public static boolean needsUpdate(String srcFilename,
				    String targetFilename) {
    File srcFile;
    File targetFile;

    try {
      targetFile = new File(targetFilename);
    } catch (NullPointerException npe) {
      return false;
    }

    try {
      srcFile = new File(srcFilename);
    } catch (NullPointerException npe) {
      return false;
    }

    if (!srcFile.exists()) {
      return false;
    }

    if (!targetFile.exists()) {
      return true;
    }

    return (srcFile.lastModified() > targetFile.lastModified());
  }
}

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com>      | We measure the excellency of other
http://www.oasis-open.org/docbook/ | men, by some excellency we
Chair, DocBook Technical Committee | conceive to be in ourselves.--John
                                   | Selden


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC