[NTG-context] Reverse traversing of xml.collected()?

Jano Kula jano.kula at gmail.com
Tue Nov 10 15:06:31 CET 2020


On Fri, 1 May 2020 at 14:06, Gerben Wierda <gerben.wierda at rna.nl> wrote:

> On 1 May 2020, at 13:30, Hans Hagen <j.hagen at xs4all.nl> wrote:
> On 5/1/2020 11:31 AM, Gerben Wierda wrote:
> I’d like to travese the contents of an xml.collected() in a reverse order.
> it's an iterator
> What is the correct way to do it?
> xml.all
It had been awhile, so for the record.

I was looking for something similar and found out that adding a third
argument to the xml.collected reverses the iterations. Looks like the
argument has to be true in a boolean sense, so puting any "string" there
will do the trick.

for v in xml.collected(doc, "/chapter/section", "string") do

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20201110/6795592d/attachment.htm>

More information about the ntg-context mailing list