#!/usr/bin/python import os,sys,re ### customization variables ######################################### temporaryStylesheet = "/tmp/tmp.xsl" zvonGraphotronDirectory = "/LocalCVS/zvon/ZvonSW/ZvonGraphotron/XSLT" saxonCall="saxon" ######################################################################## try: xmlSource = sys.argv[1] graphotronSource = sys.argv[2] format = sys.argv[3] try: output = sys.argv[4] except IndexError: output = os.path.basename(xmlSource) output = re.compile('\.xml\Z').sub('',output) output = output+"."+format except IndexError: print print "Usage: graphotron.py xmlSource.xml graphotronSource.xml (pro|daVinci|vcg|all) [outputFile]" print "pro ... Prolog" print "daVinci ... http://www.informatik.uni-bremen.de/daVinci/" print "vcg ... http://rw4.cs.uni-sb.de/users/sander/html/gsvcg1.html" print "dot ... http://www.research.att.com/sw/tools/graphviz/" print "all ... all formats above" sys.exit() try: open = `sys.argv[3]` except IndexError: open = 1 if format == 'daVinci' or format == 'all': os.system(saxonCall+" -o "+temporaryStylesheet+" "+graphotronSource+" "+zvonGraphotronDirectory+"/graphotronDaVinci.xsl") os.system(saxonCall+" -o "+output+" "+xmlSource+" "+temporaryStylesheet) if format == 'vcg' or format == 'all': os.system(saxonCall+" -o "+temporaryStylesheet+" "+graphotronSource+" "+zvonGraphotronDirectory+"/graphotronVCG.xsl") os.system(saxonCall+" -o "+output+" "+xmlSource+" "+temporaryStylesheet) if format == 'prolog' or format == 'all': os.system(saxonCall+" -o "+temporaryStylesheet+" "+graphotronSource+" "+zvonGraphotronDirectory+"/graphotronProlog.xsl") os.system(saxonCall+" -o "+output+" "+xmlSource+" "+temporaryStylesheet) if format == 'dot' or format == 'all': os.system(saxonCall+" -o "+temporaryStylesheet+" "+graphotronSource+" "+zvonGraphotronDirectory+"/graphotronDot.xsl") os.system(saxonCall+" -o "+output+" "+xmlSource+" "+temporaryStylesheet)