On Tue, May 20, 2003 at 01:35:08PM -0300, Alexandre Enkerli wrote:
Hello all,
Here's the basic structure of the data I want to process: <question> <text></text> <choices> <choice></choice> </choices> <answer></answer> <info> <difficulty></difficulty> <reference></reference> <text-objective></text-objective> </info> </question>
In LaTeX terminology (sorry!) what I want is to have all the question texts as items in an "enumerate" and answer choices in an alphabetical enumerate for each question. Doesn't sound too hard. In fact, I guess I could probably do a find and replace...
You should write proper callbacks for each element: \defineXMLenvironment[text] {start action} {stop action} It is easy if you want the text of the query italic with a 'Q.' before it: \defineXMLenvironment[text] {\bgroup Q. \bf} {\egroup} You can also easily start a list: \defineXMLenvironment[choices] {\startitemize} {\stopitemize} \defineXMLcommand[choice] {\item} But collecting all queries together and all answers together, or sorting the choices alphabetically, sounds pretty hard. You would have to save them all in appropriate data structures, and then print them out as desired. The context code has examples which show that this can be done in TeX macro code, but it is certainly not easy. As per Berend's suggestion, XSLT is a much better tool for this task. Then write a context mapping for the properly sorted XML file. Good luck, Simon -- Simon Pepping email: spepping@scaprea.hobby.nl