Hi,
I’m trying to check whether an attribute contains (or, actually starts with) a given string.
I’ve tried a whole bunch of different combinations, but I’ve had no luck so far.
Minimal example below. Anyone has a hint?
Best,
Denis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\startxmlsetups xml:test
\xmlsetsetup{#1}{*}{-}
\xmlsetsetup{#1}{doc|element}{xml:*}
\stopxmlsetups
\xmlregisterdocumentsetup{test}{xml:test}
\startxmlsetups xml:doc
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:element
\xmlfilter{#1}{./find(attribute('class'), 'abc')/command(xml:whatever)}
\xmldoifelse{#1}{./attribute('class')/contains('abc')} {Yes}{No}
\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