% language=us runpath=texruns:manuals/workflows \environment workflows-style \startcomponent workflows-xml \startluacode for i=1,10 do local filename = string.formatters["temp-%02i.xml"](i) local filedata = string.formatters["

snippet %i

"](i) io.savedata(filename,filedata) end \stopluacode \startchapter[title={XML}] When you have an \XML\ project with many files involved, finding the right spot of something that went wrong can be a pain. In one of our project the production of some 50 books involves 60.000 \XML\ files and 20.000 images. \footnote {In the meantime we could trim this down a lot.} Say that we have the following file: \startbuffer[demo] \stopbuffer \typebuffer[demo] Before we process this file we will merge the content of the files defined as includes into it. When this happens the filename is automatically registered so it can be accessed later. \startbuffer \startxmlsetups xml:initialize \xmlincludeoptions{#1}{include}{filename|name}{recurse,basename} \xmlsetsetup{#1}{p|document}{xml:*} \stopxmlsetups \startxmlsetups xml:document \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:p \inleftmargin{\infofont\xmlinclusion{#1}} \xmlflush{#1} \par \stopxmlsetups \xmlregistersetup{xml:initialize} \xmlprocessbuffer{main}{demo}{} \stopbuffer \typebuffer In this case we put the name of the file in the margin. Depending on when and how elements are flushed other solutions, like overlays, can be used. \startpacked \getbuffer \stoppacked At any moment you can see what the current node contains. The whole (merged) document is also available: \startbuffer \xmlshow{main} \stopbuffer \typebuffer A small font is used to typeset the (sub)tree: \blank \getbuffer \blank You can also save the tree: \startbuffer \xmlsave{main}{temp.xml} \stopbuffer \typebuffer \getbuffer This file looks like: \typefile{temp.xml} \stopchapter \stopcomponent