From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/71331 Path: news.gmane.org!not-for-mail From: "Thomas A. Schmitz" Newsgroups: gmane.comp.tex.context Subject: Re: xml processing in lua Date: Mon, 26 Sep 2011 21:25:24 +0200 Message-ID: <4E80D1A4.30602@uni-bonn.de> References: <4E80CB15.4070709@uni-bonn.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1317065149 17211 80.91.229.12 (26 Sep 2011 19:25:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 26 Sep 2011 19:25:49 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Sep 26 21:25:44 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R8Go9-0001FC-V9 for gctc-ntg-context-518@m.gmane.org; Mon, 26 Sep 2011 21:25:42 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4B005CAFD2; Mon, 26 Sep 2011 21:25:41 +0200 (CEST) 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 Dfva0zPTiMa2; Mon, 26 Sep 2011 21:25:38 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BE06FCAFCD; Mon, 26 Sep 2011 21:25:38 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D8124CAFCD for ; Mon, 26 Sep 2011 21:25:37 +0200 (CEST) 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 5s+hMNoFp8pH for ; Mon, 26 Sep 2011 21:25:26 +0200 (CEST) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id E708ACAFCB for ; Mon, 26 Sep 2011 21:25:26 +0200 (CEST) Original-Received: from uni-bonn.de (mail.uni-bonn.de [131.220.15.113]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p8QJPQYp008764 for ; Mon, 26 Sep 2011 21:25:26 +0200 Original-Received: from [87.178.29.67] (account tschmit1@uni-bonn.de HELO localhost.localdomain) by fe2.uni-bonn.de (CommuniGate Pro SMTP 5.2.12) with ESMTPSA id 237327 for ntg-context@ntg.nl; Mon, 26 Sep 2011 21:25:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20110907 Thunderbird/6.0.2 In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=131.220.15.113; country=DE; region=07; city=Bonn; latitude=50.7333; longitude=7.1000; http://maps.google.com/maps?q=50.7333,7.1000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 06FBvpq2l - f75719f26214 - 20110926 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:71331 Archived-At: On 09/26/2011 09:15 PM, Aditya Mahajan wrote: > On Mon, 26 Sep 2011, Thomas A. Schmitz wrote: > >> Hi all, >> >> after boring people with xml processing in TeX at the meeting in >> Bassenge, I'm looking for new challenges and am trying my hand at >> processing xml in lua. But so far, even the simplest things escape me. >> Here's an example: >> >> \startbuffer[test] >> >> One >> Two >> >> \stopbuffer >> >> \startxmlsetups xml:setups >> \xmlsetsetup{main}{a|b|c}{xml:*} >> \stopxmlsetups >> >> \xmlregistersetup{xml:setups} >> >> % \startxmlsetups xml:a >> % \xmltext{#1}{/c} >> % \stopxmlsetups >> >> \startxmlsetups xml:a >> \startluacode >> context(xml.text("#1", "/b")) >> \stopluacode >> \stopxmlsetups >> >> \starttext >> \xmlprocessbuffer{main}{test}{} >> \stoptext >> >> From what I thought I understood from the source, I believed that ll. >> 14-16 (the commented part) and ll. 18-22 should be exactly equivalent, >> but that's not the case. A little hint might get me started... > > Untested ... you can try context.xmltext("#1", "/b") > > Aditya Aditya, Wolfgang, thanks a lot for your solutions, both work. With Wolfgang at Bassenge, and the network there being flaky, others had a chance of being faster than him, but now he's back and rules with an iron fist :-) All best 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 ___________________________________________________________________________________