From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/55279 Path: news.gmane.org!not-for-mail From: Peter Rolf Newsgroups: gmane.comp.tex.context Subject: XML - creating a list by hand (mkiv) Date: Mon, 21 Dec 2009 14:36:58 +0100 Message-ID: <4B2F79FA.6030802@gmx.net> 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: ger.gmane.org 1261402643 4591 80.91.229.12 (21 Dec 2009 13:37:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Dec 2009 13:37:23 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Dec 21 14:37:14 2009 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.50) id 1NMiRm-0001W9-D1 for gctc-ntg-context-518@m.gmane.org; Mon, 21 Dec 2009 14:37:14 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7FE72C9BA5; Mon, 21 Dec 2009 14:37:13 +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 xNjZEgK4qkgy; Mon, 21 Dec 2009 14:37:09 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id CFC17C9BAE; Mon, 21 Dec 2009 14:37:05 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 73B18C9BA5 for ; Mon, 21 Dec 2009 14:37:00 +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 1gbmn-dPzWw8 for ; Mon, 21 Dec 2009 14:36:54 +0100 (CET) Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by balder.ntg.nl (Postfix) with SMTP id E9602C9B10 for ; Mon, 21 Dec 2009 14:36:53 +0100 (CET) Original-Received: (qmail invoked by alias); 21 Dec 2009 13:36:53 -0000 Original-Received: from i577BE0D5.versanet.de (EHLO [192.168.1.3]) [87.123.224.213] by mail.gmx.net (mp038) with SMTP; 21 Dec 2009 14:36:53 +0100 X-Authenticated: #24293357 X-Provags-ID: V01U2FsdGVkX1/G8dItGE7GuZBiH7pdR5iIhxSWbv7LeG9t++grA0 4jDIajNwAQH/Xf User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 X-Y-GMX-Trusted: 0 X-FuHaFi: 0.64 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:55279 Archived-At: Hi, can someone give me a helping hand with the following example. I still have no general survey over the XML related code in ConTeXt (donno what functions to use). The last time I played with it is one and a half year ago and many things have changed (meaning that the old examples no longer work). I simply want to create a XML document and insert some elements. My main problem is to insert an element at root level. I can insert an element before and after another element, but not into the element. I'm not sure, if I have understood the meaning of the pattern parameter correctly. Is this equal to XPath? %----- \starttext \startluacode local xmp = xml.convert("\n\nbla\n") --xml.before(xmp,"/root/bar","foo") --xml.delete(xmp,"bar") --xml.inject(xmp,"/sub","bar")-- only for xml-files? xml.insert(xmp,"/root/bar","") --xml.inject(xmp,"/*/bar","") --xml.sprint(xml.filter(xmp,"/root/sub")) xml.save(xmp,"test.xml") \stopluacode \stoptext %----- Best wishes, Peter ___________________________________________________________________________________ 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 ___________________________________________________________________________________