From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/114847 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Duncan Hothersall via ntg-context Newsgroups: gmane.comp.tex.context Subject: XML: calculations on attribute values before output Date: Wed, 4 May 2022 21:10:07 +0100 Message-ID: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9065662120078014957==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5253"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Duncan Hothersall To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed May 04 22:11:14 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nmLL8-00018z-IE for gctc-ntg-context-518@m.gmane-mx.org; Wed, 04 May 2022 22:11:14 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 35C5E288AE6; Wed, 4 May 2022 22:10:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gIGJliU_Nhgl; Wed, 4 May 2022 22:10:30 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4C928289C1C; Wed, 4 May 2022 22:10:30 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D9973289DCE for ; Wed, 4 May 2022 22:10:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xMNECSoHkD9c for ; Wed, 4 May 2022 22:10:27 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.167.50; helo=mail-lf1-f50.google.com; envelope-from=dh@capdm.com; receiver= Original-Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id CD759288AE6 for ; Wed, 4 May 2022 22:10:26 +0200 (CEST) Original-Received: by mail-lf1-f50.google.com with SMTP id bq30so4218967lfb.3 for ; Wed, 04 May 2022 13:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=capdm.com; s=google; h=mime-version:from:date:message-id:subject:to; bh=+uWS0Zbssl2RMvYW2RIwWHADVtBP2WAavw1/tR1cILk=; b=qazKdTANj54bf4apNhIdxb++X75tcWc1irMBNk3okxnZs32nlF1FKhj3aa6XLZ4a4T iCX8/JaGyBiyy2KDEqgYxiDK1GbCtztYFqqbrCK4/2eEHoLcSsymPGM27DS0lu6jTGml 8CViaO/dSSZhkK1IDOGx9fxRGlc/E4P8/D3zQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=+uWS0Zbssl2RMvYW2RIwWHADVtBP2WAavw1/tR1cILk=; b=tunYVHAa6Gns4x6jskaQlVaszUZzQNTU6qpVOCn4ItFXHTFoCr+xUGD7PAoDFw6scZ 8W3G8Hvti/FAfvAyNSrQTMR6bzqnfRoRZNrHddZJfgUA/IWopu6loW1xTuXcNJHspXsj hJuVHoJNXOGjClJNT6rEk3u2YxY2WO2VTz9h8wM6eNv0DZJ3N5JhdkD92t6WkhWLaL/m UiLS1YQDRp6VY+D5P1Wpsp2nI4juPvg+1yaUPDeRW9L9fsXzim0rhV75YDF45/5QXPQh N/anGm2ViH0tDsFz0PqFrn+LaLKRT8z0D/DF0uO6bCLNOMbOVNJIAXRfomPaLxsDirEA otog== X-Gm-Message-State: AOAM5325n2DS5dAJ4MNq977j+J1OvwXfhKJqBkfw6mrBnMoRk5rZWFKf l7fQwBRkl6KtnFEiDqQpulpyH9xEmAuZlOQjIz6wnHXkpB0trYyw X-Google-Smtp-Source: ABdhPJyzzQrFE7lMc47ljfQKw8FK0icsU9dgoVJQHHjf5ZTwN1SboW4cPnnexNtksZRa4ZVMAVRWwQQ99ZNAfoLc67I= X-Received: by 2002:a19:4f53:0:b0:472:1714:61f1 with SMTP id a19-20020a194f53000000b00472171461f1mr15110794lfk.473.1651695023701; Wed, 04 May 2022 13:10:23 -0700 (PDT) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:114847 Archived-At: --===============9065662120078014957== Content-Type: multipart/alternative; boundary="0000000000002a61e205de35375b" --0000000000002a61e205de35375b Content-Type: text/plain; charset="UTF-8" Hi. I'm processing an XML table and need to set a row span. Because we use a variant of the CALS table model, spans are defined by an attribute saying how many *additional* rows should be spanned, as opposed to how many *in total*. So to translate this into TABLE \bTD[nr=X] syntax I need to add 1. I'm guessing this is very easily doable (in lua?) but I've tried various permutations and can't work it out. If anyone could give me a pointer that would be great. (In reality I'm going to need to handle lots of other conversions of attribute values into \bTD[...] commands, so if there's a generalised way of doing that sort of thing, or even better if someone has already tackled CALS tables in this way, that would also be great!) MWE below, but obviously it just passes the morerows="1" value straight through into \bTD[nr=1] so it doesn't give me a row span at all. Thanks in advance. Duncan ------ \startbuffer[demo] 1 2 3 \stopbuffer \startxmlsetups xml:demo:base \xmlsetsetup{#1}{*}{xml:demo:*} \stopxmlsetups \xmlregisterdocumentsetup{demo}{xml:demo:base} \startxmlsetups xml:demo:informaltable \bTABLE \xmlflush{#1} \eTABLE \stopxmlsetups \startxmlsetups xml:demo:tgroup \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:demo:tbody \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:demo:row \bTR \xmlflush{#1} \eTR \stopxmlsetups \startxmlsetups xml:demo:entry \bTD[nr=\xmlattdef{#1}{morerows}{1}] \xmlflush{#1} \eTD \stopxmlsetups \setupbodyfont[modern] \starttext \xmlprocessbuffer{demo}{demo}{} \stoptext ------ --0000000000002a61e205de35375b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi.

I'm processing an XML table and= need to set a row span. Because we use a variant of the CALS table model, = spans are defined by an attribute saying how many *additional* rows should = be spanned, as opposed to how many *in total*. So to translate this into TA= BLE \bTD[nr=3DX] syntax I need to add 1.

I'm g= uessing this is very easily doable (in lua?) but I've tried various per= mutations and can't work it out. If anyone could give me a pointer that= would be great.

(In reality I'm going to need= to handle lots of other conversions of attribute values into \bTD[...] com= mands, so if there's a generalised way of doing that sort of thing, or = even better if someone has already tackled CALS tables in this way, that wo= uld also be great!)

MWE below, but obviously it ju= st passes the morerows=3D"1" value straight through into \bTD[nr= =3D1] so it doesn't give me a row span at all.

Thanks in advance.

Duncan

= ------

\startbuffer[demo]
<informaltable>=
=C2=A0<tgroup>
=C2=A0 <tbody>
=C2=A0 =C2=A0<row>= ;
=C2=A0 =C2=A0 <entry morerows=3D"1">1</entry>=C2=A0 =C2=A0 <entry>2</entry>
=C2=A0 =C2=A0</row>=C2=A0 =C2=A0<row>
=C2=A0 =C2=A0 <entry>3</entry>
= =C2=A0 =C2=A0</row>
=C2=A0 </tbody>
=C2=A0</tgroup>=
</informaltable>
\stopbuffer

\startxmlsetups xml:demo:b= ase
=C2=A0\xmlsetsetup{#1}{*}{xml:demo:*}
\stopxmlsetups

\xmlr= egisterdocumentsetup{demo}{xml:demo:base}

\startxmlsetups xml:demo:i= nformaltable
=C2=A0\bTABLE
=C2=A0 \xmlflush{#1}
=C2=A0\eTABLE
\= stopxmlsetups

\startxmlsetups xml:demo:tgroup
=C2=A0\xmlflush{#1}=
\stopxmlsetups

\startxmlsetups xml:demo:tbody
=C2=A0\xmlflush= {#1}
\stopxmlsetups

\startxmlsetups xml:demo:row
=C2=A0\bTR=C2=A0 \xmlflush{#1}
=C2=A0\eTR
\stopxmlsetups

\startxmlsetup= s xml:demo:entry
=C2=A0\bTD[nr=3D\xmlattdef{#1}{morerows}{1}]
=C2=A0 = \xmlflush{#1}
=C2=A0\eTD
\stopxmlsetups

\setupbodyf= ont[modern]
\starttext
\xmlprocessbuffer{demo}{demo}{}
\stoptext

------
--0000000000002a61e205de35375b-- --===============9065662120078014957== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============9065662120078014957==--