Hello Massi,

thanks for you help.


> Am 10.03.2020 um 20:53 schrieb mf <mass...@fastwebnet.it>:
> 
> In your tex file, try this:
> 
> \startluacode
> settings = {}
> docstruktur = {}
> doclistfile = "doclist.xml"
> 
> local striplines = utilities.strings.striplines
> 
> cropstring = function(s)
>  -- return striplines(s, "prune and collapse")
>  return striplines(s)
> end

Well, with this definition I can actually inline that.

> local xmltext    = xml.text
> 
> doc = xml.load(doclistfile, settings)
> 
> for v in xml.collected(doc,"/doclist/psdoc/") do
> --  print (v)
> --  print (xml.text(v,"/docnr"))
>  local docnr = cropstring(xml.text(v,"/docnr"))
>  print (docnr)
>  local docname = cropstring(xmltext(v,"/docname"))
>  -- es kann mehrere DOCAN geben!
>  local docan = (cropstring(xmltext(v,"/docan")))
>  local docverantwortlich = (cropstring(xmltext(v,"/docverantwortlich")))

>  docstruktur[docnr]={
>    docname = docname,
>    docan = docan,
>    docverantwortlich = docverantwortlich
>  }

Great, that is even shorter.

> end
> \stopluacode

I’m cleaning up my backend code to make it more Lua like.

Greetings
Axel

___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to