[NTG-context] Processing XML: Header and footer, data manipulation

Axel Kielhorn tex at axelkielhorn.de
Mon Apr 22 07:57:27 CEST 2019


Pablo Rodríguez wrote in „From pandoc to ConTeXt“:

„So, if I was able to do this, probably anybody can do it.“

Well, I tried and indeed it isn’t as difficult as i thought.
(Once I learned that an entity must not contain non-ASCII characters.)

Some questions remain:

I want to set page headers based on information I get from the XML:

\startxmlsetups xml:prozess
  \setupheadertexts[\bf\xmltext{#1}{/pnr} \xmltext{#1}{/pname}][\date]
    \setupTABLE[c][1][align=right, width=14cm]
    \setupTABLE[c][2][align=left,  width=6cm]
    \setupTABLE[c][3][align=right, width=4cm]
    \bTR \bTD \bfb\xmltext{#1}{/pnr}   \eTD \bTD Version:        \eTD \bTD \bf\xmltext{#1}{/pversion}\eTD \eTR
    \bTR \bTD \bfb\xmltext{#1}{/pname} \eTD \bTD Verantwortlich: \eTD \bTD \bf\xmltext{#1}{/pverantwortlich}\eTD\eTR

This works on the first page (when the document has more than one page) but headers and footers are empty on subsequent pages.

Something (xmlflush?) overwrites my setup.
Any idea how I can fix that?

I want to use xmlconcat here, since there may be more than one docan, but I only get the „, “

\startxmlsetups xml:psoutdoc 
%    \inmargin{\xmltext{#1}{/docan} $\Leftarrow$}  {\bf \xmltext{#1}{/docnr}}\xmlflush{#1}
    \inmargin{\xmlconcat{#1}{/docan}{, } $\Leftarrow$}  {\bf \xmltext{#1}{/docnr}}\xmlflush{#1}

I want to write the nodes psindoc and psoutdoc to a separate file.
\xmlsave overwrites the file, is there a way to append to the file? (or append to a buffer and write the buffer?)

\startxmlsetups xml:psindoc
    \inmargin{\xmltext{#1}{/docverantwortlich} $\Rightarrow$} {\bf \xmltext{#1}{/docnr}}\xmlflush{#1}

Can I add child notes to #1?

The last two questions probably require LUA, what is a good way to start learning LuaTeX?

I enclosed a small test file.

Greetings Axel

PS: This may result in an article for „Die TeXnische Komödie“.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: prozess-MWE.tex
Type: application/octet-stream
Size: 4322 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190422/9dbecbfa/attachment.obj>

More information about the ntg-context mailing list