produce xml documents with python, and display it with xsl in a internet browser

wyattroerb erb_robert at yahoo.de
Tue May 2 09:18:25 EDT 2006


Hi,
like a lot of other newbies in xml i suffer from the various ways you
can take for xml data processing in python.  Here are my two major
problems:
Problem number one:
A application written in python remote controls (demands actions) a HIL
(Hardware in the loop) test stand and evaluate its actions  (system
reactions on the demand ) afterwards. The application puts all the
results in a word protocol during the test. Now i would like to do the
next step and represent the results in a proper data type document (xml
- separate style from reference data). That means for python that it
is in charge of provideing the necessary  reference data for new xml
documents and maybe more (changing xsl sheets if new test data elements
were defined)?!?. I am not quite sure if it is better to specify a kind
of source/basic xml document  with all the >elements< and >attributes<
according to the defined test results. In that case python has to
modify the xml template with the new test results and save it as a new
xml document (to keep the base template unchanged fort he next test). I
suppose python could do the job with the help of DOM/SAX. I learned
from reports in certain forums that it is also possible to use simply
print statements. Does that mean i just have to do ordinary file
handling? For example:

f.open ("xml_file.xml", w)
f.write ("<?xml version='1.0' encoding='ISO-8859-1'?>")
f.write ("<!DOCTYPE fahrplan SYSTEM ,NachweisMetaDaten.dtd'">)
f.write ("<?xml-stylesheet type='text/xsl'
href='nachweismetadaten.xsl' ?>")
f.write ("<meta_data>")
f.write ("<section>")
.
.
.
f.close()

If it works in the ordinary way what is the advantage and what is the
disadvantage? Will I run in trouble if it comes to the transformation
of  tabs, and other xml related symbols.  I guess with the file method
i can create new elements and attributes in the python process/code
without taking care of the basic xml template. Maybe it is also
important to mention that i do not have the intention to process the
test data in python after the test again. I would like to give the
end-user (function developer in our lab) the possibility to check out
the test data results with a internet browser and here is my second
problem:
To accomplish this i made a base xsl file which includes Buttons to
give the end-user the possibility to call different xml templates (sort
of clicking through the xml tree/displaying data result fragments). The
trouble is that as far as i know the button feature ,,onclick" does
not allow to call  ,,xml:temlpates" just javascript functions. Is it
just possible to use javascript functions with DOM methods if i would
like to use buttons in html to extend and reduce displaying data from a
xml document? If this is the case then the xml:template functions in
xsl are useless, isn't it. I am quite sure that is not the case!


Sorry that i have so many stupid questions but a fool with a tool is
still a fool.
Anyway!  Many, many thanks for the slightest help.

wyatt




More information about the Python-list mailing list