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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14411 invoked from network); 10 Aug 2023 08:16:26 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 10 Aug 2023 08:16:26 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id B74AB482201 for ; Thu, 10 Aug 2023 10:16:23 +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 oItFrCQjaCWO for ; Thu, 10 Aug 2023 10:16:22 +0200 (CEST) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 470B04824F7 for ; Thu, 10 Aug 2023 10:14:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id CD25C48159D for ; Thu, 10 Aug 2023 10:14:12 +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 YpQhlwIi8kUE for ; Thu, 10 Aug 2023 10:14:12 +0200 (CEST) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 5A9F448156F for ; Thu, 10 Aug 2023 10:14:12 +0200 (CEST) Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-4055bc3cdd8so4293801cf.1 for ; Thu, 10 Aug 2023 01:14:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691655251; x=1692260051; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=bomonAJJlmD3QfbMSqIhNbAjJFdG5yjG4BgvycPoR/E=; b=Iw6SJ9Tk+r3WVa6/yQ7Vkn5Km291CNKIsg2h9QfG09a7WZ9/syuXb/BiQhl7Bpok3y PS6fp/+s0nQAdRDaC6CDQlXA/3rrSqe8U73fa9JifjVRiLlQmnSNukcLjS65Yx5SAlET 0des5EiRUDV+68kSYzsB+pM9aanq3Q2sh/ZItslmz5F8BOinKiswh90j8PDo7AYDOzWr 3OizUYUmhPn7ogtpcaQ5U7RucnbEb9B6nCrBqwtvtlMg4Zo3iWVyn3/U811T6rTylTGl Ja61CDptsy7bGPgSneFHzC9wDiNGbCFyzutLYUDas847PVzossG5cVZOqCn8qzdg9xrz g2mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691655251; x=1692260051; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bomonAJJlmD3QfbMSqIhNbAjJFdG5yjG4BgvycPoR/E=; b=KMnNbnnjyNYEwlXDqdEjPYvmvIYcKAYmJ6DiILjDs/k6EURjKRv1WTFaj5AJ/SlUhR qmoB2IMOA1SfhhMW/Zq1pmscwrR6zs357c+bQ9ZRib94EaKHhkqLVlY5aNMvHPMzBOLC xbfbz4YTQl2Nkk3TPIziNqwpbfP4nXwKF40P6KqAO7tHvRXqJmxXnd/pFtivo0yEOXQ+ QbFhCWsDuYVvUiijHqLHVZQJjknBe0OF8xKApH6KwRnJ+fHuBFMJ+/h/ViyOp4nAXrys XXXwgZvqsKb54dMJPSr4beNNdycySJZlM+thuZeGNRwqH9HEnhvrVnIktowdZMrNo84k gb4A== X-Gm-Message-State: AOJu0Yw6oiATLI6Bvo4oEujPpS0tGs6rtvV69eTuR7xgIxoTGeIx6MF9 xUh1BneT0i6Tz8liPqIW2sg7YT/5RUFEju1S/lTRqQTpdSc= X-Google-Smtp-Source: AGHT+IHW0Cvq1i+JQJRpx97i1WejN/ER8i2SYwPy2cj40aQOsQKg9BniP5wZ1l+rX7gD4utyu5b/mtMH+bj+yraGU/o= X-Received: by 2002:ac8:5c06:0:b0:40f:ef6d:1a3f with SMTP id i6-20020ac85c06000000b0040fef6d1a3fmr2232822qti.30.1691655251000; Thu, 10 Aug 2023 01:14:11 -0700 (PDT) MIME-Version: 1.0 References: <89aff31c-5233-fba1-593a-27d8d56a3249@xs4all.nl> In-Reply-To: <89aff31c-5233-fba1-593a-27d8d56a3249@xs4all.nl> From: Thangalin Date: Thu, 10 Aug 2023 01:14:00 -0700 Message-ID: To: mailing list for ConTeXt users Message-ID-Hash: RPZBHTBY3YNZFQLPZHKJSH7EPNKVG5BY X-Message-ID-Hash: RPZBHTBY3YNZFQLPZHKJSH7EPNKVG5BY X-MailFrom: thangalin@gmail.com 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: Map XML attributes to variables, dynamically List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============6912741659220523679==" --===============6912741659220523679== Content-Type: multipart/alternative; boundary="0000000000005180bc06028d2e46" --0000000000005180bc06028d2e46 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Here's an MWE: % SOT \startbuffer[demo]
Different Text Goes Here
\stopbuffer \startxmlsetups xml:xhtml \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{html|body}{xml:*} \xmlsetsetup{\xmldocument}{div}{xml:*} \stopxmlsetups \xmlregistersetup{xml:xhtml} \startxmlsetups xml:html \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:body \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups \definestartstop[concurrent][ before=3D{TITLE: \xmlatt{\getvariable {div} {concurrent} {title}}}, ] \starttext \xmlprocessbuffer{main}{demo}{} \stoptext % EOT It doesn't look like the variables are taking, regardless of whether {title} or {data-title} are used. On Thu, Aug 10, 2023 at 12:44=E2=80=AFAM Hans Hagen wro= te: > On 8/10/2023 9:10 AM, Thangalin wrote: > > > Environments for the DIV element gets translated using: > > > > \startxmlsetups xml:div > > \setvariable {div} {\xmlatt{#1}{class}} {#1} > > > \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop > > \stopxmlsetups > > \setMPtext{1}{\usermap[concurrent.title]} > > \setMPtext{2}{\usermap[concurrent.location]} > > \setMPtext{1}{% > \xmlatt {\getvariable {div} {concurrent} {title}% > } > > > I can verify the attribute values exist by exporting them to the > document: > something like that .. untested as no mwe > > Hans > > ----------------------------------------------------------------- > 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 > > _________________________________________________________________________= __________ > --0000000000005180bc06028d2e46 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here's an MWE:

% SOT=
\startbuffer[demo]
<html>
<body>
<= div class=3D"concurrent" data-title=3D"Berth 5" data-lo= cation=3D"San Diego">
Text Goes Here
</div>
<= ;div class=3D"concurrent" data-title=3D"Road" data-loca= tion=3D"Beale AFB">
Different Text Goes Here
</div>= ;
</body>
</html>
\stopbuffer

\startxmlsetups x= ml:xhtml
=C2=A0 \xmlsetsetup{\xmldocument}{*}{-}
=C2=A0 \xmlsetsetup{= \xmldocument}{html|body}{xml:*}
=C2=A0 \xmlsetsetup{\xmldocument}{div}{x= ml:*}
\stopxmlsetups

\xmlregistersetup{xml:xhtml}

\startxm= lsetups xml:html
=C2=A0 \xmlflush{#1}
\stopxmlsetups

\startxml= setups xml:body
=C2=A0 \xmlflush{#1}
\stopxmlsetups

\startxmls= etups xml:div
=C2=A0 \setvariable{div}{\xmlatt{#1}{class}}{#1}
=C2=A0= \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop
\stopxmlsetups

\def= inestartstop[concurrent][
=C2=A0 before=3D{TITLE: \xmlatt{\getvariable {= div} {concurrent} {title}}},
]

\starttext
=C2=A0 \xmlprocessbu= ffer{main}{demo}{}
\stoptext
% EOT

It doesn't look like the variables are taking, regardless of whether= {title} or {data-title} are used.

On Thu, Aug 10, 2023 at 12:44= =E2=80=AFAM Hans Hagen <j.hagen@xs4= all.nl> wrote:
On 8/10/2023 9:10 AM, Thangalin wrote:

> Environments for the DIV element gets translated using:
>
> \startxmlsetups xml:div

\setvariable {div} {\xmlatt{#1}{class}} {#1}

>=C2=A0 =C2=A0 \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop
> \stopxmlsetups
> \setMPtext{1}{\usermap[concurrent.title]}
> \setMPtext{2}{\usermap[concurrent.location]}

\setMPtext{1}{%
=C2=A0 =C2=A0\xmlatt {\getvariable {div} {concurrent} {title}%
}

> I can verify the attribute values exist by exporting them to the docum= ent:
something like that .. untested as no mwe

Hans

-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 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 t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / https://www.ntg.nl/mailman/listinfo/= ntg-context
webpage=C2=A0 : https://www.pragma-ade.nl / http://context.aanhet.net
archive=C2=A0 :
https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: https://contextgarden.net
___________________________________________________________________________= ________
--0000000000005180bc06028d2e46-- --===============6912741659220523679== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============6912741659220523679==--