ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* xml in lua: how to say "ancestor"?
@ 2017-02-25 16:18 Thomas A. Schmitz
  2017-02-25 18:30 ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas A. Schmitz @ 2017-02-25 16:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-03-04  9:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-25 16:18 xml in lua: how to say "ancestor"? Thomas A. Schmitz
2017-02-25 18:30 ` Hans Hagen
2017-02-25 19:24   ` Thomas A. Schmitz
2017-02-25 20:10     ` Hans Hagen
2017-02-25 20:35       ` Thomas A. Schmitz
2017-02-25 20:49         ` Hans Hagen
2017-02-25 21:15           ` Thomas A. Schmitz
2017-03-03 16:47           ` Thomas A. Schmitz
2017-03-04  9:37             ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).