ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: r.ermers@hccnet.nl
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: typesetting serial letters in Context
Date: Thu, 15 Jun 2017 10:51:55 +0200	[thread overview]
Message-ID: <39CF32AB-08D2-4F5C-9D92-4E71F7FC7286@hccnet.nl> (raw)
In-Reply-To: <5C680E0F-A1F2-418E-A47E-30A2E8A7C44B@hccnet.nl>


[-- Attachment #1.1: Type: text/plain, Size: 4947 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 9502 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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	other threads:[~2017-06-15  8:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13  7:40 r.ermers
2017-06-13  7:53 ` luigi scarso
2017-06-13  8:31   ` Thomas A. Schmitz
2017-06-13 10:46     ` r.ermers
2017-06-13 13:59   ` r.ermers
2017-06-15  8:51     ` r.ermers [this message]
     [not found]       ` <7fb67473-c59c-9fd5-5ff5-f9648d7d3d89@uni-bonn.de>
2017-06-15 21:58         ` r.ermers
     [not found]           ` <0cabd384-96af-bbb2-82b1-37eb64f28221@uni-bonn.de>
2017-06-18 15:59             ` r.ermers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39CF32AB-08D2-4F5C-9D92-4E71F7FC7286@hccnet.nl \
    --to=r.ermers@hccnet.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).