Changeset 4860
- Timestamp:
- 2003-07-02T16:41:24+12:00 (21 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r4691 r4860 118 118 String action = request.getAttribute("action"); 119 119 String subaction = request.getAttribute("subaction"); 120 String xslt_file = getXSLTFileName(action, subaction); 120 121 Element cgi_param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 122 String collection = ""; 123 if (cgi_param_list != null) { 124 HashMap params = GSXML.extractParams(cgi_param_list, false); 125 collection = (String)params.get(GSCGI.COLLECTION_ARG); 126 if (collection == null) collection = ""; 127 } 128 129 String xslt_file = getXSLTFileName(action, subaction, collection); 121 130 if (xslt_file==null) { 122 131 // cant transform the page - return null or the original? … … 133 142 134 143 // need to transform the format info 135 String stylesheet_file = GSFile.stylesheetFile((String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), (String)this.config_params.get(GSConstants.INTERFACE_NAME), "config_format.xsl");144 String stylesheet_file = GSFile.stylesheetFile((String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), (String)this.config_params.get(GSConstants.INTERFACE_NAME), "", "config_format.xsl"); 136 145 Document stylesheet = this.converter.getDOM(new File(stylesheet_file)); 137 146 Document format_doc = this.converter.newDOM(); … … 145 154 146 155 // there is a thing called a URIResolver which you can set for a transformer or transformer factory. may be able to use this instead of this absoluteIncludepaths hack 147 GSXSLT.absoluteIncludePaths(style_doc, (String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), (String)this.config_params.get(GSConstants.INTERFACE_NAME) );156 GSXSLT.absoluteIncludePaths(style_doc, (String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), (String)this.config_params.get(GSConstants.INTERFACE_NAME), collection); 148 157 // put the page into a document - this is necessary for xslt to get the paths right if you have paths relative to the document root eg /page. 149 158 Document doc = this.converter.newDOM(); … … 152 161 } 153 162 154 protected String getXSLTFileName(String action, String subaction) { 163 protected String getXSLTFileName(String action, String subaction, 164 String collection) { 155 165 156 166 String name = null; … … 164 174 } 165 175 // now find the absolute path 166 String stylesheet = GSFile.stylesheetFile((String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), (String)this.config_params.get(GSConstants.INTERFACE_NAME), name);176 String stylesheet = GSFile.stylesheetFile((String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), (String)this.config_params.get(GSConstants.INTERFACE_NAME), collection, name); 167 177 if (stylesheet==null) { 168 178 System.out.println("cant find stylesheet for "+name); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSFile.java
r4700 r4860 148 148 } 149 149 150 150 151 151 /** returns the absolute path to a stylesheet 152 152 * stylesheets are looked for in the following order 153 * collect-specific, 153 154 * site-specific, interface-specific, default 154 155 * returns null if the file cannot be found … … 158 159 String site_name, 159 160 String interface_name, 161 String collection, 160 162 String filename) { 161 // try site one first 163 162 164 String site_home = siteHome(gsdl3_home, site_name); 163 File stylesheet = new File(site_home +File.separatorChar+ 165 // try collection first 166 File stylesheet = null; 167 if (!collection.equals("")) { 168 169 String coll_home = collectionBaseDir(site_home, collection); 170 stylesheet = new File(coll_home +File.separatorChar+ 171 "transform"+File.separatorChar+filename); 172 if (stylesheet.exists()) { 173 return stylesheet.getPath(); 174 } 175 } 176 // try site one next 177 178 stylesheet = new File(site_home +File.separatorChar+ 164 179 "transform"+File.separatorChar+filename); 165 180 if (stylesheet.exists()) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/GSXSLT.java
r4704 r4860 42 42 String gsdl3_home, 43 43 String site_name, 44 String interface_name) { 44 String interface_name, 45 String collection) { 45 46 46 47 … … 50 51 String name = child.getNodeName(); 51 52 if (name.equals("xsl:import") || name.equals("xsl:include")) { 52 ((Element)child).setAttribute("href", GSFile.stylesheetFile(gsdl3_home, site_name, interface_name, ((Element)child).getAttribute("href")));53 ((Element)child).setAttribute("href", GSFile.stylesheetFile(gsdl3_home, site_name, interface_name, collection, ((Element)child).getAttribute("href"))); 53 54 } 54 55 child = child.getNextSibling();
Note:
See TracChangeset
for help on using the changeset viewer.