From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/78232 Path: news.gmane.org!not-for-mail From: "Thomas A. Schmitz" Newsgroups: gmane.comp.tex.context Subject: Re: xml cross-references in lua? Date: Wed, 12 Sep 2012 08:32:53 +0200 Message-ID: <50502C95.3030606@uni-bonn.de> References: <504F7345.6050309@uni-bonn.de> <504F806B.4010108@wxs.nl> 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 1347431584 30899 80.91.229.3 (12 Sep 2012 06:33:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Sep 2012 06:33:04 +0000 (UTC) Cc: Hans Hagen To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Sep 12 08:33:05 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TBgVT-0000Pa-R3 for gctc-ntg-context-518@m.gmane.org; Wed, 12 Sep 2012 08:33:03 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 99B3E101FA; Wed, 12 Sep 2012 08:32:59 +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 7D1tFdnvdcTZ; Wed, 12 Sep 2012 08:32:57 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id C7C31101E2; Wed, 12 Sep 2012 08:32:57 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4041C101E2 for ; Wed, 12 Sep 2012 08:32:56 +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 oTMMp9PFI9Eb for ; Wed, 12 Sep 2012 08:32:55 +0200 (CEST) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id 5E25B101E0 for ; Wed, 12 Sep 2012 08:32:55 +0200 (CEST) Original-Received: from uni-bonn.de (mail.uni-bonn.de [131.220.15.113]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q8C6WsN7010163 for ; Wed, 12 Sep 2012 08:32:54 +0200 Original-Received: from [87.178.44.233] (account tschmit1@uni-bonn.de HELO localhost.localdomain) by fe2.uni-bonn.de (CommuniGate Pro SMTP 5.4.4) with ESMTPSA id 25318159; Wed, 12 Sep 2012 08:32:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120902 Thunderbird/15.0 In-Reply-To: <504F806B.4010108@wxs.nl> X-Bayes-Prob: 0.0001 (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: 0NHW6wSWS - 1db3a6571aca - 20120912 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 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:78232 Archived-At: On 09/11/2012 08:18 PM, Hans Hagen wrote: > > If the number of bib items is not that large hashing does not save > much. (In x-xfdf.mkiv you can see another example). > > \starttext > > \startbuffer[demo] > Hans Hagen The Meaning of Life Is 42 > The Rhetoric of Mathematics 2011 > Hans Hagen > The New Meaning is Now 43 High Energy > Metaphysics 2012

This has > been successfully proven in papers by and > .

\stopbuffer > > \startxmlsetups xml:define \xmlsetsetup{#1}{*}{xml:*} \stopxmlsetups > > \startxmlsetups xml:document \xmlall{#1}{/text} \stopxmlsetups > \startxmlsetups xml:text \xmlflush{#1} \stopxmlsetups \startxmlsetups > xml:p \xmlflush{#1} \par \stopxmlsetups > > \startxmlsetups xml:bib \BibAuthor{#1}{\xmlatt{#1}{ref}} > \stopxmlsetups > > \startxmlsetups xml:author [[\xmlflush{#1}]] \stopxmlsetups > > \def\BibAuthor#1#2{[1:\xmlfirst{whatever}{/document/bibitem[@xml:id==string.sub('#2',2)]/author}]} > > > > \xmlregistersetup{xml:define} > > \xmlprocessbuffer{whatever}{demo}{} > > \startluacode userdata = userdata or { } userdata.bibitems = { } > \stopluacode > > \startxmlsetups xml:document \xmlflush{#1} \stopxmlsetups > > \startxmlsetups xml:bibitem > \ctxlua{userdata.bibitems["\letterhash\xmlatt{#1}{xml:id}"] = "#1"} > \stopxmlsetups > > \def\BibAuthor#1#2{[2:\xmlfirst{\cldcontext{userdata.bibitems['#2']}}{/author}]} > > > > \xmlprocessbuffer{whatever}{demo}{} > > \stoptext > > (I ran into a recently introduced side effect of an optimization so > I'll generate you a new beta. Older versions should work anyway as no > special trickery is used.) > > Hans > Ah, wonderful, Hans, I can play with this! Thanks a lot for the swift reply and for the help, this will get me going! 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 ___________________________________________________________________________________