ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@bittext.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: Testing whether an XML attribute exists
Date: Tue, 17 Oct 2023 13:37:47 +0200	[thread overview]
Message-ID: <06B8FF89-A540-498E-86D8-D79ABCBD744B@bittext.nl> (raw)
In-Reply-To: <CAL-A5Lb2kGg1Hsn70Q6sBnucvzmbojpgveUmFASifbb9FANgag@mail.gmail.com>



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

  reply	other threads:[~2023-10-17 11:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 10:43 [NTG-context] " Michael Guravage
2023-10-17 11:37 ` Taco Hoekwater [this message]
2023-10-17 11:43   ` [NTG-context] " 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=06B8FF89-A540-498E-86D8-D79ABCBD744B@bittext.nl \
    --to=taco@bittext.nl \
    --cc=ntg-context@ntg.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).