Changeset 26243


Ignore:
Timestamp:
09/25/12 13:49:14 (8 years ago)
Author:
kjdon
Message:

added getCollectionTextWithDOM methods - looks for collname.properties in the collection's resources folder

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java

    r26104 r26243  
    3434import org.greenstone.util.GlobalProperties;
    3535import org.w3c.dom.Node;
     36import org.w3c.dom.NodeList;
    3637
    3738/**
     
    282283    }
    283284
     285  // xslt didn't like calling the function with Node varargs, so have this hack for now
     286  public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1) {
     287    return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1);
     288  }
     289   public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2) {
     290    return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2);
     291  }
     292  public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2, Node n3) {
     293    return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2, n3);
     294  }
     295  public static String getCollectionTextWithDOM(String collection, String site_name, String lang, String key, Node n1, Node n2, Node n3, Node n4) {
     296    return getCollectionTextWithDOMMulti(collection, site_name, lang, key, n1, n2, n3, n4);
     297  }
     298  public static String getCollectionTextWithDOMMulti(String collection, String site_name, String lang, String key, Node ... nodes) {
     299
     300    int num_nodes = nodes.length;
     301    String[] args = new String[num_nodes];
     302
     303    for (int i=0; i<num_nodes; i++) {
     304     
     305      String node_str = XMLConverter.getString(nodes[i]);
     306      args[i] = node_str;
     307    }
     308    CollectionClassLoader class_loader = new CollectionClassLoader(XSLTUtil.class.getClassLoader(), GSFile.siteHome(GlobalProperties.getGSDL3Home(), site_name), collection);
     309    Dictionary dict = new Dictionary(collection, lang, class_loader);
     310    String result = dict.get(key, args);
     311    if (result != null) {
     312      return result;
     313    }
     314    return "text:"+collection+":"+key;
     315   
     316  }
     317
     318
    284319    public static boolean isImage(String mimetype)
    285320    {
Note: See TracChangeset for help on using the changeset viewer.