In your tex file, try this:

\startluacode
settings = {}
docstruktur = {}
doclistfile = "doclist.xml"

local striplines = utilities.strings.striplines
local xmltext    = xml.text

cropstring = function(s)
  -- return striplines(s, "prune and collapse")
  return striplines(s)
end

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
  }
--  docstruktur[docnr]["docname"] = docname
--  docstruktur[docnr]["docan"] = docan
--  docstruktur[docnr]["docverantwortlich"] = docverantwortlich
end
\stopluacode

hoping it helps,
Massi
___________________________________________________________________________________
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