From toto@tots-ns.net Thu Jan 19 17:23:31 2006 From: Junod Antoine To: ntg-context@ntg.nl Subject: [NTG-context] xml and buffers Date: Thu, 19 Jan 2006 19:23:29 +0100 Message-ID: <20060119182329.GB25283@zapata.cryptyx.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4986915466282227811==" --===============4986915466282227811== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Hello gurus, 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énie Logiciel" in buffer course_name, "23 décembre 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]}{\stopstandardmakeup} But it does not print anything else than the title. Any idea? Thanks a lot for you help! -AJ --===============4986915466282227811==-- From pragma@wxs.nl Thu Jan 19 17:55:25 2006 From: Hans Hagen To: ntg-context@ntg.nl Subject: Re: [NTG-context] xml and buffers Date: Thu, 19 Jan 2006 17:55:22 +0100 Message-ID: <43CFC47A.3040209@wxs.nl> In-Reply-To: <20060119182329.GB25283@zapata.cryptyx.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6040295565995815659==" --===============6040295565995815659== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Junod Antoine wrote: >Hello gurus, > >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�nie Logiciel" in buffer course_name, "23 d�cembre >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]}{\stopstandardmakeup} > >But it does not print anything else than the title. > > buffers serve a different purpose and are part if a text flow \starttext \defineXMLsingular [meta] [name=,content=] {\setevariables[document:meta][\XMLop{name}=\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: \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=,content=] {\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="course_name" content="Genie Logiciel" /> <meta name="date" content="23 decembre 2005" /> <title/> \stopXMLdata \stoptext --===============6040295565995815659==-- From toto@tots-ns.net Fri Jan 20 08:29:00 2006 From: Junod Antoine <toto@tots-ns.net> To: ntg-context@ntg.nl Subject: Re: [NTG-context] xml and buffers Date: Fri, 20 Jan 2006 08:28:59 +0100 Message-ID: <20060120072859.GC27110@zapata.cryptyx.com> In-Reply-To: <43CFC47A.3040209@wxs.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0790925287232025972==" --===============0790925287232025972== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Thanks a lot!!! -AJ On Thu, Jan 19, 2006 at 05:55:22PM +0100, Hans Hagen wrote: > Junod Antoine wrote: > > >Hello gurus, > > > >I'm a bit into trouble wih buffers and xml parsing. Here is my problem: > > > >I've got a .xhtml with the following lines: > > > > [...] > > <meta name="course_name" content="G�nie Logiciel" /> > > <meta name="date" content="23 d�cembre 2005" /> > > [...] > > <title>Auction: document d'analyse > > [...] > > > >I'm trying to store the content of the meta tag in a buffer, one per > >meta tag, (ie "G�nie Logiciel" in buffer course_name, "23 d�cembre > >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]}{\stopstandardmakeup} > > > >But it does not print anything else than the title. > > > > > buffers serve a different purpose and are part if a text flow > > \starttext > > \defineXMLsingular > [meta] > [name=,content=] > {\setevariables[document:meta][\XMLop{name}=\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: > > \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=,content=] > {\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="course_name" content="Genie Logiciel" /> > <meta name="date" content="23 decembre 2005" /> > > <title/> > \stopXMLdata > > > \stoptext > > > > _______________________________________________ > ntg-context mailing list > ntg-context(a)ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context --===============0790925287232025972==-- From toto@tots-ns.net Fri Jan 20 20:33:46 2006 From: Junod Antoine <toto@tots-ns.net> To: ntg-context@ntg.nl Subject: Re: [NTG-context] xml and buffers Date: Fri, 20 Jan 2006 20:33:39 +0100 Message-ID: <20060120193339.GA19537@zapata.cryptyx.com> In-Reply-To: <43CFC47A.3040209@wxs.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2110698969409245101==" --===============2110698969409245101== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Thu, Jan 19, 2006 at 05:55:22PM +0100, Hans Hagen wrote: > Junod Antoine wrote: > > >Hello gurus, > > > >I'm a bit into trouble wih buffers and xml parsing. Here is my problem: > >[...] > > \defineXMLsingular > [meta] > [name=,content=] > {\setevariables[document:meta][\XMLop{name}=\XMLop{content}]} It works fine for all "normal" characters but not for accented characters. Is there a workaround? I'm using the ConTeXt version of the 16 of this month and the latest stable version of pdftex. The .log of the compilation is available here: http://zapata.tots-ns.net/analysis.log The parsed .xhtml is here: http://zapata.tots-ns.net/analysis.xhtml and the .tex is there: http://zapata.tots-ns.net/analysis.tex One more time, thanks a lot for all your help. Have a nice week-end -AJ --===============2110698969409245101==--