On 8/10/2023 10:37 AM, Hans Hagen wrote:
On 8/10/2023 10:14 AM, Thangalin wrote:
Here's an MWE:
% SOT \startbuffer[demo] <html> <body> <div class="concurrent" data-title="Berth 5" data-location="San Diego"> Text Goes Here </div> <div class="concurrent" data-title="Road" data-location="Beale AFB"> Different Text Goes Here </div> </body> </html> \stopbuffer
\startxmlsetups xml:xhtml \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{html|body}{xml:*} \xmlsetsetup{\xmldocument}{div}{xml:*} \stopxmlsetups
\xmlregistersetup{xml:xhtml}
\startxmlsetups xml:html \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:body \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups
\definestartstop[concurrent][ before={TITLE: \xmlatt{\getvariable {div} {concurrent} {title}}}, ]
\starttext \xmlprocessbuffer{main}{demo}{} \stoptext % EOT
It doesn't look like the variables are taking, regardless of whether {title} or {data-title} are used.
\startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups
\definestartstop [concurrent] [before={TITLE: \xmlatt{\getvariable{div}{concurrent}}{data-title}}]
-- watch the braces -- use data-title and not title
Hans You can actually do this:
\startxmlsetups xml:div \setupstartstop [\xmlatt{#1}{class}] [before={TITLE: \xmlatt{#1}{data-title}}]% \start[\xmlatt{#1}{class}]% \xmlflush{#1} \stop \stopxmlsetups \definestartstop [concurrent] and you then can also do \namedstartstopparameter{concurrent}{before} when needed, which save you the intermediate variable because it's already in before, so from that it's a natural step to \startxmlsetups xml:div \setupstartstop [\xmlatt{#1}{class}] [title=\xmlatt{#1}{data-title}, before={TITLE: \namedstartstopparameter{concurrent}{title}}]% \start[\xmlatt{#1}{class}]% \xmlflush{#1} \stop \stopxmlsetups \definestartstop [concurrent] and then with: \namedstartstopparameter{concurrent}{title} (i'll add this example to the test suite as demo) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------