![](https://secure.gravatar.com/avatar/d0e94fb08d4620cfbd2f8f59a7868637.jpg?s=120&d=mm&r=g)
Hi all, one of my favorite topics… Here is a minimal example which shows something that I don't understand: when I process the subsection with the lua code, I want to get the value of the current section's "label" attribute in xml.attribute(r, "../../section", "label", "X"). So i was expecting that lua would go up (../../) and fetch the current section's label. But if you run the example, you see that it actually always gets the first section's label (value is always 1). How can I get the current section's label with a lua function? THanks and all best Thomas \startbuffer[test] <chapter> <section label="1"> <subsection label="1"> <content> text 1.1 </content> </subsection> </section> <section label="3"> <subsection label="1"> <content> text 3.1 </content> </subsection> <subsection label="5"> <content> text 3.5 </content> </subsection> </section> </chapter> \stopbuffer \startxmlsetups xml:testsetups \xmlsetsetup{\xmldocument}{chapter|section|subsection|content}{xml:*} \stopxmlsetups \xmlregistersetup{xml:testsetups} \startxmlsetups xml:chapter \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:section \xmlflush{#1} \par \stopxmlsetups \startxmlsetups xml:subsection \xmlfunction{#1}{test} \stopxmlsetups \startluacode outfile = io.open('temp.tmp', 'w') function xml.functions.test(r) content = xml.text(r, "content") section = xml.attribute(r, "../../section", "label", "X") context("This ") context(content) context(" is in section ") context(section) end \stopluacode \starttext \xmlprocessbuffer{main}{test}{} \enabletrackers[context.trace] \xmlshow{main} \stoptext