ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans van der Meer via ntg-context <ntg-context@ntg.nl>
To: NTG ConTeXt <ntg-context@ntg.nl>
Cc: Hans van der Meer <havdmeer@ziggo.nl>
Subject: [NTG-context] Re: expanded doif's
Date: Tue, 18 Jun 2024 11:38:51 +0200	[thread overview]
Message-ID: <304BEEDD-ACC0-4EE9-B3F7-DA6DFB7128AD@ziggo.nl> (raw)
In-Reply-To: <70c27b56-aeae-9f99-80db-94eb06fb0410@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2539 bytes --]

Finally found the culprit. Macro call to restart reporting errors in the printed output residing at the wrong point in the code.
Again thanks for pointing out where it was not.

yours sincerely
dr. Hans van der Meer



> On 17 Jun 2024, at 16:52, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> 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}.
>> \ifdefined\xmlatt{#1}{name} didn't worked nor \expandafter\ifdefined
>> I thought of the expanding \doif's.
>> See the attached output of this xmlsetup attached.
>> \startxmlsetups hvdm:system:macrocall
>> %
>> \doifelsedefined{\xmlatt{#1}{name}}
>> {
>> %
>> %macro without argument
>> %
>> \ifxmlattempty{#1}{arg}
>> \begincsname\xmlatt{#1}{name}\endcsname
>> %
>> %macro with argument
>> %
>> \else
>> \begincsname\xmlatt{#1}{name}\endcsname{\xmlatt{#1}{arg}}
>> \fi
>> }
>> {
>> \ERROR{macro \xmlatt{#1}{name} is not defined}
>> }
>> \stopxmlsetups
> 
> I have no idea what's wrong in your code without a proper minimal example. As the example below shows you can use \doifelsedefined in combination with \xmlatt.
> 
> \startbuffer[ifdefined]
> <document>
>  <macro name="bold" arg="text"/>
>  <macro name="hvdm" arg="text"/>
> </document>
> \stopbuffer
> 
> \startxmlsetups xml:document
>  \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:macro
> 
>  \doifelsedefined{\xmlatt{#1}{name}}
>    {\texdefinition{\xmlatt{#1}{name}}{\xmlatt{#1}{arg}}}
>    {{\tttf macro \tex{\xmlatt{#1}{name}} not defined}}
> 
> % \ifcsname\xmlatt{#1}{name}\endcsname
> %   \lastnamedcs{\xmlatt{#1}{arg}}
> % \else
> %   %
> % \fi
> 
> \stopxmlsetups
> 
> \startxmlsetups xml:hvdm
> \xmlsetsetup{\xmldocument}{document|macro}{xml:*}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:hvdm}
> 
> \starttext
> \xmlprocessbuffer{hvdm}{ifdefined}{}
> \stoptext
> 
> Wolfgang
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 3406 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

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

      parent reply	other threads:[~2024-06-18  9:39 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
2024-06-18  9:38       ` Hans van der Meer 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=304BEEDD-ACC0-4EE9-B3F7-DA6DFB7128AD@ziggo.nl \
    --to=ntg-context@ntg.nl \
    --cc=havdmeer@ziggo.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).