- Timestamp:
- 2012-07-19T15:07:02+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXSLT.java
r25982 r25987 29 29 import org.w3c.dom.NodeList; 30 30 31 import org.apache.log4j.*; 32 31 33 /** various functions for manipulating Greenstone xslt */ 32 34 public class GSXSLT 33 35 { 36 37 static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.GSXSLT.class.getName()); 38 34 39 public static void mergeStylesheets(Document main_xsl, Element extra_xsl, boolean overwrite) 35 40 { … … 215 220 } 216 221 217 public static void inlineImportAndIncludeFiles(Document doc, String pathExtra)218 { 219 inlineImportAndIncludeFilesDebug(doc, pathExtra, false, null);220 } 221 222 public static void inlineImportAndIncludeFilesDebug(Document doc, String pathExtra, boolean debug, String docFileName)222 public static void inlineImportAndIncludeFiles(Document doc, String pathExtra, String interface_name) 223 { 224 inlineImportAndIncludeFilesDebug(doc, pathExtra, false, null, interface_name); 225 } 226 227 public static void inlineImportAndIncludeFilesDebug(Document doc, String pathExtra, boolean debug, String docFileName, String interface_name) 223 228 { 224 229 XMLConverter converter = new XMLConverter(); … … 233 238 Element current = (Element) ((i < importList.getLength()) ? importList.item(i) : includeList.item(i - importList.getLength())); 234 239 String href = current.getAttribute("href"); 235 String filePath = GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), "default") + File.separator + "transform" + File.separator + path.replace("/", File.separator) + href.replace("/", File.separator); 240 String filePath = GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), interface_name) + File.separator + "transform" + File.separator + path.replace("/", File.separator) + href.replace("/", File.separator); 241 //String filePath = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), site_name, collection, interface_name, base_interfaces, 236 242 237 243 try … … 247 253 248 254 //Do this recursively 249 inlineImportAndIncludeFilesDebug(inlineDoc, newPath, debug, filePath );255 inlineImportAndIncludeFilesDebug(inlineDoc, newPath, debug, filePath, interface_name); 250 256 251 257 GSXSLT.mergeStylesheetsDebug(doc, inlineDoc.getDocumentElement(), false, debug, docFileName, filePath); … … 269 275 } 270 276 } 277 278 public static Document mergedXSLTDocumentCascade(String xslt_filename, String site, String collection, String this_interface, ArrayList<String> base_interfaces, boolean debug) { 279 XMLConverter converter = new XMLConverter(); 280 // find the list of stylesheets with this name 281 ArrayList<File> stylesheets = GSFile.getStylesheetFiles(GlobalProperties.getGSDL3Home(), site, collection, this_interface, base_interfaces, xslt_filename); 282 if (stylesheets.size() == 0) 283 { 284 logger.error(" Can't find stylesheet for " + xslt_filename); 285 return null; 286 } 287 logger.debug("Stylesheet: " + xslt_filename); 288 289 Document finalDoc = converter.getDOM(stylesheets.get(stylesheets.size() - 1), "UTF-8"); 290 if (finalDoc == null) 291 { 292 return null; 293 } 294 295 for (int i = stylesheets.size() - 2; i >= 0; i--) 296 { 297 Document currentDoc = converter.getDOM(stylesheets.get(i), "UTF-8"); 298 if (currentDoc == null) 299 { 300 return null; 301 } 302 303 if (debug) 304 { 305 GSXSLT.mergeStylesheetsDebug(finalDoc, currentDoc.getDocumentElement(), true, true, stylesheets.get(stylesheets.size() - 1).getAbsolutePath(), stylesheets.get(i).getAbsolutePath()); 306 } 307 else 308 { 309 GSXSLT.mergeStylesheets(finalDoc, currentDoc.getDocumentElement(), true); 310 } 311 } 312 313 return finalDoc; 314 } 315 316 271 317 272 318 public static void modifyConfigFormatForDebug(Document doc, String fileName)
Note:
See TracChangeset
for help on using the changeset viewer.