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
___________________________________________________________________________________
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
___________________________________________________________________________________