#!/usr/bin/python
# This cgi script is used to display the central ceXML xml file
# containing all the builtobjects, quantifications, languages,
# etcetera. Also, some small editing possibilities are available.
import sys
import os
import cexmlhelper
import tempfile
try:
selected_language = sys.argv[1]
except:
selected_language = "en"
# Set the classpath
cexmlhelper.set_linux_classpath()
# First, propagate all characteristics of the parents over all the
# children
temporary_file = cexmlhelper.process_with_xslt("cexml.xml",
"propagate.xslt")
# Then, re-join the complete function, unit and quantification info
# with the builtobject tree
temporary_file = cexmlhelper.process_with_xslt(temporary_file,
"rejoin.xslt")
# Next, strip out the un-needed languages
temporary_file = cexmlhelper.process_with_xslt(temporary_file,
"language-.xslt",
[("selectedlanguage",
"\"'%s'\"" %
selected_language)] )
# change it to the DTD of a view
temporary_file = cexmlhelper.process_with_xslt(temporary_file,
"view.xslt")
# then, correct some errors which aren't dealt with easily in XSLT
temporary_file_2 = tempfile.mktemp()
cexmlhelper.list_of_tempfiles.append(temporary_file_2)
os.system("sed 's/()\*>/EMPTY>/g' %s > %s" % (temporary_file,
temporary_file_2) )
os.system("sed 's/|)/)/g' %s > %s" % (temporary_file_2, temporary_file) )
try:
resulting_dtd = sys.argv[2]
os.system("cp %s %s" % (temporary_file, resulting_dtd))
except:
os.system("cat %s" % temporary_file)
cexmlhelper.remove_temporary_files() |