ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Pablo Rodriguez <oinos@gmx.es>
Subject: [NTG-context] Re: expanded doif's
Date: Mon, 17 Jun 2024 18:55:58 +0200	[thread overview]
Message-ID: <75055291-bb43-4b53-9333-59d240bee0b7@gmx.es> (raw)
In-Reply-To: <70c27b56-aeae-9f99-80db-94eb06fb0410@gmail.com>

On 6/17/24 16:52, Wolfgang Schuster wrote:
> Hans van der Meer schrieb am 17.06.2024 um 09:01:
>> I want to show an errormessage when the macro is undefined. It requires
>> expansion of \xmlatt{#1}{name}.

dr. van der Meer,

\xmldoifatt (with ifnot and ifelse variants) should cover that case
(https://www.pragma-ade.com/general/manuals/xml-mkiv.pdf#search=xmldoifatt).

But I cannot make any of these conditionals work (I‘m afraid there may
be an issue with their definition).

  \startbuffer[ifdefined]
  <document>
    <macro name="bold" arg="text"/>
    <macro name="hvdm" arg="text"/>
  </document>
  \stopbuffer

  \startxmlsetups xml:hvdm
    \xmlsetsetup{#1}{*}{xml:*}
  \stopxmlsetups

  \xmlregistersetup{xml:hvdm}

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

  \startxmlsetups xml:macro
    \xmlatt{#1}{name}\\
    \xmlatt{#1}{arg}\\
    \xmldoifelseatt{#1}
    {name}{yes}{no}\\
    \xmldoifelseatt{#1}
    {names}{yes}{no}\\
  \stopxmlsetups

  \starttext
  \xmlprocessbuffer{hvdm}{ifdefined}{}
  \stoptext

As a workaround \doifelsetext{\xmlatt{#1}{name}}{yes}{no} may do the
trick here.

I hope it helps,

Pablo
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2024-06-17 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-16 20:29 [NTG-context] " Hans van der Meer via ntg-context
2024-06-16 22:03 ` [NTG-context] " Wolfgang Schuster
     [not found]   ` <45BCE2B3-7B0E-4D7B-B164-BB610C5DF23F@ziggo.nl>
2024-06-17 14:52     ` Wolfgang Schuster
2024-06-17 16:55       ` Pablo Rodriguez via ntg-context [this message]
2024-06-18  9:38       ` Hans van der Meer via ntg-context

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=75055291-bb43-4b53-9333-59d240bee0b7@gmx.es \
    --to=ntg-context@ntg.nl \
    --cc=oinos@gmx.es \
    /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).