Changeset 25644 for main/trunk
- Timestamp:
- 2012-05-23T16:40:22+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r25635 r25644 61 61 protected TransformerFactory transformerFactory = null; 62 62 protected DOMParser parser = null; 63 64 boolean _debug = false; 63 65 64 66 public TransformingReceptionist() … … 436 438 Text intnametext = theXML.createTextNode((String) config_params.get(GSConstants.INTERFACE_NAME)); 437 439 intname.appendChild(intnametext); 438 440 439 441 Element siteName = theXML.createElement("param"); 440 442 siteName.setAttribute("name", "site_name"); … … 501 503 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"); 502 504 Document configStylesheet_doc = this.converter.getDOM(new File(configStylesheet_file)); 505 506 if (_debug) 507 { 508 GSXSLT.modifyConfigFormatForDebug(configStylesheet_doc, GSFile.collectionConfigFile(GSFile.collectDir(GSFile.siteHome(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.SITE_NAME)) + File.separator + collection))); 509 } 503 510 504 511 if (configStylesheet_doc != null) … … 527 534 528 535 // add extracted GSF statements in to the main stylesheet 529 GSXSLT.mergeStylesheets(style_doc, new_format); 536 if (_debug) 537 { 538 GSXSLT.mergeStylesheetsDebug(style_doc, new_format, true, true, "OTHER1", GSFile.collectionConfigFile(GSFile.collectDir(GSFile.siteHome(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.SITE_NAME)) + File.separator + collection))); 539 } 540 else 541 { 542 GSXSLT.mergeStylesheets(style_doc, new_format, true); 543 } 530 544 //System.out.println("added extracted GSF statements into the main stylesheet") ; 531 545 … … 536 550 { 537 551 logger.error(" couldn't parse the config_format stylesheet, adding the format info as is"); 538 GSXSLT.mergeStylesheets(style_doc, format_elem );552 GSXSLT.mergeStylesheets(style_doc, format_elem, true); 539 553 //GSXSLT.mergeStylesheets(oldStyle_doc, format_elem); 540 554 } … … 594 608 Document skinAndLibraryXsl = null; 595 609 Document skinAndLibraryDoc = converter.newDOM(); 596 610 597 611 // Applying the preprocessing XSLT - in its own block {} to allow use of non-unique variable names 598 612 { … … 626 640 //System.out.println("GS-Lib statements are now expanded") ; 627 641 } 628 629 642 630 643 //The following code is to be uncommented if we need to append the extracted GSF statements … … 763 776 try 764 777 { 765 Document inlineTemplateDoc = this.converter.getDOM("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:java=\"http://xml.apache.org/xslt/java\" xmlns:util=\"xalan://org.greenstone.gsdl3.util.XSLTUtil\" xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">" + inlineTemplate + "</xsl:stylesheet>"); 766 GSXSLT.mergeStylesheets(skinAndLibraryDoc, inlineTemplateDoc.getDocumentElement()); 778 Document inlineTemplateDoc = this.converter.getDOM("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:java=\"http://xml.apache.org/xslt/java\" xmlns:util=\"xalan://org.greenstone.gsdl3.util.XSLTUtil\" xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">" + inlineTemplate + "</xsl:stylesheet>", "UTF-8"); 779 780 if (_debug) 781 { 782 GSXSLT.mergeStylesheetsDebug(skinAndLibraryDoc, inlineTemplateDoc.getDocumentElement(), true, true, "OTHER2", "INLINE"); 783 } 784 else 785 { 786 GSXSLT.mergeStylesheets(skinAndLibraryDoc, inlineTemplateDoc.getDocumentElement(), true); 787 } 767 788 } 768 789 catch (Exception ex) … … 780 801 { 781 802 return doc; 803 } 804 805 if(_debug) 806 { 807 GSXML.addDebugSpanTags(skinAndLibraryDoc); 782 808 } 783 809 … … 834 860 if (configStylesheet_doc != null) 835 861 { 836 Document format_doc = this.converter.newDOM();862 Document format_doc = XMLConverter.newDOM(); 837 863 format_doc.appendChild(format_doc.importNode(skinAndLibraryDoc.getDocumentElement().cloneNode(true), true)); 838 864 Node result = this.transformer.transform(configStylesheet_doc, format_doc, config_params); 839 GSXSLT.mergeStylesheets(skinAndLibraryDoc, ((Document) result).getDocumentElement()); 865 866 if (_debug) 867 { 868 GSXSLT.mergeStylesheetsDebug(skinAndLibraryDoc, ((Document) result).getDocumentElement(), true, true, "OTHER3", GSFile.collectionConfigFile(GSFile.collectDir(GSFile.siteHome(GlobalProperties.getGSDL3Home(), (String) this.config_params.get(GSConstants.SITE_NAME)) + File.separator + collection))); 869 } 870 else 871 { 872 GSXSLT.mergeStylesheets(skinAndLibraryDoc, ((Document) result).getDocumentElement(), true); 873 } 840 874 } 841 875 } … … 915 949 } 916 950 917 GSXSLT.mergeStylesheets(finalDoc, currentDoc.getDocumentElement()); 951 if (_debug) 952 { 953 GSXSLT.mergeStylesheetsDebug(finalDoc, currentDoc.getDocumentElement(), true, true, stylesheets.get(stylesheets.size() - 1).getAbsolutePath(), stylesheets.get(i).getAbsolutePath()); 954 } 955 else 956 { 957 GSXSLT.mergeStylesheets(finalDoc, currentDoc.getDocumentElement(), true); 958 } 959 } 960 961 if (_debug) 962 { 963 GSXSLT.inlineImportAndIncludeFiles(finalDoc, null, 0); 918 964 } 919 965
Note:
See TracChangeset
for help on using the changeset viewer.