On 2/25/2017 8:24 PM, Thomas A. Schmitz wrote:
Hans,
thanks for your efforts and your help - but I need a lua solution because I have to process my document in lua tables.
then you can just use xml.attribute (or lxml.attribute)
Thanks
Thomas
On 02/25/2017 07:30 PM, Hans Hagen wrote:
\startbuffer[test] <document> <chapter title="OneC"> <section title="OneS"> <subsection title="OneSS"> Text </subsection> </section> </chapter> <chapter title="TwoC"> <subsection title="OneSS"> Text </subsection> </chapter> </document> \stopbuffer
\startxmlsetups xml:test:setups \xmlsetsetup{\xmldocument}{*}{xml:*} \stopxmlsetups
\xmlregistersetup{xml:test:setups}
\startxmlsetups xml:document \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:chapter \blank[2*big] CHAPTER: \xmlattribute{#1}{.}{title}\blank \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:section \blank SECTION: \xmlattribute{#1}{.}{title} \blank\relax (previous:\xmlattribute{#1}{..[tag()='chapter']}{title}) \blank \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:subsection \blank SUBSECTION: \xmlattribute{#1}{.}{title} \blank\relax \blank (previous:\xmlattribute{#1}{..[tag()='section' or tag()='chapter']}{title}) \blank \xmlflush{#1} \stopxmlsetups
\xmlprocessbuffer{main}{test}{}
\stoptext
___________________________________________________________________________________
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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------