From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/12335 Path: main.gmane.org!not-for-mail From: Simon Pepping Newsgroups: gmane.comp.tex.context Subject: Re: XML Processing Date: Wed, 21 May 2003 21:56:34 +0200 Sender: ntg-context-admin@ntg.nl Message-ID: <20030521195634.GA799@scaprea> References: <04E6633D-8AE1-11D7-B2FC-0003935A6512@indiana.edu> Reply-To: ntg-context@ntg.nl NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053547464 5379 80.91.224.249 (21 May 2003 20:04:24 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 21 May 2003 20:04:24 +0000 (UTC) Original-X-From: ntg-context-admin@ntg.nl Wed May 21 22:04:22 2003 Return-path: Original-Received: from ref.vet.uu.nl ([131.211.172.13] helo=ref.ntg.nl) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19IZnP-0001EH-00 for ; Wed, 21 May 2003 22:02:43 +0200 Original-Received: from ref.ntg.nl (localhost.localdomain [127.0.0.1]) by ref.ntg.nl (Postfix) with ESMTP id DE50210B49; Wed, 21 May 2003 22:04:33 +0200 (MEST) Original-Received: from hgatenl.hobby.nl (ns.hobby.nl [212.72.224.8]) by ref.ntg.nl (Postfix) with ESMTP id 0A9BA10B38 for ; Wed, 21 May 2003 21:56:39 +0200 (MEST) Original-Received: from hgatenl.hobby.nl (localhost [127.0.0.1]) by hgatenl.hobby.nl (8.12.6/8.12.2) with ESMTP id h4LJudgB074044 for ; Wed, 21 May 2003 21:56:39 +0200 (CEST) (envelope-from spepping@scaprea.hobby.nl) Original-Received: (from uucp@localhost) by hgatenl.hobby.nl (8.12.6/8.12.2/Submit) with UUCP id h4LJude7074043 for ntg-context@ntg.nl; Wed, 21 May 2003 21:56:39 +0200 (CEST) Original-Received: from simon by scaprea.salix.nl with local (Exim 3.35 #1 (Debian)) id 19IZhS-0000LX-00; Wed, 21 May 2003 21:56:34 +0200 Original-To: ntg-context@ntg.nl Mail-Followup-To: ntg-context@ntg.nl Content-Disposition: inline In-Reply-To: <04E6633D-8AE1-11D7-B2FC-0003935A6512@indiana.edu> User-Agent: Mutt/1.3.28i Errors-To: ntg-context-admin@ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.0.13 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.comp.tex.context:12335 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:12335 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: > > > > > > > > > > > > > > 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