From achim@jander.de Sat Jan 8 11:21:21 2011 From: Achim Jander To: ntg-context@ntg.nl Subject: [NTG-context] Fwd: Re: xml-processing: missing or ungrouped '=' Date: Sat, 08 Jan 2011 11:20:48 +0100 Message-ID: <4D283A80.9090909@jander.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2448610576655768321==" --===============2448610576655768321== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Am 07.01.2011 22:52, schrieb Hans Hagen: > On 7-1-2011 7:04, Achim Jander wrote: > >> \startxmlsetups xml:title >> \startchapter[ >> \xmlcommand{#1}{.}{xml:splitHeader} > > title=3D... Thanks. So it seems not to be possible, to have the whatever=3D part inside an xmlcommand? I even tried things like \xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{ownnumber=3D123}}{number=3Dno} to set either ownnumber or number but with the same error Achim > >> %number=3D\xmldoifelse{#1}{/num}{yes}{no}, %works >> %ownnumber=3D\xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceF= lush}}{},%works >> >> >> %title=3D{\xmlflush{#1}},%works > > there's also \xmlraw{#1}{spec} which works nice with tables of content > as it passes the node id > > Hans > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com > | www.pragma-pod.nl > ----------------------------------------------------------------- > --===============2448610576655768321==-- From pragma@wxs.nl Sat Jan 8 12:16:17 2011 From: Hans Hagen To: ntg-context@ntg.nl Subject: Re: [NTG-context] Fwd: Re: xml-processing: missing or ungrouped '=' Date: Sat, 08 Jan 2011 12:15:37 +0100 Message-ID: <4D284759.6030802@wxs.nl> In-Reply-To: <4D283A80.9090909@jander.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5299261965850102358==" --===============5299261965850102358== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On 8-1-2011 11:20, Achim Jander wrote: > > Am 07.01.2011 22:52, schrieb Hans Hagen: >> On 7-1-2011 7:04, Achim Jander wrote: >> >>> \startxmlsetups xml:title >>> \startchapter[ >>> \xmlcommand{#1}{.}{xml:splitHeader} >> >> title=... > Thanks. > So it seems not to be possible, to have the whatever= part inside an > xmlcommand? > I even tried things like > > \xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{ownnumber=123}}{number=no} > > to set either ownnumber or number but with the same error the \xmlcommand is completely unrelated to (say) \startchapter \xmlcommand{node number}{lpath expression}{setup id} so i have no clue what you want to do with it, unless ownnumber=123 is the name of a setup Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- --===============5299261965850102358==-- From achim@jander.de Sat Jan 8 13:39:41 2011 From: Achim Jander To: ntg-context@ntg.nl Subject: Re: [NTG-context] Fwd: Re: xml-processing: missing or ungrouped '=' Date: Sat, 08 Jan 2011 13:39:07 +0100 Message-ID: <4D285AEB.5080009@jander.de> In-Reply-To: <4D284759.6030802@wxs.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1926034612799890510==" --===============1926034612799890510== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Hans, sorry, i'll try to make it more clear: \startbuffer[test] some text more text more text <num>333</num>some text more text more text \stopbuffer \startxmlsetups xml:testsetups \xmlsetsetup{\xmldocument}{a|b|title}{xml:*} \xmlsetsetup{\xmldocument}{num}{-} \stopxmlsetups \xmlregistersetup{xml:testsetups} \startxmlsetups xml:a \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:b \startparagraph \xmlflush{#1} \stopparagraph \stopxmlsetups \startxmlsetups xml:ueberForceFlush \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:getOwnNumber \xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceFlush}}{} \stopxmlsetups \startxmlsetups xml:title \startchapter[ %\xmldoifelse{#1}{/num}{ownnumber=3D\xmlcommand{#1}{/num}{xml:ueberForceFlush= }}{number=3Dno} title=3D{Testcase} ] \xmlflush{#1} \stopchapter \stopxmlsetups \setupheader[chapter][ownnumber=3Dyes] \starttext \xmlprocessbuffer{main}{test}{} \stoptext The relevant part is the line I've commented out because of the error. In the setup xml:title I start the chapter. If the title comes with an=20 number-element I want to set ownnumber=3D..., but if they have no=20 numbers, I want to set number=3Dno But this approach seems not to work. In my real application the problem=20 is, that I have a more complex setting of defining the title=3D,=20 ownnumber=3D etc attributes, but equal in different (up to 15) hierarchies. So I tried to call inside the one setup another=20 setup which should do the work, but also without success (this was my=20 original example). The plan was to call that setup from each hierarchy to avoid redundancy It was like \startxmlsetups xml:title \startchapter[ %---> here call another template to set title=3D ownnumber=3D etc. ] \xmlflush{#1} \stopchapter \stopxmlsetups Here again the complete example: \startbuffer[test] some text more text more text <num>333</num>some text more text more text \stopbuffer \startxmlsetups xml:testsetups \xmlsetsetup{\xmldocument}{a|b|title}{xml:*} \xmlsetsetup{\xmldocument}{num}{-} \stopxmlsetups \xmlregistersetup{xml:testsetups} \startxmlsetups xml:a \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:b \startparagraph \xmlflush{#1} \stopparagraph \stopxmlsetups \startxmlsetups xml:ueberForceFlush \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:splitHeader %works not number=3D\xmldoifelse{#1}{/num}{yes}{no}, ownnumber=3D\xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceFlush}= }{},=20 title=3D{\xmlflush{#1}}, \stopxmlsetups \startxmlsetups xml:title \startchapter[ %trying to call another template to set %title=3D %ownnumber=3D %and other stuff... \xmlcommand{#1}{.}{xml:splitHeader} %number=3D\xmldoifelse{#1}{/num}{yes}{no}, %works %ownnumber=3D\xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceFlush= }}{},%works=20 %title=3D{\xmlflush{#1}},%works ] \xmlflush{#1} \stopchapter \stopxmlsetups \setupheader[chapter][ownnumber=3Dyes] \starttext \xmlprocessbuffer{main}{test}{} \stoptext Thanks you and have a nice Weekend Achim Am 08.01.2011 12:15, schrieb Hans Hagen: > On 8-1-2011 11:20, Achim Jander wrote: >> >> Am 07.01.2011 22:52, schrieb Hans Hagen: >>> On 7-1-2011 7:04, Achim Jander wrote: >>> >>>> \startxmlsetups xml:title >>>> \startchapter[ >>>> \xmlcommand{#1}{.}{xml:splitHeader} >>> >>> title=3D... >> Thanks. >> So it seems not to be possible, to have the whatever=3D part inside an >> xmlcommand? >> I even tried things like >> >> \xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{ownnumber=3D123}}{number=3Dno} >> >> to set either ownnumber or number but with the same error > > the \xmlcommand is completely unrelated to (say) \startchapter > > \xmlcommand{node number}{lpath expression}{setup id} > > so i have no clue what you want to do with it, unless ownnumber=3D123 is=20 > the name of a setup > > Hans > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com > | www.pragma-pod.nl > ----------------------------------------------------------------- > --===============1926034612799890510==-- From thomas.schmitz@uni-bonn.de Sat Jan 8 14:07:46 2011 From: "Thomas A. Schmitz" To: ntg-context@ntg.nl Subject: Re: [NTG-context] Fwd: Re: xml-processing: missing or ungrouped '=' Date: Sat, 08 Jan 2011 14:07:28 +0100 Message-ID: <3DB8F220-B0CC-403D-A13C-E5B59C6DEA39@uni-bonn.de> In-Reply-To: <4D285AEB.5080009@jander.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7300032612017961356==" --===============7300032612017961356== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Jan 8, 2011, at 1:39 PM, Achim Jander wrote: > Hi Hans, > sorry, i'll try to make it more clear: Excuse me, your example makes my head spin. Just from looking at it, there ap= pears to be a fundamental error: you flush the content of into a cont= ext \startchapter \stopchapter environment, AFAICS. But that's not right: the= title is not the content of the chapter, but just its, errm, title. Can this= be the reason why your code doesn't work?=20 Thomas --===============7300032612017961356==-- From achim@jander.de Sat Jan 8 15:24:01 2011 From: Achim Jander <achim@jander.de> To: ntg-context@ntg.nl Subject: Re: [NTG-context] Fwd: Re: xml-processing: missing or ungrouped '=' Date: Sat, 08 Jan 2011 15:23:19 +0100 Message-ID: <4D287357.3000906@jander.de> In-Reply-To: <3DB8F220-B0CC-403D-A13C-E5B59C6DEA39@uni-bonn.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2683497079013731789==" --===============2683497079013731789== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Thomas, yes, of course you are right, but thats not making the problems. Its=20 switched in while making a "minimal" example. My problem or maxbe misunderstanding ist what I try to achieve with \xmldoifelse{#1}{/num}{ownnumber=3D\xmlcommand{#1}{/num}{xml:ueberForceFlush}= }{number=3Dno}=20 or in a more complex way: \startxmlsetups xml:title \startchapter[ %start here number=3D\xmldoifelse{#1}{/num}{yes}{no}, %works ownnumber=3D\xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceFlush}= }{},%works=20 %stop here title=3D{\xmlflush{#1}},%works ] \stopchapter \stopxmlsetups what I want to do is to process the part between %start here and %stop=20 here in another template which I can reuse in different hierarchies. But I cant find no way to do so. Greetings, Achim Am 08.01.2011 14:07, schrieb Thomas A. Schmitz: > On Jan 8, 2011, at 1:39 PM, Achim Jander wrote: > >> Hi Hans, >> sorry, i'll try to make it more clear: > Excuse me, your example makes my head spin. Just from looking at it, there = appears to be a fundamental error: you flush the content of<title> into a co= ntext \startchapter \stopchapter environment, AFAICS. But that's not right: t= he title is not the content of the chapter, but just its, errm, title. Can th= is be the reason why your code doesn't work? > > Thomas > ___________________________________________________________________________= ________ > If your question is of interest to others as well, please add an entry to t= he Wiki! > > maillist : ntg-context(a)ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-co= ntext > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___________________________________________________________________________= ________ > --===============2683497079013731789==-- From thomas.schmitz@uni-bonn.de Sat Jan 8 18:01:21 2011 From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de> To: ntg-context@ntg.nl Subject: Re: [NTG-context] Fwd: Re: xml-processing: missing or ungrouped '=' Date: Sat, 08 Jan 2011 18:00:59 +0100 Message-ID: <60F4B08E-CF99-4FE8-B8B0-0084F281BDB2@uni-bonn.de> In-Reply-To: <4D287357.3000906@jander.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5534336958899238528==" --===============5534336958899238528== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Jan 8, 2011, at 3:23 PM, Achim Jander wrote: > Hi Thomas, > yes, of course you are right, but thats not making the problems. Its switch= ed in while making a "minimal" example. > My problem or maxbe misunderstanding ist what I try to achieve with Sorry, but I still don't have the faintest idea what it is you want to do. Yo= ur minimal example doesn't show it, and your explanations differ from one mes= sage to the next.=20 In one of your mails, you said this: > If the title comes with an number-element I want to set ownnumber=3D..., b= ut if they have no numbers, I want to set number=3Dno If this is what you're looking for, here's what I would suggest: \startbuffer[test] <a> <chapter title=3D"some text"> <b>more text </b> <b>more text </b> </chapter> <chapter num=3D"333" title=3D"more text"> <b>more text </b> <b>more text </b> </chapter> </a> \stopbuffer \startxmlsetups xml:testsetups \xmlsetsetup{\xmldocument}{a|b|chapter}{xml:*} \stopxmlsetups \xmlregistersetup{xml:testsetups} \startxmlsetups xml:a \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:b \startparagraph \xmlflush{#1} \stopparagraph \stopxmlsetups \startxmlsetups xml:chapter \doifelse {\xmlatt{#1}{num}} {} {\setuphead[chapter][number=3Dno] \startchapter[title=3D{\xmlatt{#1}{title}}] \xmlflush{#1} \stopchapter} {\setuphead[chapter][number=3Dyes] \setupheadnumber[chapter][\xmlatt{#1}{num}] \startchapter[title=3D{\xmlatt{#1}{title}}]=20 \xmlflush{#1} \stopchapter} \stopxmlsetups \starttext \xmlprocessbuffer{main}{test}{} \stoptext It's trivial to change the test from an attribute to a <num> element>, but ma= ybe that's not what you're looking for... Thomas --===============5534336958899238528==-- From achim@jander.de Sun Jan 9 12:06:29 2011 From: Achim Jander <achim@jander.de> To: ntg-context@ntg.nl Subject: Re: [NTG-context] Fwd: Re: xml-processing: missing or ungrouped '=' Date: Sun, 09 Jan 2011 12:05:57 +0100 Message-ID: <4D299695.7070904@jander.de> In-Reply-To: <60F4B08E-CF99-4FE8-B8B0-0084F281BDB2@uni-bonn.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2797463790165198126==" --===============2797463790165198126== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi Thomas, sorry, I dont want to bother you. But in fact that is not what I'm=20 looking for. Maybe its my fault that I mixed a - as I thougt - related=20 problem in my second mail. What I try to do is reduce redundancy. I cannot see where my=20 explanations differ. In fact, I started with something like your=20 example. But from a redundancy point of view thats a mess so I tried to improve it. I came to something like \startxmlsetups xml:chapter \startchapter[ title=3D{\xmlatt{#1}{title}}, number=3D\xmldoifelse{#1}{./attribute('num')}{yes}{no}, ownnumber=3D\xmldoifelse{#1}{./attribute('num')}{\xmlatt{#1}{num}}{} ] \xmlflush{#1} \stopchapter \stopxmlsetups which works fine and at least in my eyes has a clearer structure, but=20 still some redundancy. Now is the point where I think the=20 misunderstandings started, because now I tried two different approaches to decrease redundancy: First step i tried to simplyfy *this* setup and=20 came to something like \startxmlsetups xml:chapter \startchapter[ title=3D{\xmlatt{#1}{title}}, =20 \xmldoifelse{#1}{./attribute('num')}{ownnumber=3D\xmlatt{#1}{num}}{number=3Dn= o}, ] \xmlflush{#1} \stopchapter \stopxmlsetups which would nicely eliminate every redundance but doesn't work and=20 complains about the mystery "missing or ungrouped '=3D'" The other attempt was - though i have not only to deal with chapters but=20 up to about 15 hierarchies, all structured in a similar way, so I tried to delegate the processing like \startxmlsetups xml:fillTitleAtts title=3D{\xmlatt{#1}{title}}, number=3D\xmldoifelse{#1}{./attribute('num')}{yes}{no}, ownnumber=3D\xmldoifelse{#1}{./attribute('num')}{\xmlatt{#1}{num}}{} \stopxmlsetups \startxmlsetups xml:chapter \startchapter[ \xmlcommand{#1}{.}{xml:fillTitleAtts} ] \xmlflush{#1} \stopchapter \stopxmlsetups which would be nicely reusable but that attempt failed whith the same=20 error message - thus I thought they are related. I have to mention, that I try not to process one file but to write=20 setups for a bunch of similar but slightly different books (we're doing=20 about 1000 books per year), so my setups have to be clearly structured and easyly adaptable to=20 different needs. I dunno if that can clear up things, if not, I think its not worth much=20 more discussion. Thanks, Achim Am 08.01.2011 18:00, schrieb Thomas A. Schmitz: > On Jan 8, 2011, at 3:23 PM, Achim Jander wrote: > >> Hi Thomas, >> yes, of course you are right, but thats not making the problems. Its switc= hed in while making a "minimal" example. >> My problem or maxbe misunderstanding ist what I try to achieve with > Sorry, but I still don't have the faintest idea what it is you want to do. = Your minimal example doesn't show it, and your explanations differ from one m= essage to the next. > > In one of your mails, you said this: > >> If the title comes with an number-element I want to set ownnumber=3D..., = but if they have no numbers, I want to set number=3Dno > If this is what you're looking for, here's what I would suggest: > > \startbuffer[test] > <a> > <chapter title=3D"some text"> > <b>more text</b> > <b>more text</b> > </chapter> > <chapter num=3D"333" title=3D"more text"> > <b>more text</b> > <b>more text</b> > </chapter> > </a> > \stopbuffer > > \startxmlsetups xml:testsetups > \xmlsetsetup{\xmldocument}{a|b|chapter}{xml:*} > \stopxmlsetups > > \xmlregistersetup{xml:testsetups} > > \startxmlsetups xml:a > \xmlflush{#1} > \stopxmlsetups > > \startxmlsetups xml:b > \startparagraph > \xmlflush{#1} > \stopparagraph > \stopxmlsetups > > \startxmlsetups xml:chapter > \doifelse {\xmlatt{#1}{num}} {} > {\setuphead[chapter][number=3Dno] > \startchapter[title=3D{\xmlatt{#1}{title}}] > \xmlflush{#1} > \stopchapter} > {\setuphead[chapter][number=3Dyes] > \setupheadnumber[chapter][\xmlatt{#1}{num}] > \startchapter[title=3D{\xmlatt{#1}{title}}] > \xmlflush{#1} > \stopchapter} > \stopxmlsetups > > \starttext > \xmlprocessbuffer{main}{test}{} > \stoptext > > It's trivial to change the test from an attribute to a<num> element>, but = maybe that's not what you're looking for... > > Thomas > ___________________________________________________________________________= ________ > If your question is of interest to others as well, please add an entry to t= he Wiki! > > maillist : ntg-context(a)ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-co= ntext > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___________________________________________________________________________= ________ > --===============2797463790165198126==--