import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.xpath.XPathAPI; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; /** used to generate .tcl files from */ public class Stylizer { // Global value so it can be ref'd by the tree-adapter static Document document; public static void main(String argv[]) { if (argv.length != 3) { System.err.println("Usage: java Stylizer stylesheet xmlfile outputdir"); System.exit(1); } DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { System.err.println("Starting conversion..."); File stylesheet = new File(argv[0]); File datafile = new File(argv[1]); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(datafile); NodeList list = XPathAPI.selectNodeList(document, "website/language/page"); for (int i=0; i