-----Ursprüngliche Nachricht----- Von: Hans Hagen
Gesendet: Freitag, 25. August 2023 09:06 An: Maier, Denis Christian (UB) ; mailing list for ConTeXt users Betreff: Re: [NTG-context] Re: xmldoif: checking for contents of attribute On 8/25/2023 8:22 AM, denis.maier@unibe.ch wrote:
Thanks for your help. I can use that, but why is this sort of double-checking necessary here?
because containsa in a function that has checking while find is just the lua find .. so i've added a check in that one too now but no upload
So, that would mean that the double checking is only necessary for find, not for contains. And indeed the example below works. Is that correct or are there any unwanted side-effects? \startxmlsetups xml:test \xmlsetsetup{#1}{*}{-} \xmlsetsetup{#1}{doc|element}{xml:*} \stopxmlsetups \xmlregisterdocumentsetup{test}{xml:test} \startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:element 1 \xmldoifelse{#1}{.[contains(@class,'abc')]}{Yes}{No} \par 2 \xmldoifelse{#1}{.[@class and find(@class,'abc')]}{Yes}{No} \par % runs, but no match \stopxmlsetups \startxmlsetups xml:whatever Yes \stopxmlsetups \startbuffer[test] <?xml version="1.0" encoding="UTF-8"?> <doc> <element class="abcdefg">Yes</element> <element>No</element> </doc> \stopbuffer \starttext \xmlprocessbuffer{test}{test}{} \stoptext