Hi all,
no real example, just snippets, sorry: I need to process xml documents
in lua (because I want to collect information in tables). The structure
is a bit irregular:
<document>
<chapter title="One">
<section title="One">
<subsection title="One">
Text
</subsection>
</section>
</chapter>
<chapter title="Two">
<subsection title="One">
Text
</subsection>
</chapter>
</document>
So chapters may or may not have sections. If, on the level of my
subscetions, I want to extract the information of the chapter title, in
a ConTeXt environment, I could say
\xmlattribute{#1}{ancestor::chapter}{title}. How could I do the same in
lua? I have something like
xml.attribute(e, "../../chapter", "title", "")
but that only works for the first case, not the second one. I tried to
understand the lpegs in lxml-lpt.lua, but didn't succeed.
Thanks, and best wishes
Thomas