Have you looked at chapter 3.10 "Testing" of the manual xml-mkiv.pdf? There are a lot of commands there that should help you, such as \xmldoiftext {#1} {/mdata/date} {\bf \xmlflush {#1}} or \xmldoifelsetext. There's also \xmlfilter, which you can use to test for the content of tags. And of course, you can process in Lua and search for strings or use lpeg. However, your question is a bit vague now. Show us some code you have and we can take it from there; that's easier than writing the whole setup for you. Thomas On 8/21/23 17:29, Michael Löscher wrote:
Hello list,
having the xml data at the bottom, I would like to process it so that the result is like this:
--- What it is (e.g. bold formatted) date: 2023-08-01 (italic) Description (small font size) Another text (small font size)
hd1 - Header 1
§ 1 First (A first short description) AAAAAAAAAA BBBBBBBBBB
§ 2 Second (A second short description) CCCCCCCCCC DDDDDDDDDD
§ 3 Third (A third short description) EEEEEEEEEE FFFFFFFFFF ---
How can I process the <element>s differently? The first element contains a <date> tag and so it differs from the other ones. The second element's <name> tag contains the word "Header" which makes it different again. The other elements contain a <shortdescription> tag that they all have in common.
What could be the appropriate xml setups to generate the above output?
Michael
--- xml data: \startbuffer[xmlcontent] <?xml version="1.0" encoding="UTF-8" ?> <document> <element> <mdata> <name>What it is</name> <date>2023-08-01</date> </mdata> <tdata> <content> <p>Description</p> <p>Another text</p> </content> </tdata> </element> <element> <mdata> <num>hd1</num> <name>Header 1</name> </mdata> <tdata> <content> <p>Text of Header 1</p> </content> </tdata> </element> <element> <mdata> <num>1</num> <name>First</name> <shortdescription>A first short description</shortdescription> </mdata> <tdata> <content> <p>AAAAAAAAAA</p> <p>BBBBBBBBBB</p> </content> </tdata> </element> <element> <mdata> <num>2</num> <name>Second</name> <shortdescription>A second short description</shortdescription> </mdata> <tdata> <content> <p>CCCCCCCCCC</p> <p>DDDDDDDDDD</p> </content> </tdata> </element> <element> <mdata> <num>3</num> <name>Third</name> <shortdescription>A third short description</shortdescription> </mdata> <tdata> <content> <p>EEEEEEEEEE</p> <p>FFFFFFFFFF</p> </content> </tdata> </element> </document> \stopbuffer