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}}}
        {\color[darkred]{NOTEMPTY: \xmlatt{#1}{important}}\par}
        {\color[darkblue]{EMPTY: \xmlflush{#1}\par}}
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext

Hints appreciated!

All best

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

Reply via email to