de.dfki.lt.sprout.xtdl2xml
Class toLaTeX

java.lang.Object
  extended byde.dfki.lt.sprout.xtdl2xml.toLaTeX

public class toLaTeX
extends java.lang.Object

Read XTDL (SProUT rule syntax), TFS-XML, SProUTput-XML or XTDL-XML from stdin (main()) or input String (translate()), detect input type, translate it to LaTeX code using an XSLT stylesheet (fsxml2latex.xsl). Return LaTeX code via stdout (main()) or as String (translate()).

FS2LaTeX docs, DTDs, downloads at http://www.dfki.de/~uschaefer/fs2latex/

(C) 2004 German Research Center for Artificial Intelligence (DFKI GmbH) Language Technology Lab, Stuhlsatzenhausweg 3, D-66123 Saarbruecken, Germany
Permission is granted to copy and use this stylesheet freely provided the copyright notice and this permission notice are preserved.

Author:
Ulrich.Schaefer@dfki.de

Field Summary
static java.lang.String STYLESHEET
          STYLESHEET specifies the resource location for the fsxml2latex stylesheet.
 
Constructor Summary
toLaTeX()
           
 
Method Summary
static java.util.Properties args2props(java.lang.String[] args)
          Translate command line args of the form -name=value to a Properties object.
static void main(java.lang.String[] args)
          This is the main method for command line access.
static void props2params(java.util.Properties props, javax.xml.transform.Transformer t)
          Add the parameters encoded as Properties as XSLT parameters to the Transformer.
static java.lang.String readString()
          Read input from stdin and return as String.
static java.lang.String transform(java.lang.String xml, java.util.Properties params)
          Transform XML (TFS-XML, XTDL-XML, SProUTput-XML) to LaTeX using the stylesheet specified in STYLESHEET and return the generated LaTeX code as String.
static java.lang.String translate(java.lang.String input, java.util.Properties params)
          This is the 'API' method to be used from within other Java classes.
static void usage()
          Print command line syntax to stderr.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLESHEET

public static final java.lang.String STYLESHEET
STYLESHEET specifies the resource location for the fsxml2latex stylesheet.

See Also:
Constant Field Values
Constructor Detail

toLaTeX

public toLaTeX()
Method Detail

main

public static void main(java.lang.String[] args)
This is the main method for command line access. It reads input (xtdl or XML-FS/Sproutput/XTDL-XML syntax) from stdin generates LaTeX code and writes it to stdout. If -h or --help is given as single command line argument, a usage help message is printed to stderr. Errors during transformation are also printed to stderr.

Parameters:
args - parameter of the form -name=value are passed to the fsxml2latex XSLT stylesheet

translate

public static java.lang.String translate(java.lang.String input,
                                         java.util.Properties params)
                                  throws de.dfki.lt.sprout.xtdl2xml.ParseException,
                                         de.dfki.lt.sprout.xtdl2xml.TokenMgrError,
                                         java.lang.NullPointerException,
                                         javax.xml.transform.TransformerConfigurationException,
                                         javax.xml.transform.TransformerException
This is the 'API' method to be used from within other Java classes. It gets the input (xtdl or TFS-XML/SProUTput/XTDL-XML syntax) as String arg, and parameters for the fsxml2latex XSLT stylesheet as Properties. It returns the generated LaTeX code as String.

Parameters:
input - The input String (xtdl syntax or XML)
params - Parameters for the stylesheet encoded as Properties
Returns:
Generated LaTeX code as String
Throws:
de.dfki.lt.sprout.xtdl2xml.ParseException
de.dfki.lt.sprout.xtdl2xml.TokenMgrError
java.lang.NullPointerException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException

usage

public static void usage()
Print command line syntax to stderr.


readString

public static java.lang.String readString()
                                   throws java.io.IOException
Read input from stdin and return as String.

Returns:
Input read from stdin as String
Throws:
java.io.IOException

transform

public static java.lang.String transform(java.lang.String xml,
                                         java.util.Properties params)
                                  throws java.lang.NullPointerException,
                                         javax.xml.transform.TransformerConfigurationException,
                                         javax.xml.transform.TransformerException
Transform XML (TFS-XML, XTDL-XML, SProUTput-XML) to LaTeX using the stylesheet specified in STYLESHEET and return the generated LaTeX code as String.

Parameters:
xml - XML input as String
params - Stylesheet parameters encoded as Properties
Returns:
The generated LaTeX code as String
Throws:
java.lang.NullPointerException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException

args2props

public static java.util.Properties args2props(java.lang.String[] args)
Translate command line args of the form -name=value to a Properties object. Arguments not starting with "-" or not containing "=" are ignored.

Parameters:
args - Input args
Returns:
new Properties object representing the args

props2params

public static void props2params(java.util.Properties props,
                                javax.xml.transform.Transformer t)
Add the parameters encoded as Properties as XSLT parameters to the Transformer.

Parameters:
props - Input Properties encoding the parameters
t - Transformer that gets the parameters