Changeset 35295
- Timestamp:
- 2021-08-16T13:29:24+12:00 (3 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r33726 r35295 882 882 return XMLTransformer.constructErrorXHTMLPage("Error loading file: "+ expand_gslib_filepath+"\n" + e.getMessage()); 883 883 } 884 884 885 885 // gslib.xsl 886 886 Document gslib_xsl_doc = null; … … 914 914 } 915 915 916 // if the page xsl or gslib xsl uses namespaces that are not listed in 917 // expand_gslib, then they will be ignored. So just check through and add 918 // any in that are missing. 919 GSXML.addMissingNamespaceAttributes(expand_gslib_xsl_doc.getDocumentElement(), page_xsl.getDocumentElement()); 920 GSXML.addMissingNamespaceAttributes(expand_gslib_xsl_doc.getDocumentElement(), gslib_xsl_doc.getDocumentElement()); 916 921 917 922 Document pageAndGslibXsl = null; … … 944 949 XMLTransformer preProcessor = new XMLTransformer(); 945 950 preProcessor.transform_withResultNode(expand_gslib_xsl_doc, pageAndGslibXsl, pageAndGslibDoc); 946 947 951 } 948 952 if (output.equals("xsl6")) { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java
r33712 r35295 35 35 36 36 import org.apache.log4j.Logger; 37 import org.w3c.dom.Attr; 37 38 import org.w3c.dom.Document; 38 39 import org.w3c.dom.Element; … … 547 548 return true; 548 549 } 550 551 /** This adds any namespace attributes from donor_element into main_elem if they are not already there */ 552 public static void addMissingNamespaceAttributes(Element main_elem, Element donor_elem) { 553 // are there any new namespaces to be added? 554 NamedNodeMap attributes = donor_elem.getAttributes(); 555 for (int i=0; i<attributes.getLength(); i++) { 556 Attr att = (Attr)attributes.item(i); 557 String att_name = att.getName(); 558 if (att_name.startsWith("xmlns:")) { 559 //logger.error("found a namespace att "+att_name); 560 if (main_elem.getAttribute(att_name).equals("")) { 561 main_elem.setAttribute(att_name, att.getValue()); 562 //logger.error("setting att in main"); 563 } 564 } 565 } 566 567 568 } 549 569 public static Element createMetadataParamList(Document owner, Vector meta_values) 550 570 { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXSLT.java
r33669 r35295 62 62 63 63 Element main = main_xsl.getDocumentElement(); 64 // If extra_xsl has added namespaces, we need to make sure 65 // they are copied over into main 66 GSXML.addMissingNamespaceAttributes(main, extra_xsl); 67 64 68 Node insertion_point = null; 65 69 Element last_import = GSXML.getLastElementByTagNameNS(main, GSXML.XSL_NAMESPACE, "import");
Note:
See TracChangeset
for help on using the changeset viewer.