Hi Thomas,

Thanks for your advice.

I would like to have a system with which I can send letters to people in my database.

It would be nice to be able to make selections according to labels (probably with xmlatt), but that can be done later.

I am not a programmer - when I read the documentation, I do not understand enough of it to the extent to port it to a new program, but I can adapt and try existing code.

Thusfar I have been trying to use the letter module with the xmltext and xmlflush commands. What can be done to make this work?

Thanks!

Robert


\usemodule[letter]
\startbuffer[participants]

<contacts>
  <contact class='participant' label='Hendriks'>
    <formalname>Hendriks</formalname>
    <informalname>Karel</informalname>
    <prefix>mr.</prefix>
    <initials>K.</initials>
    <courselevel>levelA</courselevel>
    <coursedate>1 june 2017</coursedate>  
    <city>Arnhem</city>
    <address>
      <p>Mr. K. Hendriks</p>
      <p>Grotestraat 5</p>
      <p>1234 Arnhem</p>
    </address>
  </contact>

  <contact class='participant' label='Janssen'>
    <formalname>Janssen</formalname>
    <informalname>Piet</informalname>
    <initials>P.</initials>
    <prefix>mr.</prefix>
    <courselevel>levelA</courselevel>
    <coursedate>1 june 2017</coursedate>  
    <city>Nijmegen</city>
    <address>
     <p>Mr. P. Janssen</p>
     <p>Kortestraat 8</p>
     <p>1234 Nijmegen</p>
    </address>
  </contact>
</contacts>

\stopbuffer


\startxmlsetups xml:setups
\xmlsetsetup{#1}{contacts|contact|address|prefix}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:setups}

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

\startxmlsetups xml:contact

%\setupletter[
%  name={Sender},
%  email={},
%  signature={X}]

\startletter
  [opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},
   closing={Kind regards,},
   signature={X},
   toaddress={\xmltext{#1}{/address}},
   subject={Interesting offer}]

\input knuth

%\xmltext{#1}{/informalname}
%Without the letter instructions, the code yields the names in informalname.

\stopletter
\stopxmlsetups

\starttext
\xmlprocessbuffer{main}{participants}{}
\stoptext


tex error on line 17 in file /Users/mac/Documents/doc/moperspectief/brieven/brieven2mkiv.tex: ! Use of \correspondence_start_parameters doesn't match its definition


\doifelsenextoptional ...\def \m_syst_action_yes {
                                                  #1}\def \m_syst_action_nop...
\setupletter ...bleargument \correspondence_setup 
                                                  [\v!letter ]
\14>:xml:contact #1->\setupletter 
                                  [name={Sender},email={},signature={X}]\def...
l.17 }
    
\14>:xml:contacts #1->\xmlflush {#1}
                                    
l.7 }


'
Op 15 jun. 2017, om 19:02 heeft Thomas A. Schmitz <thomas.schmitz@uni-bonn.de> het volgende geschreven:

On 06/15/2017 10:51 AM, r.ermers@hccnet.nl wrote:
I still cannot generate letters from my xml database

So what are you missing? Make a complete minimal example (you can pack the xml part into a buffer and then use \xmlprocessbuffer), then people will try to help you. Right now, we can't even guess where your problems lie. And writing "I'm not a programmer, so I can't read documentation" is not very motivating - you've been told where to begin, and you appear to be making some progress, so show us what you have.

Thomas