From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/109411 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jano Kula Newsgroups: gmane.comp.tex.context Subject: Re: Reverse traversing of xml.collected()? Date: Tue, 10 Nov 2020 15:06:31 +0100 Message-ID: References: <1F7C2FBF-C790-4FF9-86AD-01E8A1D0625D@rna.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7262768031315572263==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40769"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Nov 10 15:07:39 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcUJ8-000AVg-Gr for gctc-ntg-context-518@m.gmane-mx.org; Tue, 10 Nov 2020 15:07:38 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D90A61A9C8A; Tue, 10 Nov 2020 15:07:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id epaqa1UxnvNx; Tue, 10 Nov 2020 15:07:12 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E75211A9DE5; Tue, 10 Nov 2020 15:07:12 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 639541A9D00 for ; Tue, 10 Nov 2020 15:07:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vv5A5txwk4r5 for ; Tue, 10 Nov 2020 15:07:11 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.210.41; helo=mail-ot1-f41.google.com; envelope-from=jano.kula@gmail.com; receiver= Original-Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 943DB1A9C8A for ; Tue, 10 Nov 2020 15:07:11 +0100 (CET) Original-Received: by mail-ot1-f41.google.com with SMTP id k3so12560290otp.12 for ; Tue, 10 Nov 2020 06:07:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=wGW+9R13gTOMzlkFsbYNbb5INfKHadoVkjy9unpszZk=; b=BEx4cbv4FdztZb7hycBILXaGQRxJgzuxiCABY2Cbgs0ylfUaYkPJn347qdMbY2JDUw IVRD6NTW9vfHnXF1FWbirjtlatRpbq7zCxOxaJ0xytENDhvHHAA7addR0g7rHjdFWzzT /b5YXOsIq8T+DuiBQOs6rKetHFZ5VGMWOd6ts5anq25Qu5OlmZ4Onwq/45lZoQavlMcy 1BsuSWZtTrV+ijw6Hz0MNNV15pqaGcCzF6LXCNMlZy2edUGRwYAc8DIB9ghnkCe8jWs+ pCa6G1lZTp4qfhTkchW9j2i0sB3H5P564c06p7PyUWFqTYSGX7l+HNG81nQUcYQVVDd8 zA8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=wGW+9R13gTOMzlkFsbYNbb5INfKHadoVkjy9unpszZk=; b=DxDcQM6b1srfxwLYorN5AnSPbNGo/S46DGPVgxJBdPZaQ7MdsKITnS0zTesFs+6yqp AbFz2V2pBJWSTpiZJl4vpo6YfrtxLpD9CunZea/EuzEr0zI2MRYf8pbM8IywDIvExzLn ubV0n7yeBO234Lc6lzHlqrmVXGxauxx0jPiiItQgIjDciz2reOhoSWIbcj4bZ+dsVLey iFA0ElCdB9Ltm76qTV5yKhMl9aSDEMA5J2jEHubQ4xrEsUF76p0sQNljFpywRIj9Zk9q d4z6HfSZta3mqbUwvofVjZpPcFFn3xalHk4NpqS0Bnbc2cH3m9ctR+YgpqsGemOsb/Tm Lzxg== X-Gm-Message-State: AOAM531Pv+RlukRPog3TldVt5wEqgY5iB6Dye8V1PT9Gdau/GplIvFvJ enGg7HtZVgeIvAwujEpoI/z/pfBPBEOKxZxVETQ/v8yb8eiJMw== X-Google-Smtp-Source: ABdhPJxiqIk0U0SI2pxSB4RdSQFW3ZYRQ75AKq6N2DGoifljtrfD86NT62q+2CW3qmcomcitNvTfvgBlc6sWOvBoJiw= X-Received: by 2002:a9d:aa8:: with SMTP id 37mr14624388otq.286.1605017229418; Tue, 10 Nov 2020 06:07:09 -0800 (PST) In-Reply-To: <1F7C2FBF-C790-4FF9-86AD-01E8A1D0625D@rna.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:109411 Archived-At: --===============7262768031315572263== Content-Type: multipart/alternative; boundary="000000000000d164a505b3c131a9" --000000000000d164a505b3c131a9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello! On Fri, 1 May 2020 at 14:06, Gerben Wierda wrote: > > > On 1 May 2020, at 13:30, Hans Hagen wrote: > > On 5/1/2020 11:31 AM, Gerben Wierda wrote: > > I=E2=80=99d like to travese the contents of an xml.collected() in a rever= se 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 ... end Jano --000000000000d164a505b3c131a9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello!

On Fri, 1 May 2020 at 14:06, Gerben= Wierda <gerbe= n.wierda@rna.nl> wrote:


On 1 May 20= 20, at 13:30, Hans Hagen <j.hagen@xs4all.nl> wrote:

On 5/1/2020 11= :31 AM, Gerben Wierda wrote:
I=E2=80=99d like = to travese the contents of an xml.collected() in a reverse order.it's an iterator
What is the correct wa= y to do it?
xml.all

It had been awhile, so for the record.

I was looking for something similar and fou= nd out that adding a third argument to the xml.col= lected reverses the iterations. Looks like the argument has to be tr= ue in a boolean sense, so puting any "string" there will do the t= rick.

for v in xml.collec= ted(doc, "/chapter/section", "string") do
...
end

Jano

--000000000000d164a505b3c131a9-- --===============7262768031315572263== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============7262768031315572263==--