diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-12-09 08:27:01 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-12-09 08:27:01 +0000 |
commit | 5144e1c68b90caa200a4608913c3fa97d96c7a3b (patch) | |
tree | 5573f6e0ad1d375e4f94d2e4ad14832bbba1957d | |
parent | c24934a366abc7d3909ad53713d0278b158ed02c (diff) | |
download | xmlgraphics-fop-5144e1c68b90caa200a4608913c3fa97d96c7a3b.tar.gz xmlgraphics-fop-5144e1c68b90caa200a4608913c3fa97d96c7a3b.zip |
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
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@355411 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/cli/CommandLineOptions.java | 17 | ||||
-rw-r--r-- | status.xml | 5 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/java/org/apache/fop/cli/CommandLineOptions.java b/src/java/org/apache/fop/cli/CommandLineOptions.java index 5788633e3..0c8270b5f 100644 --- a/src/java/org/apache/fop/cli/CommandLineOptions.java +++ b/src/java/org/apache/fop/cli/CommandLineOptions.java @@ -28,7 +28,6 @@ import java.util.Vector; 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 @@ public class CommandLineOptions implements Constants { } checkSettings(); createUserConfig(); + addXSLTParameter("fop-output-format", getOutputFormat()); + addXSLTParameter("fop-version", Version.getVersion()); } } catch (FOPException e) { printUsage(); @@ -157,6 +158,14 @@ public class CommandLineOptions implements Constants { 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 @@ public class CommandLineOptions implements Constants { 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>"); } diff --git a/status.xml b/status.xml index 474d3ed12..10d2df528 100644 --- a/status.xml +++ b/status.xml @@ -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. |