From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/55286 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: XML - creating a list by hand (mkiv) Date: Tue, 22 Dec 2009 14:04:37 +0100 Message-ID: <4B30C3E5.5080506@wxs.nl> References: <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 1261487112 24651 80.91.229.12 (22 Dec 2009 13:05:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Dec 2009 13:05:12 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Dec 22 14:05:02 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 1NN4Q9-0004nf-Tx for gctc-ntg-context-518@m.gmane.org; Tue, 22 Dec 2009 14:05:01 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AB520C9B10; Tue, 22 Dec 2009 14:04:54 +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 1aXzdCm6ZFoH; Tue, 22 Dec 2009 14:04:51 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 5569FC9AF1; Tue, 22 Dec 2009 14:04:49 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 67AF7C9B07 for ; Tue, 22 Dec 2009 14:04:45 +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 W4HdM8tGXcVJ for ; Tue, 22 Dec 2009 14:04:41 +0100 (CET) Original-Received: from mail.solcon.net (dsl-083-247-100-017.solcon.nl [83.247.100.17]) by balder.ntg.nl (Postfix) with ESMTP id E4C52C9B03 for ; Tue, 22 Dec 2009 14:04:40 +0100 (CET) X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by controller-9 (SurgeMail 4.2a3) with ESMTP id 15054-1713362 for ; Tue, 22 Dec 2009 14:02:23 +0100 User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) In-Reply-To: <4B2F79FA.6030802@gmx.net> X-Authenticated-User: hagen@controller-9 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:55286 Archived-At: Peter Rolf wrote: > 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). http://www.pragma-ade.com/general/manuals/xml-mkiv.pdf > 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(" standalone='yes'?>\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","") this works > --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 > ___________________________________________________________________________________ > -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 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 ___________________________________________________________________________________