I still cannot generate letters from my xml database, although there is apparently a solution to use csv files through lua code (https://tex.stackexchange.com/questions/72735/how-to-create-form-letters-from-spreadsheet-data-in-context).

Your help is much appreciated!

Yet I found out how to generate certificates with backgrounds changing according to the candidate's course level, which I would like to share with you:

%%%%%

participants.xml

<contacts>
<contact>
<formalname>Janssen</formalname>
<informalname>Piet</informalname>
<initials>P.</initials>
<courselevel>levelA</courselevel>
<coursedate>1 june 2017</coursedate>
<city>Nijmegen</city>
</contact>
</contacts>

%%%%

certificates.tex

\setuppapersize[A4,landscape][A4,landscape]
\setuplayout[width=170mm,topspace=60mm,rightmargindistance=2.5mm]
\definelayer[module][width=\paperwidth,height=\paperheight,preset=middle]
\useexternalfigure[levelA][sjablonen/CourseLevelA.pdf]
\resetlayer[level]{}

\setupbackgrounds[page][background={level}]

\startxmlsetups xml:setups
\xmlsetsetup{#1}{contacts}{xml:contacts}
\xmlsetsetup{#1}{contact}{xml:contacts:contact}
\stopxmlsetups

\xmlregistersetup{xml:setups}

\startxmlsetups xml:contacts
     \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:contacts:contact
\setlayer[module][][]{\externalfigure[\xmltext{#1}{/courselevel}][factor=550]}

\startalignment [middle]
\color[red]{{\tfd \xmltext{#1}{/initials}} {\tfd \xmltext{#1}{/formalname}}\par

\blank[10mm]

{\ss \xmltext{#1}{/city}, \xmltext{#1}{/coursedate}}

\stopalignment
\page[yes]
\stopxmlsetups

\starttext
\xmlprocessfile{main}{./participants.xml}{}

\stoptext

Kind regards,

Robert


Op 13 jun. 2017, om 15:59 heeft r.ermers@hccnet.nl het volgende geschreven:

I can take the information out of the nodes. The main problem is to use them in a layout and in a sequences other the one they appear in the xml data file.

In the current (mkii) file I have something like this: \midaligned{\XMLflush{formalname}, \XMLflush{informalname}}.


Another point on my wishlist is to change the background of the certificate depending on the type of certificate. In mkii I manage to do this as follows:

File: participants.xml
<contacts>
<contact>
<formalname>Janssen</formalname>
<informalname>Piet</informalname>
<courselevel>levelA</courselevel>
</contact>
</contacts>

certificates.tex:
\resetlayer[module]{}
\setlayer[module][][]{\externalfigure[\XMLflush{courselevel}[width=\paperwidth,height=\paperheight]}

\useexternalfigure[levelA][sjablonen/backgroundlevelA.pdf]

Help is very much appreciated!

Robert


Op 13 jun. 2017, om 09:53 heeft luigi scarso <luigi.scarso@gmail.com> het volgende geschreven:

On Tue, Jun 13, 2017 at 9:40 AM,  <r.ermers@hccnet.nl> wrote:
Hello all,

I have been using Context mkii with the x-corres.mkii module for a number of years now, for many different purposes (mailings, certificates, etc). The module works with an xml (actually rng) file with the following structure:

<contacts>
      <contact label=“pietjanssen">
              <formalname>Janssen</formalname>
              <informalname>Piet</informalname>
      </contact>
</contacts>

The contents of each item is grabbed and put in the document by means of the command \XMLflush{formalname}.

I would like to shift to mkiv now with all its possibilities.

Yet there is no x-corres.mkiv. Who can help me out?

I don't remember x-corres.mkiv, but
mkiv has a guide
tex/texmf-context/doc/context/documents/general/manuals/xml-mkiv.pdf

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

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