From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/25396 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: xml and buffers Date: Thu, 19 Jan 2006 17:55:22 +0100 Message-ID: <43CFC47A.3040209@wxs.nl> References: <20060119182329.GB25283@zapata.cryptyx.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1137689828 11161 80.91.229.2 (19 Jan 2006 16:57:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 19 Jan 2006 16:57:08 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Thu Jan 19 17:56:58 2006 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 ciao.gmane.org with esmtp (Exim 4.43) id 1Ezd4K-0001EW-Aw for gctc-ntg-context-518@m.gmane.org; Thu, 19 Jan 2006 17:55:28 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id E986B1287C; Thu, 19 Jan 2006 17:55:27 +0100 (CET) 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 02758-03-4; Thu, 19 Jan 2006 17:55:25 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B541F127B5; Thu, 19 Jan 2006 17:55:25 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 23A67127B5 for ; Thu, 19 Jan 2006 17:55:25 +0100 (CET) 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 02758-03-3 for ; Thu, 19 Jan 2006 17:55:24 +0100 (CET) Original-Received: from mail.pragma-ade.net (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by ronja.ntg.nl (Postfix) with SMTP id 1FB8E127B0 for ; Thu, 19 Jan 2006 17:55:23 +0100 (CET) Original-Received: from [10.100.1.102] (unverified [10.100.1.102]) by controller-1 (SurgeMail 3.5b3) with ESMTP id 1578 for ; Thu, 19 Jan 2006 12:06:38 +0300 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <20060119182329.GB25283@zapata.cryptyx.com> X-Server: High Performance Mail Server - http://surgemail.com r=-274017400 X-Authenticated-User: hagen@controller-1 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 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:25396 Archived-At: Junod Antoine wrote: >Hello gurus,=20 > >I'm a bit into trouble wih buffers and xml parsing. Here is my problem: > >I've got a .xhtml with the following lines: > > [...] > > > [...] > Auction: document d'analyse > [...] > >I'm trying to store the content of the meta tag in a buffer, one per >meta tag, (ie "G=EF=BF=BDnie Logiciel" in buffer course_name, "23 d=EF=BF= =BDcembre >2005" in buffer date) to use these buffers when I meet the title tag: > > \XMLifequalelse{meta}{name}{course_name} > {\startbuffer[course_name]\XMLpar{meta}{content}{}\stopbuffer}= {} > \XMLifequalelse{meta}{name}{date} > {\startbuffer[date]\XMLpar{meta}{content}{}\stopbuffer}{} > \defineXMLenvironment [title] {\startstandardmakeup > \getbuffer[course_name] > \getbuffer[date]}{\stopstandardmakeu= p} > >But it does not print anything else than the title. > =20 > buffers serve a different purpose and are part if a text flow=20 \starttext \defineXMLsingular [meta] [name=3D,content=3D] {\setevariables[document:meta][\XMLop{name}=3D\XMLop{content}]} \defineXMLenvironment [title] {} {\startstandardmakeup \getvariable{document:meta}{course_name} \endgraf \getvariable{document:meta}{date} \endgraf \stopstandardmakeup} \startXMLdata \stopXMLdata With a little extension (i'll add it) we can prevent unwanted expansion:=20 \unprotected \def\setvalueXMLpar#1#2#3% {\@EA\let\csname#1\@EA\endcsname \csname\ifcsname\@@XMLvariable:#2:#3\endcsname \@@XMLvariable:#2:#3\else\s!empty\fi\endcsname} \defineXMLsingular [meta] [name=3D,content=3D] {\setvalueXMLpar{document:meta:\XMLop{name}}{meta}{content}} \defineXMLenvironment [title] {} {\startstandardmakeup \getvalue{document:meta:course_name} \endgraf \getvalue{document:meta:date} \endgraf \stopstandardmakeup} \startXMLdata <meta name=3D"course_name" content=3D"Genie Logiciel" /> <meta name=3D"date" content=3D"23 decembre 2005" /> <title/> \stopXMLdata \stoptext