Changeset 4704


Ignore:
Timestamp:
2003-06-18T11:58:26+12:00 (21 years ago)
Author:
kjdon
Message:

no longer use ConfigVars, so pass in variables individually. also named templates now overwrite teh old ones when added format stuff to a stylesheet - you cant have two tempalates with teh same name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXSLT.java

    r4079 r4704  
    1414
    1515    /** takes a stylesheet Document, and adds in any child nodes from extra_xsl
     16     * named templates overwrite any existing one, while match templates are
     17just added to the end of teh stylesheet
    1618     */
    1719    public static void mergeStylesheets(Document main_xsl, Element extra_xsl) {
     
    1921    Element main = main_xsl.getDocumentElement();
    2022   
    21     NodeList children = extra_xsl.getChildNodes();
     23    NodeList children = extra_xsl.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "template");
    2224    for (int i=0; i<children.getLength(); i++) {
    23          main.appendChild(main_xsl.importNode(children.item(i), true));
     25        String name = ((Element)children.item(i)).getAttribute("name");
     26        if (!name.equals("")) {
     27        Element old_template = GSXML.getNamedElement(main, "xsl:template", "name", name);
     28        if (old_template != null) {
     29            main.removeChild(old_template);
     30        }
     31        }
     32       
     33        main.appendChild(main_xsl.importNode(children.item(i), true));
    2434    }
    2535
     
    3040     */
    3141    public static void absoluteIncludePaths(Document stylesheet,
    32                      ConfigVars config) {
     42                        String gsdl3_home,
     43                        String site_name,
     44                        String interface_name) {
    3345   
    3446   
     
    3850        String name = child.getNodeName();
    3951        if (name.equals("xsl:import") || name.equals("xsl:include")) {
    40         ((Element)child).setAttribute("href", GSFile.stylesheetFile(config, ((Element)child).getAttribute("href")));
     52        ((Element)child).setAttribute("href", GSFile.stylesheetFile(gsdl3_home, site_name, interface_name, ((Element)child).getAttribute("href")));
    4153        }
    4254        child = child.getNextSibling();
Note: See TracChangeset for help on using the changeset viewer.