Changeset 25471


Ignore:
Timestamp:
2012-04-24T20:29:50+12:00 (12 years ago)
Author:
ak19
Message:
  1. ApplyXSLT takes an additional parameter: the Greenstone major version number, or sets this to 2 if none is provided. This is then passed onto the XSLT files. 2. generate-html.sh/bat will pass any commandline parameters on to ApplyXSLT.java. 3. Simplified the generate-html.bat file with a for loop to avoid code duplication. 4. The MajorVersion element will now be processed by processing/common.xsl: anything in a MajorVersion element whose number matches the Greenstone major version number specified to generate-html.sh/bat (or ApplyXSLT.java) will be output to html, if the MajorVersion number does not match, it won't be output.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/trunk/shared/ApplyXSLT.java

    r19339 r25471  
    4747    {
    4848    if (args.length < 3) {
    49         System.err.println("Usage: ApplyXSLT <Target_language_code> <XSLfile> <XMLfile>");
     49        System.err.println("Usage: ApplyXSLT <Target_language_code> <XSLfile> <XMLfile> [greenstone-major-version-number]");
    5050        System.exit(1);
    5151    }   
    5252
     53    String major_version = "2"; // defaults to Greenstone 2
     54
    5355    System.setProperty("javax.xml.transform.TransformerFactory",
    5456               "org.apache.xalan.processor.TransformerFactoryImpl");
    55     if (args.length == 4){
    56         System.setProperty("GSDLHOME",args[3]);
     57    if (args.length >= 4){
     58        for(int i = 3; i < args.length; i++) { // 4 to 5 args
     59        if(args[i].length() > 1) {
     60            System.setProperty("GSDLHOME",args[i]);
     61        } else { // number of chars is 1, assume it's the Greenstone version (2 or 3)
     62            major_version = args[i];
     63        }
     64        }
    5765    }
    5866
     
    6977    String stylesheet = args[1];
    7078    String xml_in = args[2];
     79    //String major_version = (args.length >= 5) ? args[4] : "2";
     80    //System.err.println("**** Greenstone version requested: " + major_version);
     81
    7182    try {
    7283        // Use the TransformerFactory to process the stylesheet Source and generate a Transformer
     
    7889
    7990        transformer.setParameter("lang", lang);
     91        transformer.setParameter("gs-major-version", major_version);
    8092        transformer.transform(input, new StreamResult(output));
    8193    }
Note: See TracChangeset for help on using the changeset viewer.