From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/65055 Path: news.gmane.org!not-for-mail From: Achim Jander Newsgroups: gmane.comp.tex.context Subject: Re: Fwd: Re: xml-processing: missing or ungrouped '=' Date: Sun, 09 Jan 2011 12:05:57 +0100 Message-ID: <4D299695.7070904@jander.de> References: <4D283A80.9090909@jander.de> <4D284759.6030802@wxs.nl> <4D285AEB.5080009@jander.de> <3DB8F220-B0CC-403D-A13C-E5B59C6DEA39@uni-bonn.de> <4D287357.3000906@jander.de> <60F4B08E-CF99-4FE8-B8B0-0084F281BDB2@uni-bonn.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1294571204 17412 80.91.229.12 (9 Jan 2011 11:06:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 9 Jan 2011 11:06:44 +0000 (UTC) Cc: "Thomas A. Schmitz" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jan 09 12:06:39 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pbt6Y-0005AR-CC for gctc-ntg-context-518@m.gmane.org; Sun, 09 Jan 2011 12:06:34 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6FCEACAA47; Sun, 9 Jan 2011 12:06:33 +0100 (CET) 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 wpv7377wFB8i; Sun, 9 Jan 2011 12:06:31 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id EEB70CA9CE; Sun, 9 Jan 2011 12:06:30 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C1C81CA9CE for ; Sun, 9 Jan 2011 12:06:29 +0100 (CET) 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 Dk4aJKSxJ8Md for ; Sun, 9 Jan 2011 12:06:27 +0100 (CET) Original-Received: from filter4-til.mf.surf.net (filter4-til.mf.surf.net [194.171.167.220]) by balder.ntg.nl (Postfix) with ESMTP id 69DBACA9C6 for ; Sun, 9 Jan 2011 12:06:27 +0100 (CET) Original-Received: from p15188155.pureserver.info (p15188155.pureserver.info [212.227.83.96]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p09B6Q2a004041 for ; Sun, 9 Jan 2011 12:06:26 +0100 Original-Received: (qmail 7968 invoked from network); 9 Jan 2011 12:06:26 +0100 Original-Received: from krlh-5f72d379.pool.mediaways.net (HELO ?192.168.1.43?) (95.114.211.121) by p15188155.pureserver.info with SMTP; 9 Jan 2011 12:06:26 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 In-Reply-To: <60F4B08E-CF99-4FE8-B8B0-0084F281BDB2@uni-bonn.de> X-Bayes-Prob: 0.5 (Score 0, tokens from: ) X-CanIt-Geo: ip=212.227.83.96; country=DE; region=01; city=Karlsruhe; latitude=49.0047; longitude=8.3858; http://maps.google.com/maps?q=49.0047,8.3858&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 05DRn6qO5 - 8427cced8c09 - 20110109 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.216 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:65055 Archived-At: Hi Thomas, sorry, I dont want to bother you. But in fact that is not what I'm looking for. Maybe its my fault that I mixed a - as I thougt - related problem in my second mail. What I try to do is reduce redundancy. I cannot see where my explanations differ. In fact, I started with something like your 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={\xmlatt{#1}{title}}, number=\xmldoifelse{#1}{./attribute('num')}{yes}{no}, ownnumber=\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 still some redundancy. Now is the point where I think the misunderstandings started, because now I tried two different approaches to decrease redundancy: First step i tried to simplyfy *this* setup and came to something like \startxmlsetups xml:chapter \startchapter[ title={\xmlatt{#1}{title}}, \xmldoifelse{#1}{./attribute('num')}{ownnumber=\xmlatt{#1}{num}}{number=no}, ] \xmlflush{#1} \stopchapter \stopxmlsetups which would nicely eliminate every redundance but doesn't work and complains about the mystery "missing or ungrouped '='" The other attempt was - though i have not only to deal with chapters but up to about 15 hierarchies, all structured in a similar way, so I tried to delegate the processing like \startxmlsetups xml:fillTitleAtts title={\xmlatt{#1}{title}}, number=\xmldoifelse{#1}{./attribute('num')}{yes}{no}, ownnumber=\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 error message - thus I thought they are related. I have to mention, that I try not to process one file but to write setups for a bunch of similar but slightly different books (we're doing about 1000 books per year), so my setups have to be clearly structured and easyly adaptable to different needs. I dunno if that can clear up things, if not, I think its not worth much 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 switched 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 message to the next. > > In one of your mails, you said this: > >> If the title comes with an number-element I want to set ownnumber=..., but if they have no numbers, I want to set number=no > If this is what you're looking for, here's what I would suggest: > > \startbuffer[test] > > > more text > more text > > > more text > more text > > > \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=no] > \startchapter[title={\xmlatt{#1}{title}}] > \xmlflush{#1} > \stopchapter} > {\setuphead[chapter][number=yes] > \setupheadnumber[chapter][\xmlatt{#1}{num}] > \startchapter[title={\xmlatt{#1}{title}}] > \xmlflush{#1} > \stopchapter} > \stopxmlsetups > > \starttext > \xmlprocessbuffer{main}{test}{} > \stoptext > > It's trivial to change the test from an attribute to a 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 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 > ___________________________________________________________________________________ > ___________________________________________________________________________________ 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 ___________________________________________________________________________________