On 4/20/20 7:23 PM, Wolfgang Schuster wrote:
[...] The argument of the beforesection-key is placed before ConTeXt stores the values of \startsection which means you can do it this way.
What you can do here is to put whatever something in a macro before you call \startsection and access the value of this macro with the beforesection-key. You should ensure the content if this temporary macro is cleared when your conditional is false.
\setuphead [section] [beforesection=\getvariable{xml}{beforesection}]
\startxmlsetups xml:section
\doifelse{\xmlatt{#1}{id}}{\selectedtopic} {\setvariable{xml}{beforesection}{conditional}} {\setvariable{xml}{beforesection}{}}
\startsection[title={\xmlatt{#1}{id}}] \xmlflush{#1} \stopsection
\stopxmlsetups
Many thanks for your help, Wolfgang. Your sample works perfectly fine. Pablo -- http://www.ousia.tk