From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/41088 Path: news.gmane.org!not-for-mail From: WN Newsgroups: gmane.comp.tex.context Subject: luatex and xml Date: Sun, 18 May 2008 02:20:00 +0200 Message-ID: <482F7630.70401@tiscali.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1211069937 16507 80.91.229.12 (18 May 2008 00:18:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 18 May 2008 00:18:57 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun May 18 02:19:33 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1JxWce-0002rK-7T for gctc-ntg-context-518@m.gmane.org; Sun, 18 May 2008 02:19:32 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 160491FC27; Sun, 18 May 2008 02:18:46 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 24787-03; Sun, 18 May 2008 02:17:55 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5EC571FBFB; Sun, 18 May 2008 02:17:54 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 57B481FBFB for ; Sun, 18 May 2008 02:17:44 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 22304-04 for ; Sun, 18 May 2008 02:17:05 +0200 (CEST) Original-Received: from smtp-out0.tiscali.nl (smtp-out0.tiscali.nl [195.241.79.175]) by ronja.ntg.nl (Postfix) with ESMTP id 4C5B71FBBD for ; Sun, 18 May 2008 02:17:03 +0200 (CEST) Original-Received: from [212.123.161.245] (helo=[192.168.1.36]) by smtp-out0.tiscali.nl with esmtp id 1JxWaF-000837-L3 for ; Sun, 18 May 2008 02:17:03 +0200 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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 X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:41088 Archived-At: Hi, I am trying to parse a xml file with mkiv to process a list of invoices (factuur in dutch). The xml file looks like this 123456789 1 januari 2008 Omschrijving geleverde dienst a 1500,00 Omschrijving geleverde dienst b 200,00 I want to extract and sum the invoices (regels). I managed to get things working (printing) but don't know how to assign these values into lua variables for the summing. The test code looks like this % engine=luatex \starttext \startluacode document.xml = document.xml or { } -- define namespace document.xml = xml.load("factuur.xml") -- load the file n = xml.count(document.xml, "/factuur/regels/omschrijving") for i = 1, n do -- -- here I want to assign the values returned by xml.filter into local variable amount -- xml.sprint(xml.filter(document.xml, "/factuur/regels/bedrag/position(" .. i .. ")" )) end \stopluacode \stoptext Kind regards WN ___________________________________________________________________________________ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________