From: <denis.maier@unibe.ch>
To: <ntg-context@ntg.nl>
Subject: [NTG-context] Re: ifxmlselfempty
Date: Mon, 4 Sep 2023 08:05:06 +0000 [thread overview]
Message-ID: <ZRAP278MB0495B9FC76411883157A90F683E9A@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <054249B9-2DAB-4863-B3F7-CBB6DE8CFEDF@ziggo.nl>
[-- Attachment #1.1: Type: text/plain, Size: 1698 bytes --]
IDK. But why do have a setup for <something>, which does not appear in your xml source (shouldn't it be <what>?)?
Von: Hans van der Meer via ntg-context <ntg-context@ntg.nl>
Gesendet: Sonntag, 3. September 2023 14:11
An: NTG ConTeXt <ntg-context@ntg.nl>
Cc: Hans van der Meer <havdmeer@ziggo.nl>
Betreff: [NTG-context] ifxmlselfempty
Is it possible that the new \ifxmlselfempty has reversed its outcome? Or did I something wrong in this MWE?
Here an MWE.
yours sincerely
dr. Hans van der Meer
\startbuffer[test]
<what>
<emptynode value="!empty node!"/>
<notemptynode>!not empty node!</notemptynode>
</what>
\stopbuffer
\startxmlsetups xml:mysetups
\xmlsetsetup{\xmldocument}{something|emptynode|notemptynode}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:mysetups}
\startxmlsetups xml:emptynode
node=\xmltag{#1}:\crlf
ifxmlselfempty-else-fi:\space
\ifxmlselfempty{#1}
attribute = \xmlatt{#1}{value}
\else
content = \xmlflush{#1}
\fi
\crlf
ifxmlselfempty-else-fi reversed:\space
\ifxmlselfempty{#1}
content = \xmlflush{#1}
\else
attribute = \xmlatt{#1}{value}
\fi
\blank
\stopxmlsetups
\startxmlsetups xml:notemptynode
node=\xmltag{#1}:\crlf
ifxmlselfempty-else-fi:\space
\ifxmlselfempty{#1}
attribute = \xmlatt{#1}{value}
\else
content = \xmlflush{#1}
\fi
\crlf
ifxmlselfempty-else-fi reversed:\space
\ifxmlselfempty{#1}
content = \xmlflush{#1}
\else
attribute = \xmlatt{#1}{value}
\fi
\blank
\stopxmlsetups
\startxmlsetups xml:something
\xmlall{#1}{./emptynode}\blank
\xmlall{#1}{./notemptynode}\blank
\stopxmlsetups
\starttext
\ConTeXt\ \contextversion\blank
\xmlprocessbuffer{main}{test}{}
\stoptext
[-- Attachment #1.2: Type: text/html, Size: 10340 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2023-09-04 8:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-03 12:11 [NTG-context] ifxmlselfempty Hans van der Meer via ntg-context
2023-09-04 8:05 ` denis.maier [this message]
2023-09-04 18:20 ` [NTG-context] ifxmlselfempty Hans van der Meer via ntg-context
2023-09-04 18:28 ` Hans Hagen
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=ZRAP278MB0495B9FC76411883157A90F683E9A@ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM \
--to=denis.maier@unibe.ch \
--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).