ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: Hans Hagen via ntg-context <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: [NTG-context] Re: Map XML attributes to variables, dynamically
Date: Thu, 10 Aug 2023 10:55:08 +0200	[thread overview]
Message-ID: <ac47cb07-f94f-9536-3963-33b8b88c56bc@freedom.nl> (raw)
In-Reply-To: <4c0076c7-f9df-be56-afaf-518f9ef91796@freedom.nl>

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

On 8/10/2023 10:50 AM, Hans Hagen via ntg-context wrote:
> On 8/10/2023 10:37 AM, Hans Hagen wrote:
>> On 8/10/2023 10:14 AM, Thangalin wrote:
>>> Here's an MWE:
attached the more final version


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

[-- Attachment #2: variables-001.tex --]
[-- Type: text/plain, Size: 1178 bytes --]

% follow up on mail discussion with T

\startbuffer[demo]
<html>
    <body>
        <div class="concurrent" data-title="Berth 5" data-location="San Diego">
            Text Goes Here
        </div>
        <div class="concurrent" data-title="Road" data-location="Beale AFB">
            Different Text Goes Here
        </div>
    </body>
</html>
\stopbuffer

\startxmlsetups xml:xhtml
    \xmlsetsetup{\xmldocument}{*}{-}
    \xmlsetsetup{\xmldocument}{html|body|div}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:xhtml}

\startxmlsetups xml:html
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:body
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:div
    \setupstartstop
        [\xmlatt{#1}{class}]
        [title=\xmlatt{#1}{data-title}]%
    \start[\xmlatt{#1}{class}]%
        \xmlflush{#1}
    \stop
    \blank
    used wherever needed: \namedstartstopparameter{concurrent}{title}
    \blank
\stopxmlsetups

\definestartstop
   [concurrent]
   [before=\startsection[title={TITLE: \namedstartstopparameter{concurrent}{title}}],
    after=\stopsection]%

\starttext
    \xmlprocessbuffer{main}{demo}{}
\stoptext

[-- Attachment #3: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

      reply	other threads:[~2023-08-10  8:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10  7:10 [NTG-context] " Thangalin
2023-08-10  7:43 ` [NTG-context] " Hans Hagen
2023-08-10  8:14   ` Thangalin
2023-08-10  8:37     ` Hans Hagen
2023-08-10  8:50       ` Hans Hagen via ntg-context
2023-08-10  8:55         ` Hans Hagen via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac47cb07-f94f-9536-3963-33b8b88c56bc@freedom.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@freedom.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).