But there is also
\ifxmlattempty{#1}{prefix} .. \else .. \fi

yours sincerely
dr. Hans van der Meer



On 17 Oct 2023, at 13:37, Taco Hoekwater <taco@bittext.nl> wrote:



On 17 Oct 2023, at 12:43, Michael Guravage <guravage@literatesolutions.com> wrote:

Hi,

I am typesetting a very simple address list whose source is written in XML.  Typesetting choices need to be made dependent on the presence of various attributes; consider the following <family> element.

<family surname="Boer" prefix="den">

If the prefix attribute exists I'l like the name to appear as, e.g. 'Boer, den."  The several XML attribute testing functions in the XML manual appear to discriminate on an attribute's value. I tried  \xmldoifnotatt in an attempt to say, "TRUE if prefix does not match an empty string",  since I am not interested in the attribute's value but only whether or not it exists. The code below doesn't work. If someone who knows why it doesn't work would enlighten my ignorance I would be most grateful. A brief explanation and example of \xmldoifatt, \xmldoifnotatt, and \xmldoifelseatt would be exceedingly helpful.

\startxmlsetups xml:list:family
 {\bf \xmlatt{#1}{surname} \xmldoifnotatt{#1, prefix, ''} {, \xmlatt{#1}{prefix}}} \crlf


Syntax error there, you need:

 \xmldoifnotatt{#1}{prefix}{}{, \xmlatt{#1}{prefix}}

Best wishes,
Taco
___________________________________________________________________________________
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
___________________________________________________________________________________