On 13-12-2010 8:58, Thomas Schmitz wrote:
Hi all,
I thought I had done this and it was easy, but I can't find a solution:
I want to test whether a xml tag has an attribute and vary the typeset
content accordingly. There used to be \xmldoifelseempty, but that has
been commented out (lxml-ini.mkiv). What else could I use? Here's a
small test that shows what I'm trying to do:
\startbuffer[test]
<a>
<b>some text</b>
<b important="different">more text</b>
</a>
\stopbuffer
\startxmlsetups xml:testsetups
\xmlsetsetup{\xmldocument}{a|b}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:testsetups}
\startxmlsetups xml:a
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:b
\xmldoifelse{#1}{./[...@important]}
%\doifemptyelse{\expanded{\xmlatt{#1}{important}}}
something like this:
\doifelse {\xmlatt{#1}{important}} {} {
\color[darkblue]{EMPTY: \xmlflush{#1}}
} {
\color[darkred]{NOTEMPTY: \xmlatt{#1}{important}}
}
\par
or (untested): \xmldoifelse{#1}{./[...@important==''])
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________