Changeset 18473 for greenstone3/trunk/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
- Timestamp:
- 2009-02-09T13:22:19+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r18436 r18473 211 211 return page; 212 212 } 213 213 /* 214 214 // put the page into a document - this is necessary for xslt to get 215 215 // the paths right if you have paths relative to the document root … … 261 261 logger.debug(this.converter.getPrettyString(style_doc.getDocumentElement())); 262 262 } 263 */ 263 264 //for debug purposes only 264 265 Document oldStyle_doc = style_doc; … … 344 345 System.out.println("Error while preprocessing the skin xslt") ; 345 346 return XMLTransformer.constructErrorXHTMLPage(e.getMessage()) ; 347 } 348 349 // put the page into a document - this is necessary for xslt to get 350 // the paths right if you have paths relative to the document root 351 // eg /page. 352 Document doc = this.converter.newDOM(); 353 doc.appendChild(doc.importNode(page, true)); 354 Element page_response = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_RESPONSE_ELEM); 355 Element format_elem = (Element)GSXML.getChildByTagName(page_response, GSXML.FORMAT_ELEM); 356 if (output.equals("formatelem")) { 357 return format_elem; 358 } 359 if (format_elem != null) { 360 //page_response.removeChild(format_elem); 361 logger.debug("format elem="+this.converter.getPrettyString(format_elem)); 362 // need to transform the format info 363 String configStylesheet_file = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), (String)this.config_params.get(GSConstants.SITE_NAME), collection, (String)this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, "config_format.xsl"); 364 Document configStylesheet_doc = this.converter.getDOM(new File(configStylesheet_file)); 365 if (configStylesheet_doc != null) { 366 Document format_doc = this.converter.newDOM(); 367 format_doc.appendChild(format_doc.importNode(format_elem, true)); 368 Node result = this.transformer.transform(configStylesheet_doc, format_doc); 369 370 // Since we started creating documents with DocTypes, we can end up with 371 // Document objects here. But we will be working with an Element instead, 372 // so we grab the DocumentElement() of the Document object in such a case. 373 Element new_format; 374 if(result.getNodeType() == Node.DOCUMENT_NODE) { 375 new_format = ((Document)result).getDocumentElement(); 376 } else { 377 new_format = (Element)result; 378 } 379 logger.debug("new format elem="+this.converter.getPrettyString(new_format)); 380 if (output.equals("newformat")) { 381 return new_format; 382 } 383 384 // add extracted GSF statements in to the main stylesheet 385 GSXSLT.mergeStylesheets(skinAndLibraryDoc, new_format); 386 //System.out.println("added extracted GSF statements into the main stylesheet") ; 387 388 // add extracted GSF statements in to the debug test stylesheet 389 //GSXSLT.mergeStylesheets(oldStyle_doc, new_format); 390 } else { 391 logger.error(" couldn't parse the config_format stylesheet, adding the format info as is"); 392 GSXSLT.mergeStylesheets(skinAndLibraryDoc, format_elem); 393 // GSXSLT.mergeStylesheets(oldStyle_doc, format_elem); 394 } 395 logger.debug("the converted stylesheet is:"); 396 logger.debug(this.converter.getPrettyString(skinAndLibraryDoc.getDocumentElement())); 346 397 } 347 398
Note:
See TracChangeset
for help on using the changeset viewer.