* processing lua table in xml...
@ 2015-12-29 9:14 Thomas A. Schmitz
2015-12-29 10:09 ` Hans Hagen
0 siblings, 1 reply; 2+ messages in thread
From: Thomas A. Schmitz @ 2015-12-29 9:14 UTC (permalink / raw)
To: mailing list for ConTeXt users
Dear all,
I had asked a similar question some time ago and had received a reply
from Hans (http://article.gmane.org/gmane.comp.tex.context/81049), but
the method there doesn't work in this case. Working example difficult,
hence code snippets, I'm afraid.
I process file A.xml. I pull in stuff from file B.xml and store the
result as a lua table:
for e in xml.collected(xml.load('B.xml'), 'a') do
for d in xml.collected(lxml.id(e), 'b') do
local sortword = xml.attribute(b, "/", "xml:id", "0")
local entryword = xml.text(b, "entry")
local translation = xml.first(b, "translation")
mytable[sortword] = { }
mytable[sortword]["ew"] = entryword
mytable[sortword]["tr"] = translation
end
end
so the table contains the xml. The "translation" part contains further
nested xml elements. Later, when processing A.xml, I want to retrieve
this stored xml and have it processed:
local checkword = xml.text(t, "c")
local translation = mytable[checkword]["tr"]
but whatever I try:
lxml.flush(lxml.id(translation))
or
xml.cprint(voktable[myword]["tr"])
or
xml.cprint(translation)
I always get the serialized xml typeset, but not processed. So: how can
I get context to process the xml that is stored in the table?
All best
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: processing lua table in xml...
2015-12-29 9:14 processing lua table in xml Thomas A. Schmitz
@ 2015-12-29 10:09 ` Hans Hagen
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2015-12-29 10:09 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 12/29/2015 10:14 AM, Thomas A. Schmitz wrote:
> Dear all,
>
> I had asked a similar question some time ago and had received a reply
> from Hans (http://article.gmane.org/gmane.comp.tex.context/81049), but
> the method there doesn't work in this case. Working example difficult,
> hence code snippets, I'm afraid.
>
> I process file A.xml. I pull in stuff from file B.xml and store the
> result as a lua table:
>
> for e in xml.collected(xml.load('B.xml'), 'a') do
> for d in xml.collected(lxml.id(e), 'b') do
> local sortword = xml.attribute(b, "/", "xml:id", "0")
> local entryword = xml.text(b, "entry")
> local translation = xml.first(b, "translation")
> mytable[sortword] = { }
> mytable[sortword]["ew"] = entryword
> mytable[sortword]["tr"] = translation
> end
> end
>
> so the table contains the xml. The "translation" part contains further
> nested xml elements. Later, when processing A.xml, I want to retrieve
> this stored xml and have it processed:
>
> local checkword = xml.text(t, "c")
> local translation = mytable[checkword]["tr"]
>
> but whatever I try:
>
> lxml.flush(lxml.id(translation))
>
> or
>
> xml.cprint(voktable[myword]["tr"])
>
> or
>
> xml.cprint(translation)
>
> I always get the serialized xml typeset, but not processed. So: how can
> I get context to process the xml that is stored in the table?
hard to say without an example but there is probably no setup associated
to what you flush so does lxml.command (id, pattern, setup) work i.e.
force a setup to be applied?
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-29 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-29 9:14 processing lua table in xml Thomas A. Schmitz
2015-12-29 10:09 ` 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).