From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28688 invoked from network); 24 Aug 2023 14:56:19 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 24 Aug 2023 14:56:19 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 005AA482BF9 for ; Thu, 24 Aug 2023 16:55:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A6DKvD56NXrr for ; Thu, 24 Aug 2023 16:55:06 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 13B39482C74 for ; Thu, 24 Aug 2023 16:54:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id E492B482A0E for ; Thu, 24 Aug 2023 16:54:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VGj1txNaDWAk for ; Thu, 24 Aug 2023 16:54:09 +0200 (CEST) Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 953314829B6 for ; Thu, 24 Aug 2023 16:54:09 +0200 (CEST) X-KPN-MessageId: 0e818d38-428e-11ee-849a-005056abad63 Received: from smtp.kpnmail.nl (unknown [10.31.155.40]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id 0e818d38-428e-11ee-849a-005056abad63; Thu, 24 Aug 2023 16:53:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=xs4all01; h=content-type:from:to:subject:mime-version:date:message-id; bh=RT0rt7az+Fp+zfr5iqdI/oEbv44HMVnjLPd2sBh+CuU=; b=N9UVPM21boqKPFY4t4mAXk7X1EQC5JlxaBwOWvW/h4uLBFu6us/jrI8+HniOlarNJG4Ahu9+a+hxf ELdodwXiwStSQKeaJPsg4SL5YIqwQ2m31V548/Krt+sBIXmYeZIwXzf+4wHYwgxrG0sm6LgjBs1DnY wMtyH/NAmPZKTJSFZ8q/UKc1faK76JULTu2+4X+xkbQi9WHOsAuxzDuw55KlYML7HWim3reEl79Ez5 3IjHceseKle35sl8DxRlXIpTqPsp96EGTNzbbQlYXO4OGeSBfNLaddElVYwaraGyNq2GezP3UNizYE 1t7Ch+/xSEwPWi/HLsYFhTC/dvbkqxw== X-KPN-MID: 33|LfhZbLfiHddH5J+bkNvgMblGkAOQKUB6J6nyGv9K019VSLNTOnpeUrOSUQwbiSn +NOCqZ7k88awl1IygeiKkZ4OKDzQec0OnGTssRHohI1Y= X-KPN-VerifiedSender: Yes X-CMASSUN: 33|MpL+x76RgZfDaTfMgmEQO9nwmLoIbtSX5LRfDM12SZJxw3C6WPjnhHn9ZxBaVjE 9NjSFMWsHFfF0mCiBnKwexw== X-Originating-IP: 213.125.29.162 Received: from [10.100.1.105] (d57d1da2.static.ziggozakelijk.nl [213.125.29.162]) by smtp.xs4all.nl (Halon) with ESMTPSA id 14780933-428e-11ee-93b6-005056ab7584; Thu, 24 Aug 2023 16:54:09 +0200 (CEST) Message-ID: Date: Thu, 24 Aug 2023 16:54:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Content-Language: en-US To: ntg-context@ntg.nl References: From: Hans Hagen In-Reply-To: Message-ID-Hash: GE2I3TK74XLLLOA75R5XJ3NV3RKVP3M6 X-Message-ID-Hash: GE2I3TK74XLLLOA75R5XJ3NV3RKVP3M6 X-MailFrom: j.hagen@xs4all.nl X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: xmldoif: checking for contents of attribute List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii"; format="flowed" Content-Transfer-Encoding: 7bit On 8/24/2023 4:11 PM, denis.maier@unibe.ch wrote: > Hi, > > I'm trying to check whether an attribute contains (or, actually starts with) a given string. > I've tried a whole bunch of different combinations, but I've had no luck so far. Minimal example below. Anyone has a hint? > > Best, > Denis > > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > \startxmlsetups xml:test > \xmlsetsetup{#1}{*}{-} > \xmlsetsetup{#1}{doc|element}{xml:*} > \stopxmlsetups > > \xmlregisterdocumentsetup{test}{xml:test} > > > \startxmlsetups xml:doc > \xmlflush{#1} > \stopxmlsetups > > \startxmlsetups xml:element > \xmlfilter{#1}{./find(attribute('class'), 'abc')/command(xml:whatever)} > > \xmldoifelse{#1}{./attribute('class')/contains('abc')} {Yes}{No} > \stopxmlsetups > > \startxmlsetups xml:whatever > Yes > \stopxmlsetups > > \startbuffer[test] > > > Yes > No > > \stopbuffer > > \starttext > > \xmlprocessbuffer{test}{test}{} > > \stoptext \xmldoifelse{#1}{.[@class and contains(@class,'abc')]}{Yes}{No} \xmldoifelse{#1}{.[@class and find(@class,"abc")]}{Yes}{No} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________