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
___________________________________________________________________________________