Hello all, I'm building an exam using "ExamView Pro" which has, surprisingly, an XML export feature. I'd like to process the exam content into ConTeXt. I've looked at the "Example" file and tried to understand how it all works, but I'm not sure I can. So far, I've been able to process entities and MathML using the mm* and ent as options for --xmlfilter (texexec --pdf --xmlfilter=mml,mmp,mmc,ent file.xml) but I can't even get <b> to work as planned with any of the xtag-* files. I'm guessing I need to use the x-contml.tex file, but I don't know why. Then, I'll probably need some guidance to have everything work. The ExamView XML format uses attributes but I'd be happy with just getting the basic format straight. What makes it somewhat harder is that I don't have so much experience with ConTeXt anyway. So, I'd appreciate any help. 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... Thanks in advance for your help.
Alexandre Enkerli
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...
If you want to sort things, it might be easier to preprocess things or generate things with an XSLT processor. -- Live long and prosper, Berend de Boer
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
Dear Alexandre, I am using the following here, using the QUIZIT format for multiple choice things. Regards Johannes \def\abschnitt{\par} \defineXMLenvironment [P] {}{\abschnitt} \defineXMLargument [TITLE] {\Anschreiben} \defineXMLargument [EXAM] {\gobble} \defineXMLenvironment [INSTRUCTION] {\startframedtext}{\stopframedtext} \defineXMLenvironment [QUESTION-GROUP] [id=,next=] {\subject{\XMLpar{question-group} {id}{}}\resetfrage} {\par\page[yes]\Refseite} \defineXMLenvironment [ITEM] {\item}{} \defineXMLenvironment [MCHOICE] {\StartMchoice}{\StopMchoice} \defineXMLenvironment [ANSWER] {\StartAnswer}{\StopAnswer} \defineXMLenvironment [DESCRIPTION] {}{\StopDescription} \definelabel[frage][text=Frage, location=inmargin] \definelabel[antwort] \def\StopDescription{\startitemize[a, inmargin, intro]} \def\StartMchoice{\frage} \def\StopMchoice{\stopitemize\page[bigpreference]} \def\StartAnswer{\begingroup\def\abschnitt{\relax} \item } \def\StopAnswer{\dotfill\inright{\Square}\endgroup\par} %{\XMLpar{ANSWER}{VALUE}}\par} %\XMLifequalelse{answer}{value}{wrong}{X}{O}}\par} \def\gobble#1{} \definemakeup[anschreiben][hoffset=17mm, voffset=50mm] \definemakeup[refseite][hoffset=17mm, voffset=50mm] \setuppagenumbering[state=none] \startreusableMPgraphic{L7} draw unitsquare scaled 14pt; \stopreusableMPgraphic \startuseMPgraphic{crossed} u := 10pt; draw unitsquare scaled u; draw (0u,0u)--(1u,1u); draw (0u,1u)--(1u,0u); \stopuseMPgraphic \startuseMPgraphic{doublecrossed} u := 10pt; draw unitsquare scaled u; draw (0u,0u)--(1u,1u); draw (0u,1u)--(1u,0u); draw (0.5u,0u)--(0.5u,1u); draw (0u,0.5u)--(1u,0.5u); \stopuseMPgraphic \def\Square{\reuseMPgraphic{L7}} \def\Crossed{\reuseMPgraphic{crossed}} \def\DoubleCrossed{\reuseMPgraphic{doublecrossed}} \setupoutput[pdf] \mainlanguage[de] \useencoding[win] \def\Anschreiben#1{% \startanschreibenmakeup {\tfb #1}\crlf \vfill \startitemize \item Bitte schreiben Sie auf diese Seite Ihren Namen und Ihre EDV-Nummer. \item Die Zeit zur Bearbeitung beträgt 45 Minuten. \item Jede Frage hat fünf Antworten. Nur eine Antwort ist anzukreuzen. \item Manche Fragen und Antworten können durch einen Seitenumbruch unterbrochen sein. \item Kreuzen Sie das Kästchen zur Antwort diagonal an (\Crossed). Wenn Sie sich korrigieren möchten, kreuzen Sie es gerade durch (\DoubleCrossed) und machen Ihr Kreuz in ein anderes Kästchen. \item Die letzte Seite können Sie als Referenz nutzen, abreißen und behalten. \stopitemize \vfill \stopanschreibenmakeup \setupheadertexts[][#1]} \def\Refseite{ \subject{Meine Lösungen} \startitemize[n, three] \item \item \item \item \item \item \item \item \item \item \item \item \stopitemize } \starttext \processXMLfilegrouped{KlausurW2003n.xml} \stoptext -- Johannes Hüsing There is something fascinating about science. One gets hannes@ruhrau.de such wholesale returns of conjecture from such a trifling investment of fact. Mark Twain
At 22:12 21/05/2003 +0200, you wrote:
Dear Alexandre,
I am using the following here, using the QUIZIT format for multiple choice things.
I have a mpc demo style somehwere which keep track of scores, feedback etc in such an xml coded doc (interactively); i'll see if i can wrap that up into a style Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
participants (5)
-
Alexandre Enkerli
-
Berend de Boer
-
Hans Hagen
-
Johannes Hüsing
-
Simon Pepping