You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/12/09 09:27:47 UTC

svn commit: r355411 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/cli/CommandLineOptions.java status.xml

Author: jeremias
Date: Fri Dec  9 00:27:01 2005
New Revision: 355411

URL: http://svn.apache.org/viewcvs?rev=355411&view=rev
Log:
The command-line now automatically sets two parameters for any XSLT transformation: "fop-output-format" contains the MIME type of the currently selected output format, "fop-version" contains FOP's version number.
Suggested by: Roland Neilands

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java   (contents, props changed)
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java?rev=355411&r1=355410&r2=355411&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java Fri Dec  9 00:27:01 2005
@@ -28,7 +28,6 @@
 import org.apache.fop.Version;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.apps.Fop;
 import org.apache.fop.apps.MimeConstants;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.pdf.PDFEncryptionManager;
@@ -123,6 +122,8 @@
                 }
                 checkSettings();
                 createUserConfig();
+                addXSLTParameter("fop-output-format", getOutputFormat());
+                addXSLTParameter("fop-version", Version.getVersion());
             }
         } catch (FOPException e) {
             printUsage();
@@ -157,6 +158,14 @@
         return log;
     }
 
+    private void addXSLTParameter(String name, String value) {
+        if (xsltParams == null) {
+            xsltParams = new Vector();
+        }
+        xsltParams.addElement(name);
+        xsltParams.addElement(value);
+    }
+    
     /**
      * parses the commandline arguments
      * @return true if parse was successful and processing can continue, false
@@ -229,13 +238,9 @@
                 System.out.println("FOP Version " + Version.getVersion());
             } else if (args[i].equals("-param")) {
                   if (i + 2 < args.length) {
-                      if (xsltParams == null) {
-                          xsltParams = new Vector();
-                      }
                       String name = args[++i];
-                      xsltParams.addElement(name);
                       String expression = args[++i];
-                      xsltParams.addElement(expression);
+                      addXSLTParameter(name, expression);
                   } else {
                     throw new FOPException("invalid param usage: use -param <name> <value>");
                   }

Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/CommandLineOptions.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/status.xml?rev=355411&r1=355410&r2=355411&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Fri Dec  9 00:27:01 2005
@@ -27,6 +27,11 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="add">
+        The command-line now automatically sets two parameters for any XSLT transformation:
+        "fop-output-format" contains the MIME type of the currently selected output format,
+        "fop-version" contains FOP's version number.
+      </action>
       <action context="Code" dev="JM" type="fix">
         The output file is now deleted when an exception occurs when calling FOP from
         the command-line.



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org