From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/107157 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: Re: Reverse traversing of xml.collected()? Date: Fri, 1 May 2020 14:06:05 +0200 Message-ID: <1F7C2FBF-C790-4FF9-86AD-01E8A1D0625D@rna.nl> References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="===============1636797192845786267==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="77372"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Fri May 01 14:10:00 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 1jUUUS-000K0M-5U for gctc-ntg-context-518@m.gmane-mx.org; Fri, 01 May 2020 14:10:00 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3E1E1183148; Fri, 1 May 2020 14:06:11 +0200 (CEST) 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 H5NVhpxYD_9F; Fri, 1 May 2020 14:06:10 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 5E91E18375A; Fri, 1 May 2020 14:06:10 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D8CC218345C for ; Fri, 1 May 2020 14:06:09 +0200 (CEST) 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 QBc59BA5qBGr for ; Fri, 1 May 2020 14:06:07 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=213.125.118.53; helo=mail.rna.nl; envelope-from=gerben.wierda@rna.nl; receiver= Original-Received: from mail.rna.nl (mail.rna.nl [213.125.118.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 48767183148 for ; Fri, 1 May 2020 14:06:07 +0200 (CEST) Original-Received: from hermione.rna.nl (hermione.rna.nl [192.168.2.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.rna.nl (Postfix) with ESMTPSA id AFE6C3DF84E6; Fri, 1 May 2020 14:06:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1588334765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RaZAi+3dACo4O740ZhavDoNPrKIMBDya/HdwiFGC+co=; b=pZENAm9yPeiUPchJYqPn3O52QXw5JqcjLsf9pTyQ4WSti/cj8232FxU/rfrK++xWFGIGeU 8c+mgLZ8Qsh7OH94MUFaDpb2ks261VK079MNUyZ70tuuSmr7/wrbHlB7/HTOzXQINLOy6v PLgaMMTZHzoIUl6BZNlDzX2CYmoS/iaqx2qdpzzksx5VZSXJm2Q/PoTpKdHRLTnFBtMaAM 4lk+AWc5oIQ+Gls9hJXBIWeoj3kFMEtaL1lqq/Mp71SORLqt+65qOT+dWKbW6s5JlA4aiC fmhbv7+FdNbvEdBSIyAjDhmfhJOsRRqIvcPNYvdGdGvv2d9ShpsowSGBoKETMQ== In-Reply-To: X-Mailer: Apple Mail (2.3445.104.14) 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:107157 Archived-At: --===============1636797192845786267== Content-Type: multipart/alternative; boundary="Apple-Mail=_0C6EC972-69E3-4DBF-8879-48D88E5739C0" --Apple-Mail=_0C6EC972-69E3-4DBF-8879-48D88E5739C0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 1 May 2020, at 13:30, Hans Hagen wrote: >=20 > 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. I have >> for connectionFromXML in xml.collected(viewFromXML,"/connection") = do >> parseXMLConnection( rootFromXML, connectionFromXML, = viewFromXML, rootFromOverrideXML) >> end >> I tried: >> local relationTable =3D xml.collected(viewFromXML,"/connection") >> for i=3D#relationTable, 1, -1 do >> connectionFromXML =3D relationTable[i] >> parseXMLConnection( rootFromXML, connectionFromXML, = viewFromXML, rootFromOverrideXML) >> end >> But apparently my lua knowledge is lacking (severely, I might say) as = this ends with =E2=80=9Cattempt to get length of a function value=E2=80=9C= >=20 > it's an iterator >=20 >> What is the correct way to do it? > xml.all Tried to find documentation, but failed. Tried this: local relationTable =3D xml.all(viewFromXML,"/connection") for i=3D#relationTable, 1, -1 do connectionFromXML =3D relationTable[i] parseXMLConnection( rootFromXML, connectionFromXML, viewFromXML, = rootFromOverrideXML) end but it fails as well. G >=20 > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- --Apple-Mail=_0C6EC972-69E3-4DBF-8879-48D88E5739C0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 1 May 2020, 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. I have
    for connectionFromXML in = xml.collected(viewFromXML,"/connection") do
    =   parseXMLConnection( rootFromXML, connectionFromXML, viewFromXML, = rootFromOverrideXML)
    end
I = tried:
    local relationTable =3D = xml.collected(viewFromXML,"/connection")
    = for i=3D#relationTable, 1, -1 do
      = connectionFromXML =3D relationTable[i]
    =   parseXMLConnection( rootFromXML, connectionFromXML, viewFromXML, = rootFromOverrideXML)
    end
But = apparently my lua knowledge is lacking (severely, I might say) as this = ends with =E2=80=9Cattempt to get length of a function value=E2=80=9C

it's an iterator

What is the correct way = to do it?
xml.all

Tried = to find documentation, but failed.

Tried this:

    local = relationTable =3D = xml.all(viewFromXML,"/connection")
    for i=3D#relationTable, 1, -1 = do
      = connectionFromXML =3D relationTable[i]
      parseXMLConnection( rootFromXML, = connectionFromXML, viewFromXML, = rootFromOverrideXML)
    = end

but it fails as well.

G


---------------------------------------------------------------= --
=             &n= bsp;           &nbs= p;            =     Hans Hagen | PRAGMA ADE
=             &n= bsp;Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
=       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
---------------------------------------------------------------= --

= --Apple-Mail=_0C6EC972-69E3-4DBF-8879-48D88E5739C0-- --===============1636797192845786267== 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== --===============1636797192845786267==--