From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/81051 Path: news.gmane.org!not-for-mail From: "Thomas A. Schmitz" Newsgroups: gmane.comp.tex.context Subject: Re: processing xml with lua Date: Tue, 05 Mar 2013 11:27:31 +0100 Message-ID: <5135C893.9080807@uni-bonn.de> References: <04D0A21F-FEAB-4F86-8317-6ED044B41619@uni-bonn.de> <512CB06E.8020206@wxs.nl> <92A8729E-7338-4EE3-8835-BE8A66DE748B@uni-bonn.de> <5135B134.10900@uni-bonn.de> <5135B3B3.8030407@wxs.nl> <5135B805.9010805@uni-bonn.de> <5135C4DE.50306@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1362479258 14119 80.91.229.3 (5 Mar 2013 10:27:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Mar 2013 10:27:38 +0000 (UTC) To: mailing list for ConTeXt users , Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Tue Mar 05 11:28:00 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UCp6E-00058v-9T for gctc-ntg-context-518@m.gmane.org; Tue, 05 Mar 2013 11:27:58 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3D5E4101E6; Tue, 5 Mar 2013 11:27:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id y4mMwGD6zCuz; Tue, 5 Mar 2013 11:27:34 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id D2FDF101E8; Tue, 5 Mar 2013 11:27:34 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3934F101E8 for ; Tue, 5 Mar 2013 11:27:34 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 7Z3M-0FaloeW for ; Tue, 5 Mar 2013 11:27:33 +0100 (CET) Original-Received: from filter3-til.mf.surf.net (filter3-til.mf.surf.net [194.171.167.219]) by balder.ntg.nl (Postfix) with ESMTP id 59AA8101E6 for ; Tue, 5 Mar 2013 11:27:33 +0100 (CET) Original-Received: from uni-bonn.de (x23.rhrz.uni-bonn.de [131.220.15.155]) by filter3-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r25ARWKf012766 for ; Tue, 5 Mar 2013 11:27:32 +0100 Original-Received: from [87.178.35.70] (account tschmit1@uni-bonn.de HELO [192.168.0.37]) by fe2.uni-bonn.de (CommuniGate Pro SMTP 5.4.4) with ESMTPSA id 38976503; Tue, 05 Mar 2013 11:27:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 In-Reply-To: <5135C4DE.50306@wxs.nl> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=131.220.15.155; country=DE; latitude=51.0000; longitude=9.0000; http://maps.google.com/maps?q=51.0000,9.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 06J7KrwnW - 9495b575af90 - 20130305 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.219 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:81051 Archived-At: On 03/05/2013 11:11 AM, Hans Hagen wrote: > \startluacode > local lookuptable = { } > function xml.functions.lookup(t) > local mytype = xml.text(t, "c") > local myvalue = lookuptable[mytype] > if not myvalue then > myvalue = xml.first(t, "d") > lookuptable[mytype] = myvalue > context("registered: ") > else > context("reused: ") > end > -- each found node gets an id > lxml.flush(lxml.id(myvalue)) > context(" or ") > -- in tex mode a to-tex serializer is the default > xml.cprint(myvalue) > end > \stopluacode > > One place to look for tricks is in x-mathml.mkiv / lua (I know, I should > finish that manual). > > Hans Beautiful! Thanks a lot, that's just what I needed. And yes, in the medium-to-long run, finishing the manual will save you from being pestered with my questions... :-) Thomas ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________