/**
* The default diagnostic writer...
*/
java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true);
java.io.PrintWriter dumpWriter = diagnosticsWriter;
XSLTErrorResources resbundle =
(XSLTErrorResources) (XSLMessages.loadResourceBundle(
org.apache.xml.utils.res.XResourceBundle.ERROR_RESOURCES));
String flavor = "s2s";
// loadPropertyFileToSystem(XSLT_PROPERTIES);
if (argv.length < 1)
{
printArgOptions(resbundle);
}
else
{
TransformerFactory tfactory;
try
{
tfactory = TransformerFactory.newInstance();
}
catch (TransformerFactoryConfigurationError pfe)
{
pfe.printStackTrace(dumpWriter);
diagnosticsWriter.println(
XSLMessages.createMessage(
XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); //"XSL Process was not successful.");
tfactory = null; // shut up compiler
System.exit(-1);
}
boolean formatOutput = false;
String inFileName = null;
String outFileName = null;
String dumpFileName = null;
String xslFileName = null;
String treedumpFileName = null;
PrintTraceListener tracer = null;
String outputType = null;
String media = null;
Vector params = new Vector();
boolean quietConflictWarnings = false;
URIResolver uriResolver = null;
EntityResolver entityResolver = null;
ContentHandler contentHandler = null;
for (int i = 0; i < argv.length; i++)
{
if ("-TT".equalsIgnoreCase(argv[i]))
{
if (null == tracer)
tracer = new PrintTraceListener(diagnosticsWriter);
tracer.m_traceTemplates = true;
// tfactory.setTraceTemplates(true);
}
else if ("-TG".equalsIgnoreCase(argv[i]))
{
if (null == tracer)
tracer = new PrintTraceListener(diagnosticsWriter);
tracer.m_traceGeneration = true;
// tfactory.setTraceSelect(true);
}
else if ("-TS".equalsIgnoreCase(argv[i]))
{
if (null == tracer)
tracer = new PrintTraceListener(diagnosticsWriter);
tracer.m_traceSelection = true;
// tfactory.setTraceTemplates(true);
}
else if ("-TTC".equalsIgnoreCase(argv[i]))
{
if (null == tracer)
tracer = new PrintTraceListener(diagnosticsWriter);
tracer.m_traceElements = true;
// tfactory.setTraceTemplateChildren(true);
}
else if ("-INDENT".equalsIgnoreCase(argv[i]))
{
int indentAmount;
if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-'))
{
indentAmount = Integer.parseInt(argv[++i]);
}
else
{
indentAmount = 0;
}
// TBD:
// xmlProcessorLiaison.setIndent(indentAmount);
}
else if ("-IN".equalsIgnoreCase(argv[i]))
{
if (i + 1 < argv.length)
inFileName = argv[++i];
else
System.err.println(
XSLMessages.createMessage(
XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
new Object[]{ "-IN" })); //"Missing argument for);
}
else if ("-MEDIA".equalsIgnoreCase(argv[i]))
{
if (i + 1 < argv.length)
media = argv[++i];
else
System.err.println(
XSLMessages.createMessage(
XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
new Object[]{ "-MEDIA" })); //"Missing argument for);
}
else if ("-OUT".equalsIgnoreCase(argv[i]))
{
if (i + 1 < argv.length)
outFileName = argv[++i];
else
System.err.println(
XSLMessages.createMessage(
XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
new Object[]{ "-OUT" })); //"Missing argument for);
}
else if ("-XSL".equalsIgnoreCase(argv[i]))
{
if (i + 1 < argv.length)
xslFileName = argv[++i];
else
System.err.println(
XSLMessages.createMessage(
XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
new Object[]{ "-XSL" })); //"Missing argument for);
}
else if ("-FLAVOR".equalsIgnoreCase(argv[i]))
{
if (i + 1 < argv.length)
{
flavor = argv[++i];
}
else
System.err.println(
XSLMessages.createMessage(
XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
new Object[]{ "-FLAVOR" })); //"Missing argument for);
}
else if ("-PARAM".equalsIgnoreCase(argv[i]))
{
if (i + 2 < argv.length)
{
String name = argv[++i];
params.addElement(name);
String expression = argv[++i];
params.addElement(expression);
}
else
System.err.println(
XSLMessages.createMessage(
XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
new Object[]{ "-PARAM" })); //"Missing argument for);
}
else if ("-treedump".equalsIgnoreCase(argv[i])) // sc 28-Feb-01 appears to be unused; can we remove?
{
if (i + 1 < argv.length)
treedumpFileName = argv[++i];
else
System.err.println(
XSLMessages.createMessage(
XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
new Object[]{ "-treedump" })); //"Missing argument for);
}
else if ("-F".equalsIgnoreCase(argv[i])) // sc 28-Feb-01 appears to be unused; can we remove?
{
formatOutput = true;
}
else if ("-E".equalsIgnoreCase(argv[i]))
{
// TBD:
// xmlProcessorLiaison.setShouldExpandEntityRefs(false);
}
else if ("-V".equalsIgnoreCase(argv[i]))
{
diagnosticsWriter.println(resbundle.getString("version") //">>>>>>> Xalan Version "
+ XSLProcessorVersion.S_VERSION + ", " +
/* xmlProcessorLiaison.getParserDescription()+ */
resbundle.getString("version2")); // "<<<<<<<");
}
else if ("-QC".equalsIgnoreCase(argv[i]))
{
quietConflictWarnings = true;
}