From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/83612 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: xmlfilter in lua Date: Thu, 01 Aug 2013 01:41:21 +0200 Message-ID: <51F9A0A1.1090700@wxs.nl> References: <51F4F97D.3050503@uni-bonn.de> <51F50988.9020508@uni-bonn.de> <51F97926.7050703@uni-bonn.de> 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 1375314096 7124 80.91.229.3 (31 Jul 2013 23:41:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Jul 2013 23:41:36 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Thu Aug 01 01:41:38 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V4g1Q-0007qn-VA for gctc-ntg-context-518@m.gmane.org; Thu, 01 Aug 2013 01:41:37 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 64149101EA; Thu, 1 Aug 2013 01:41:05 +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 AUGszCSeqk9U; Thu, 1 Aug 2013 01:41:03 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 4D21A101E6; Thu, 1 Aug 2013 01:41:03 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 86F0C101E6 for ; Thu, 1 Aug 2013 01:41:01 +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 Ler44EdMmY-V for ; Thu, 1 Aug 2013 01:41:00 +0200 (CEST) Original-Received: from filter3-utr.mf.surf.net (filter3-utr.mf.surf.net [195.169.124.154]) by balder.ntg.nl (Postfix) with ESMTP id 5D54E101E4 for ; Thu, 1 Aug 2013 01:41:00 +0200 (CEST) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter3-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r6VNfUgH013935 for ; Thu, 1 Aug 2013 01:41:30 +0200 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.104; Original-Received: from [10.100.1.104] (unverified [10.100.1.104]) by pragma-net.nl (SurgeMail 6.3c2) with ESMTP id 13849-1713362 for ; Thu, 01 Aug 2013 01:41:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: <51F97926.7050703@uni-bonn.de> X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; region=15; city=Zwolle; latitude=52.5058; longitude=6.0858; http://maps.google.com/maps?q=52.5058,6.0858&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 08K7bFutV - 9df90790b125 - 20130801 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.154 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:83612 Archived-At: On 7/31/2013 10:52 PM, Thomas A. Schmitz wrote: > Gentlemen and noble ladies, > > may I rerun this question? It was posted on Sunday and may have escaped > those of you who celebrated this day in some manner. > > Thanks for your attention! > > T > > On 07/28/2013 02:07 PM, Thomas A. Schmitz wrote: >> Hi, >> >> hope this is comprehensible without a full example: I want to do some >> operations on my xml, and that's easier to do in Lua. However, I cannot >> find how to filter my results and pass them on to a command. In TeX, I >> would do this: >> >> \startxmlsetups xml:a >> \xmlfilter{#1}{/b/command(xml:command:b)} >> \stopxmlsetups >> >> \startxmlsetups xml:command:b >> \xmlconcat{#1}{/}\par >> \stopxmlsetups >> >> How would I do the same thing in Lua? Here's what I tried: >> >> function xml.functions.a(t) >> local b = lxml.filter(lxml.id(t), "/b") >> process(b) >> end >> >> function process(t) >> xml.cprint(t) >> end >> >> but that doesn't work yet, I get no results printed. So my question: >> what would be the right syntax in Lua? (And bonus points for: what is >> the equivalent of \xmlconcat ?) - real test file needed - you use process before you define it another approach is: for c in xml.collected(lxml.id(t),"/b") do ... end (see x-mathml, x-cals for examples) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________