From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/25422 Path: news.gmane.org!not-for-mail From: Junod Antoine Newsgroups: gmane.comp.tex.context Subject: Re: xml and buffers Date: Fri, 20 Jan 2006 08:28:59 +0100 Message-ID: <20060120072859.GC27110@zapata.cryptyx.com> References: <20060119182329.GB25283@zapata.cryptyx.com> <43CFC47A.3040209@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1137742290 23987 80.91.229.2 (20 Jan 2006 07:31:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2006 07:31:30 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Fri Jan 20 08:31:29 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 1Ezqk3-00031C-1R for gctc-ntg-context-518@m.gmane.org; Fri, 20 Jan 2006 08:31:27 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9F01212837; Fri, 20 Jan 2006 08:31:26 +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 16183-02; Fri, 20 Jan 2006 08:31:26 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0A20812831; Fri, 20 Jan 2006 08:29:02 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C396B12831 for ; Fri, 20 Jan 2006 08:29:00 +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 16183-01 for ; Fri, 20 Jan 2006 08:28:59 +0100 (CET) Original-Received: from zapata.tots-ns.net (zapata.tots-ns.net [213.239.193.37]) by ronja.ntg.nl (Postfix) with SMTP id B39B512824 for ; Fri, 20 Jan 2006 08:28:59 +0100 (CET) Original-Received: (qmail 29436 invoked by uid 1000); 20 Jan 2006 08:28:59 +0100 Original-To: mailing list for ConTeXt users Content-Disposition: inline In-Reply-To: <43CFC47A.3040209@wxs.nl> User-Agent: Mutt/1.5.11 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:25422 Archived-At: Thanks a lot!!! -AJ On Thu, Jan 19, 2006 at 05:55:22PM +0100, Hans Hagen wrote: > Junod Antoine wrote: >=20 > >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]}{\stopstandardmake= up} > > > >But it does not print anything else than the title. > >=20 > > > buffers serve a different purpose and are part if a text flow=20 >=20 > \starttext >=20 > \defineXMLsingular > [meta] > [name=3D,content=3D] > {\setevariables[document:meta][\XMLop{name}=3D\XMLop{content}]} >=20 > \defineXMLenvironment > [title] > {} > {\startstandardmakeup > \getvariable{document:meta}{course_name} \endgraf > \getvariable{document:meta}{date} \endgraf > \stopstandardmakeup} >=20 > \startXMLdata > > >=20 > > \stopXMLdata >=20 > With a little extension (i'll add it) we can prevent unwanted expansion= :=20 >=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} >=20 > \defineXMLsingular > [meta] > [name=3D,content=3D] > {\setvalueXMLpar{document:meta:\XMLop{name}}{meta}{content}} >=20 > \defineXMLenvironment > [title] > {} > {\startstandardmakeup > \getvalue{document:meta:course_name} \endgraf > \getvalue{document:meta:date} \endgraf > \stopstandardmakeup} >=20 > \startXMLdata > <meta name=3D"course_name" content=3D"Genie Logiciel" /> > <meta name=3D"date" content=3D"23 decembre 2005" /> >=20 > <title/> > \stopXMLdata >=20 >=20 > \stoptext >=20 >=20 >=20 > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context