From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/59429 Path: news.gmane.org!not-for-mail From: "H. van der Meer" Newsgroups: gmane.comp.tex.context Subject: presence of xml-attribute Date: Tue, 8 Jun 2010 12:42:57 +0200 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset="us-ascii"; Format="flowed"; DelSp="yes" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1275993868 19205 80.91.229.12 (8 Jun 2010 10:44:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 8 Jun 2010 10:44:28 +0000 (UTC) To: NTG ConTeXt Original-X-From: ntg-context-bounces@ntg.nl Tue Jun 08 12:44:25 2010 connect(): No such file or directory 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 1OLwIB-0001mw-SQ for gctc-ntg-context-518@m.gmane.org; Tue, 08 Jun 2010 12:44:23 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AB63BC9CE0; Tue, 8 Jun 2010 12:44:23 +0200 (CEST) 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 NhWLFF0vGln8; Tue, 8 Jun 2010 12:44:23 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id EB190C9CEB; Tue, 8 Jun 2010 12:43:56 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0E2F6C9CE0 for ; Tue, 8 Jun 2010 12:43:56 +0200 (CEST) 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 mCc9G2ZuEn29 for ; Tue, 8 Jun 2010 12:43:51 +0200 (CEST) Original-Received: from smtp-vbr12.xs4all.nl (smtp-vbr12.xs4all.nl [194.109.24.32]) by balder.ntg.nl (Postfix) with ESMTP id 21588C9CDD for ; Tue, 8 Jun 2010 12:43:49 +0200 (CEST) Original-Received: from [192.168.178.23] (a82-95-102-36.adsl.xs4all.nl [82.95.102.36]) (authenticated bits=0) by smtp-vbr12.xs4all.nl (8.13.8/8.13.8) with ESMTP id o58Ahm1f035163 for ; Tue, 8 Jun 2010 12:43:49 +0200 (CEST) (envelope-from havdmeer@xs4all.nl) X-Mailer: Apple Mail (2.936) X-Virus-Scanned: by XS4ALL Virus Scanner 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:59429 Archived-At: In order to differentiate between the case of an absent or an empty attribute on an xml-element I now use the following macro to set a TeX- \if: % #1=node #2=attribute #3 defaultvalue: execute \attributetrue/false \def\setFlagToAttribute#1#2#3{% \doifnot{\xmlattdef{#1}{#2}{NOTPRESENT}}{NOTPRESENT}% {\doifelse{\xmlatt{#1}{#2}}{\empty}% {\xmlvalue{choice}{#3}{\iftrue}}% {\xmlvalue{choice}{\xmlatt{#1}{#2}}{\iftrue}}% \csname#2true\endcsname\else\csname#2false\endcsname\fi }% } I find the use of the NOTPRESENT not very elegant. Is there a path expression and function that can tell the presence or absence of an attribute, just as its value can be filtered with a/b[@option==value]? Hans van der Meer ___________________________________________________________________________________ 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 ___________________________________________________________________________________