From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/83563 Path: news.gmane.org!not-for-mail From: "Thomas A. Schmitz" Newsgroups: gmane.comp.tex.context Subject: xmlfilter in lua Date: Sun, 28 Jul 2013 12:59:09 +0200 Message-ID: <51F4F97D.3050503@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 1375009164 24630 80.91.229.3 (28 Jul 2013 10:59:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Jul 2013 10:59:24 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jul 28 12:59:27 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 1V3OhC-0000ar-GJ for gctc-ntg-context-518@m.gmane.org; Sun, 28 Jul 2013 12:59:26 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 33A54101EB; Sun, 28 Jul 2013 12:59: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 ophA6eynwjBx; Sun, 28 Jul 2013 12:59:00 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id D20DB101E4; Sun, 28 Jul 2013 12:58:59 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 67DB5101E4 for ; Sun, 28 Jul 2013 12:58:58 +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 VkR56ZKydPKC for ; Sun, 28 Jul 2013 12:58:48 +0200 (CEST) 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 B2DE1101E3 for ; Sun, 28 Jul 2013 12:58:48 +0200 (CEST) Original-Received: from uni-bonn.de (mail.uni-bonn.de [131.220.15.113]) by filter3-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r6SAxAvp009300 for ; Sun, 28 Jul 2013 12:59:12 +0200 Original-Received: from [87.178.3.163] (account tschmit1@uni-bonn.de HELO [192.168.0.28]) by fe2.uni-bonn.de (CommuniGate Pro SMTP 5.4.9) with ESMTPSA id 50360740 for ntg-context@ntg.nl; Sun, 28 Jul 2013 12:59:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 X-Bayes-Prob: 0.0835 (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: 06K5KXaKj - 9d2ceec590df - 20130728 (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:83563 Archived-At: 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.xprint(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 ?) 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 ___________________________________________________________________________________