All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nwalsh.xalan.Website Maven / Gradle / Ivy

Go to download

These are Java extensions for use with the DocBook XML stylesheets and the Xalan-Java XSLT engine.

The newest version!
// Website.java - Xalan extensions supporting Website2

package com.nwalsh.xalan;

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

import org.apache.xalan.extensions.ExpressionContext;

public class Website {
  public Website() {
  }

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

  public static Boolean needsUpdate(ExpressionContext context,
				    String srcFilename,
				    String targetFilename) {
    File srcFile;
    File targetFile;

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

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy