Changeset 36508


Ignore:
Timestamp:
2022-08-26T12:29:21+12:00 (6 weeks ago)
Author:
kjdon
Message:

new method getCollectionDisplayItemText - you pass in a node containing a list of displayItem elements, and it will choose the bestone that matches the current lang. displayItems can use dictionary keys instead of text

File:
1 edited

Legend:

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

    r36001 r36508  
    5050import org.greenstone.util.GlobalProperties;
    5151import org.w3c.dom.Node;
     52import org.w3c.dom.Element;
     53import org.w3c.dom.Document;
    5254
    5355/**
     
    443445  }
    444446
    445 
     447    /** handle displayItems from xslt */
     448    public static String getCollectionDisplayItemText(Node display_item_list, String lang, String site_name, String collection) {
     449   
     450    CustomClassLoader class_loader = new CustomClassLoader(XSLTUtil.class.getClassLoader(), GSFile.collectionResourceDir(GSFile.siteHome(GlobalProperties.getGSDL3Home(), site_name), collection));
     451    Document doc = XMLConverter.newDOM();
     452    Element di = DisplayItemUtil.chooseBestMatchDisplayItem(doc, (Element)display_item_list, lang, "en", class_loader) ;
     453    if (di == null) {
     454        return "";
     455    }
     456    return GSXML.getNodeText(di);
     457
     458    }
    446459 
    447460    public static boolean isImage(String mimetype)
Note: See TracChangeset for help on using the changeset viewer.