Ignore:
Timestamp:
2012-04-19T22:09:50+12:00 (12 years ago)
Author:
ak19
Message:

Error reporting is now improved again, much better than in previous commit: no longer just writes out the XSLT stylesheet to the log file, but follows Dr Bainbridge and Sam's suggestion of performing the transformation that failed again with physical files instead of in-memory as before. This points out the exact line location of errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java

    r25423 r25445  
    593593        Document skinAndLibraryXsl = null;
    594594        Document skinAndLibraryDoc = converter.newDOM();
    595         try
     595       
     596        // Applying the preprocessing XSLT - in its own block {} to allow use of non-unique variable names
    596597        {
    597598
     
    615616            //In other words, apply the preProcess.xsl to 'skinAndLibraryXsl' in order to
    616617            //expand all GS-Lib statements into complete XSL statements and also to create
    617             //a valid  xsl style sheet document.
    618 
    619             Transformer preProcessor = transformerFactory.newTransformer(new DOMSource(preprocessingXsl));
    620             preProcessor.setErrorListener(new XMLTransformer.TransformErrorListener(preprocessingXsl));
    621             DOMResult result = new DOMResult();
    622             result.setNode(skinAndLibraryDoc);
    623             preProcessor.transform(new DOMSource(skinAndLibraryXsl), result);
    624             //System.out.println("GS-Lib statements are now expanded") ;       
    625 
    626         }
    627         catch (TransformerException e)
    628         {
    629             e.printStackTrace();
    630             System.out.println("TransformerException while preprocessing the skin xslt");
    631             return XMLTransformer.constructErrorXHTMLPage(e.getMessage());
    632         }
    633         catch (Exception e)
    634         {
    635             e.printStackTrace();
    636             System.out.println("Error while preprocessing the skin xslt");
    637             return XMLTransformer.constructErrorXHTMLPage(e.getMessage());
    638         }
     618            //a valid xsl style sheet document.
     619
     620            XMLTransformer preProcessor = new XMLTransformer();
     621            // Perform the transformation, by passing in:
     622            // preprocess-stylesheet, source-xsl (skinAndLibraryXsl), and the node that should
     623            // be in the result (skinAndLibraryDoc)
     624            preProcessor.transform_withResultNode(preprocessingXsl, skinAndLibraryXsl, skinAndLibraryDoc);
     625            //System.out.println("GS-Lib statements are now expanded") ;
     626        }
     627   
    639628
    640629        //The following code is to be uncommented if we need to append the extracted GSF statements
Note: See TracChangeset for help on using the changeset viewer.