ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* letters in context mkiv
@ 2017-07-28  6:18 r.ermers
  0 siblings, 0 replies; 16+ messages in thread
From: r.ermers @ 2017-07-28  6:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/html, Size: 7557 bytes --]

[-- Attachment #1.2: brieven2mkiv.pdf --]
[-- Type: application/pdf, Size: 15333 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-08-01 11:17                 ` Schmitz Thomas A.
@ 2017-08-01 12:04                   ` r.ermers
  0 siblings, 0 replies; 16+ messages in thread
From: r.ermers @ 2017-08-01 12:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thanks Wolfgang and Thomas,

The solutions of both of you function!

Thank you!

Robert


> Op 1 aug. 2017, om 13:17 heeft Schmitz Thomas A. <thomas.schmitz@uni-bonn.de> het volgende geschreven:
> 
> 
>> On 1. Aug 2017, at 12:15, r.ermers@hccnet.nl wrote:
>> 
>> While understanding what it means, I guess this might imply that it is difficult (?) or impossible (?) to correctly process files such as the knuth text and for that matter any other letter text that contains regular Context commands.
>> 
>> Nevertheless, for the moment this problem remains unsolved.
>> 
>> What would you advise as the next step?
>> 
>> Should the letter be somehow set-up outside xml setups rather than inside?
>> Should the letter texts (and a specific knuth sample text) be reformatted as xml?
> 
> So: you want to import the letter texts from an external file. Easiest solution: instead of simply \input knuth, try this:
> 
> {\pushcatcodetable
> \catcodetable\ctxcatcodes\input knuth
> \popcatcodetable}
> 
> As you can see, changing the catcode regime processes the file correctly. “Expansion” means something different in TeX speak.
> 
> Other possibilities: write your letter body in xml, or write the letters in buffers and use \processTEXbuffer.
> 
> Thomas
> ___________________________________________________________________________________
> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-08-01 10:15               ` r.ermers
@ 2017-08-01 11:17                 ` Schmitz Thomas A.
  2017-08-01 12:04                   ` r.ermers
  0 siblings, 1 reply; 16+ messages in thread
From: Schmitz Thomas A. @ 2017-08-01 11:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> On 1. Aug 2017, at 12:15, r.ermers@hccnet.nl wrote:
> 
> While understanding what it means, I guess this might imply that it is difficult (?) or impossible (?) to correctly process files such as the knuth text and for that matter any other letter text that contains regular Context commands.
> 
> Nevertheless, for the moment this problem remains unsolved.
> 
> What would you advise as the next step?
> 
> Should the letter be somehow set-up outside xml setups rather than inside?
> Should the letter texts (and a specific knuth sample text) be reformatted as xml?

So: you want to import the letter texts from an external file. Easiest solution: instead of simply \input knuth, try this:

{\pushcatcodetable
 \catcodetable\ctxcatcodes\input knuth
 \popcatcodetable}

As you can see, changing the catcode regime processes the file correctly. “Expansion” means something different in TeX speak.

Other possibilities: write your letter body in xml, or write the letters in buffers and use \processTEXbuffer.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-08-01  8:46             ` Schmitz Thomas A.
@ 2017-08-01 10:15               ` r.ermers
  2017-08-01 11:17                 ` Schmitz Thomas A.
  0 siblings, 1 reply; 16+ messages in thread
From: r.ermers @ 2017-08-01 10:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Your suggestion with foregroundstyle and foregroundcolor works. Thank you!

\setlayer[AddressBg]
  {\framed[width=55mm,height=30mm,
  align=right,background=color,
  backgroundcolor=lightgray,
foregroundcolor=red,foregroundstyle=\ss\tfa]{\xmlall{#1}{/address}}}


My question (my ’need’) was quite simple: how I can have a workflow in which I can produce serial letters based upon contextmkiv (as I did in mkii).

I encountered a number of difficulties (in steps):

1. I first noticed that I could not add a letter text, either in the file itself, or by means of \input.

At that point the sample knuth file was not processed, nor were my own external letter files.

I did write that I use external letter files, but perhaps failed to mention that my texts contain to my mind regular Context commands (like {\bf bold} and \startitemize … \stopitemize). I use these commands to improve the look of my letter.

2. The import problem itself was caused by a wrongful position of the \starttext … \stoptext commands. This problem was solved with help of Thomas, Wolfgang and Pablo.

3. A second problem I signalled was to have the addres moved to the desired place. I could solve this problem by reference to the contextgarden website. Thomas helped me finetune the style instruction.

4. Only when the input files were processed, it became obvious that these files (including the knuth file) in a general sense are not rendered correctly.

The knuth sample document (\input knuth) contains only one single command (\TeX\), which is not expanded. For this reason, my sample letters, which contain regular codes, are not processed correctly either. Pablo Rodriguez suggested that the problem was that for some reason there is only one ‘expansion’ level.

Thomas, in his last mail, now writes that according to him within the xml setups the ‘catcodes' are changed, and, as a result, the backslash is interpreted as a normal character rather than as introducing a command.

While understanding what it means, I guess this might imply that it is difficult (?) or impossible (?) to correctly process files such as the knuth text and for that matter any other letter text that contains regular Context commands.

Nevertheless, for the moment this problem remains unsolved.

What would you advise as the next step?

Should the letter be somehow set-up outside xml setups rather than inside?
Should the letter texts (and a specific knuth sample text) be reformatted as xml?

So in sum, I sincerely do not think I kept anyone guessing about my needs. The technical problems presented themselves one by one, step by step. Yet if I did, I apologize.

Kind regards,

Robert


> Op 1 aug. 2017, om 10:46 heeft Schmitz Thomas A. <thomas.schmitz@uni-bonn.de> het volgende geschreven:
> 
>> However, the color and style instructions (\ss\tfa) have no effect. I tried to solve that, as a first step, by putting \ss before the \xmlall instruction:
>> 
>> \startxmlsetups xlm:contact
>> \setlayer[AddressBg]  {\framed[width=55mm,height=30mm,  align=right,background=color,
>> backgroundcolor=lightgray]{\ss\xmlall{#1}{/address}}}
>> \strut
>> ...
>> \stopxmlsetups
>> 
>> This works (see pdf), but there are probably other and better ways.
>> 
> Have a look at the framed/setupframed command; they have foregroundstyle and foregroundcolor keys; that would be the most idiomatic way to set the style.
> 
> 
> 
>> Another persisting problem is that the commands are still not ‘expanded’ (see Pablo’s remarks). According to Pablo for some reason there is only one expansion level.
>> 
>> This means that after an \input command, all other commands are not expanded (see pdf).
>> 
>> This also applies to your suggestions (see pdf brieven2mkiv5.pdf): in the Knuth sample text the only command \TeX\, is not expanded either.
> 
> You’re working within xml setups, which means that the catcodes are not the same as in TeX, which means that the backslash is just a normal character. The question is: why would you need TeX commands from an external file? Is this where your letter text comes from? You keep us guessing and are not describing what your needs are.
> 
> Thomas
> ___________________________________________________________________________________
> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-08-01  7:55           ` r.ermers
@ 2017-08-01  8:46             ` Schmitz Thomas A.
  2017-08-01 10:15               ` r.ermers
  0 siblings, 1 reply; 16+ messages in thread
From: Schmitz Thomas A. @ 2017-08-01  8:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> However, the color and style instructions (\ss\tfa) have no effect. I tried to solve that, as a first step, by putting \ss before the \xmlall instruction:
> 
> \startxmlsetups xlm:contact
> \setlayer[AddressBg]  {\framed[width=55mm,height=30mm,  align=right,background=color,
>  backgroundcolor=lightgray]{\ss\xmlall{#1}{/address}}}
> \strut
> ...
> \stopxmlsetups
> 
> This works (see pdf), but there are probably other and better ways.
> 
Have a look at the framed/setupframed command; they have foregroundstyle and foregroundcolor keys; that would be the most idiomatic way to set the style.



> Another persisting problem is that the commands are still not ‘expanded’ (see Pablo’s remarks). According to Pablo for some reason there is only one expansion level.
> 
> This means that after an \input command, all other commands are not expanded (see pdf).
> 
> This also applies to your suggestions (see pdf brieven2mkiv5.pdf): in the Knuth sample text the only command \TeX\, is not expanded either.

You’re working within xml setups, which means that the catcodes are not the same as in TeX, which means that the backslash is just a normal character. The question is: why would you need TeX commands from an external file? Is this where your letter text comes from? You keep us guessing and are not describing what your needs are.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-07-31 21:57         ` Schmitz Thomas A.
@ 2017-08-01  7:55           ` r.ermers
  2017-08-01  8:46             ` Schmitz Thomas A.
  0 siblings, 1 reply; 16+ messages in thread
From: r.ermers @ 2017-08-01  7:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

Hi Thomas,

Thanks for your new suggestions.

As a matter of fact, I yesterday found the following suggestion (http://wiki.contextgarden.net/Layers):

\definelayer[AddressBg] [location={right,top},   y=6cm,  x=12cm,  color=red,   style=\ss\tfa].

I used this in the sample suggested by you yesterday. The address actually moves to the desired place!

However, the color and style instructions (\ss\tfa) have no effect. I tried to solve that, as a first step, by putting \ss before the \xmlall instruction:

\startxmlsetups xlm:contact
\setlayer[AddressBg]  {\framed[width=55mm,height=30mm,  align=right,background=color,
  backgroundcolor=lightgray]{\ss\xmlall{#1}{/address}}}
\strut
...
\stopxmlsetups

This works (see pdf), but there are probably other and better ways.


[-- Attachment #2: brieven2mkiv.pdf --]
[-- Type: application/pdf, Size: 17561 bytes --]

[-- Attachment #3: Type: text/plain, Size: 413 bytes --]



Another persisting problem is that the commands are still not ‘expanded’ (see Pablo’s remarks). According to Pablo for some reason there is only one expansion level.

This means that after an \input command, all other commands are not expanded (see pdf).

This also applies to your suggestions (see pdf brieven2mkiv5.pdf): in the Knuth sample text the only command \TeX\, is not expanded either.


[-- Attachment #4: brieven2mkiv5.pdf --]
[-- Type: application/pdf, Size: 13108 bytes --]

[-- Attachment #5: Type: text/plain, Size: 1144 bytes --]



Regards,

Robert


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

\xmlregistersetup{xml:setups}

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

\startxmlsetups xml:p
  \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:contact
  \setlayer[address][x=20mm,y=40mm]{\framed[width=74mm,height=35mm,frame=on,offset=2mm,align=right]{\ignorespaces\xmltext{#1}{/address}}}
  \strut
  \blank [35mm]
  Subject: your life in \xmltext{#1}{/city}
  \blank [2*line]
  Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
  \blank [line]
%  \input knuth \relax

  This is a {\bf bold} test. \TeX\
  \startitemize
  \item item
  \item item
  \stopitemize

\input brieftekst-test.tex \relax
\par
%this \par is needed, for the last word of the file merges with Kind regards.

  Kind regards
  \blank [line]
  X
  \page
\stopxmlsetups

\setuppagenumbering [state=stop]

\definelayer[address][width=\paperwidth,height=\paperheight]

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

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

\stoptext



[-- Attachment #6: brieftekst-test.tex --]
[-- Type: application/octet-stream, Size: 467 bytes --]

This is a test with an input file.

{\bf test testtest testtest test}

test testtest testtest testtest testtest testtest test test test:

\startitemize[n,packed,joinedup]
\item test test test test.
\item test test test test test test.
%\item Het voeren van gesprekken met cliënten.
\stopitemize

test testtest testtest testtest testtest testtest testtest testtest testtest testtest test

{\bf test test}

test testtest testtest testtest testtest test

[-- Attachment #7: Type: text/plain, Size: 2797 bytes --]






> Op 31 jul. 2017, om 23:57 heeft Schmitz Thomas A. <thomas.schmitz@uni-bonn.de> het volgende geschreven:
> 
> 
>> On 31. Jul 2017, at 18:58, r.ermers@hccnet.nl wrote:
>> 
>> Would it be wise to perhaps follow the path set out by Thomas? In that case there should be a way to shift the address.
> 
> What efforts have you made to “shift the address”? Here is one way:
> 
> \startbuffer[participants]
> <contacts>
>  <contact class='participant' label='Hendriks'>
>    <formalname>Hendriks</formalname>
>    <informalname>Karel</informalname>
>    <prefix>mr.</prefix>
>    <initials>K.</initials>
>    <city>Arnhem</city>
>    <address>
>      <p>Mr. K. Hendriks</p>
>      <p>Grotestraat 5</p>
>      <p>1234 BB Arnhem</p>
>    </address>
>    <kix>1234bb5</kix>
>  </contact>
>  <contact class='participant' label='Janssen'>
>    <formalname>Janssen</formalname>
>    <informalname>Piet</informalname>
>    <initials>P.</initials>
>    <prefix>mr.</prefix>
>    <city>Nijmegen</city>
>    <address>
>     <p>Mr. P. Janssen</p>
>     <p>Kortestraat 8</p>
>     <p>1234 AA Nijmegen</p>
>    </address>
>    <kix>1234aa8</kix>
>  </contact>
> </contacts>
> \stopbuffer
> 
> \startxmlsetups xml:setups
> \xmlsetsetup{#1}{contacts|contact|p}{xml:*}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:setups}
> 
> \startxmlsetups xml:contacts
> 	\xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:p
> 	\xmlflush{#1}\par
> \stopxmlsetups
> 
> \startxmlsetups xml:contact
> 	\setlayer[address][x=20mm,y=40mm]{\framed[width=74mm,height=35mm,frame=on,offset=2mm,align=right]{\ignorespaces\xmltext{#1}{/address}}}
> 	\strut
> 	\blank [35mm]
> 	Subject: your life in \xmltext{#1}{/city}
> 	\blank [2*line]
> 	Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
> 	\blank [line]
> 	\input knuth \relax
> 
> 	Kind regards
> 	\blank [line]
> 	X
> 	\page
> \stopxmlsetups
> 
> \setuppagenumbering [state=stop]
> 
> \definelayer[address][width=\paperwidth,height=\paperheight]
> 
> \setupbackgrounds [page][background={address}]
> 
> \starttext
> \xmlprocessbuffer{main}{participants}{}
> 
> \stoptext
> 
> I still don’t see you trying to learn a new language one step at a time. 
> 
> Thomas
> ___________________________________________________________________________________
> 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 #8: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-07-31 16:58       ` r.ermers
  2017-07-31 17:23         ` Pablo Rodriguez
@ 2017-07-31 21:57         ` Schmitz Thomas A.
  2017-08-01  7:55           ` r.ermers
  1 sibling, 1 reply; 16+ messages in thread
From: Schmitz Thomas A. @ 2017-07-31 21:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> On 31. Jul 2017, at 18:58, r.ermers@hccnet.nl wrote:
> 
> Would it be wise to perhaps follow the path set out by Thomas? In that case there should be a way to shift the address.

What efforts have you made to “shift the address”? Here is one way:

\startbuffer[participants]
<contacts>
  <contact class='participant' label='Hendriks'>
    <formalname>Hendriks</formalname>
    <informalname>Karel</informalname>
    <prefix>mr.</prefix>
    <initials>K.</initials>
    <city>Arnhem</city>
    <address>
      <p>Mr. K. Hendriks</p>
      <p>Grotestraat 5</p>
      <p>1234 BB Arnhem</p>
    </address>
    <kix>1234bb5</kix>
  </contact>
  <contact class='participant' label='Janssen'>
    <formalname>Janssen</formalname>
    <informalname>Piet</informalname>
    <initials>P.</initials>
    <prefix>mr.</prefix>
    <city>Nijmegen</city>
    <address>
     <p>Mr. P. Janssen</p>
     <p>Kortestraat 8</p>
     <p>1234 AA Nijmegen</p>
    </address>
    <kix>1234aa8</kix>
  </contact>
</contacts>
\stopbuffer

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

\xmlregistersetup{xml:setups}

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

\startxmlsetups xml:p
	\xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:contact
	\setlayer[address][x=20mm,y=40mm]{\framed[width=74mm,height=35mm,frame=on,offset=2mm,align=right]{\ignorespaces\xmltext{#1}{/address}}}
	\strut
	\blank [35mm]
	Subject: your life in \xmltext{#1}{/city}
	\blank [2*line]
	Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
	\blank [line]
	\input knuth \relax

	Kind regards
	\blank [line]
	X
	\page
\stopxmlsetups

\setuppagenumbering [state=stop]

\definelayer[address][width=\paperwidth,height=\paperheight]

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

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

\stoptext

I still don’t see you trying to learn a new language one step at a time. 

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-07-31 16:58       ` r.ermers
@ 2017-07-31 17:23         ` Pablo Rodriguez
  2017-07-31 21:57         ` Schmitz Thomas A.
  1 sibling, 0 replies; 16+ messages in thread
From: Pablo Rodriguez @ 2017-07-31 17:23 UTC (permalink / raw)
  To: ntg-context

On 07/31/2017 06:58 PM, r.ermers@hccnet.nl wrote:
> Dear Pablo,
> 
> Thank you for your insightful remarks. I tried your suggestions. As
> you predicted, the Knuth tex is processed when put here, without using
> the buffer mechanism.

Dear Robert,

it wasn’t a prediction, I tested it myself ;-).

> Yet any codes (\TeX\) are not. 
> 
> Nevertheless, I consider this a step forward. In the same way, my
> letter texts, which contain regular codes, such as \startitemize …
> \stopitemize and {\bf bold} are not processed properly.
> 
> The whole thing is much more complicated than I thought. Wolfgang
> already mentioned that the letter module is not specifically equipped
> for xml.

What I would like to know is how one can get full expansion (I
experienced your issue before in another scenario).

Or at least, I want to know why only the first level of commands is
expanded. (An \expandafter or something like that?)

> Would it be wise to perhaps follow the path set out by Thomas? In
> that case there should be a way to shift the address.

You may use layers to locate the address where you want.

Or even you may use an extra margin (it cannot be that hard).

Just in case it helps,

Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-07-31 15:23     ` Pablo Rodriguez
@ 2017-07-31 16:58       ` r.ermers
  2017-07-31 17:23         ` Pablo Rodriguez
  2017-07-31 21:57         ` Schmitz Thomas A.
  0 siblings, 2 replies; 16+ messages in thread
From: r.ermers @ 2017-07-31 16:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear Pablo,

Thank you for your insightful remarks. I tried your suggestions. As you predicted, the Knuth tex is processed when put here, without using the buffer mechanism.

\startsetups[letter:section:content]
\input knuth \relax
\stopsetups

Yet any codes (\TeX\) are not. 

Nevertheless, I consider this a step forward. In the same way, my letter texts, which contain regular codes, such as \startitemize … \stopitemize and {\bf bold} are not processed properly.

The whole thing is much more complicated than I thought. Wolfgang already mentioned that the letter module is not specifically equipped for xml.

Would it be wise to perhaps follow the path set out by Thomas? In that case there should be a way to shift the address.

Regards,

Robert



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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-07-31 10:48   ` r.ermers
@ 2017-07-31 15:23     ` Pablo Rodriguez
  2017-07-31 16:58       ` r.ermers
  0 siblings, 1 reply; 16+ messages in thread
From: Pablo Rodriguez @ 2017-07-31 15:23 UTC (permalink / raw)
  To: ntg-context

On 07/31/2017 12:48 PM, r.ermers@hccnet.nl wrote:
> Dear Contex’ers,
> 
> This morning I have been experimenting with the solutions suggested by
> Thomas and Wolfgang.
> 
> Thomas’ solution works, it produces two distinct letters, yet the
> address is probably on another layer. This means that it is not shifted
> to the right, at least not with the command
> (\setupletterlayer[address]), so that it will be visible through the
> envelope window.
> 
> With Wolfgang’s solution the address is moved to its desired place, and
> the letter text is printed as well.
> 
> However, inserting a text (by means of \input) is problematic (see pdf),
> with or without \relax.

Hi Robert,

it isn’t the use of \input. The problem is that you only get one level
of expansion.

If you add \input directly to letter:section:content, such as in:

    \startsetups[letter:section:content]
    \input knuth \relax
    \stopsetups

You will have \input expanded. But in the text itself \TeX\ and
large||scale won’t be expanded.

I have no idea why this happens. And I don’t know how to fix it. Maybe
Wolfgang knows what is happening here.

If I had to guess, it might be that \directsetups only allows a level of
expansion. But I may be plainly wrong.

A way to avoid the issue is to add the letter content directly to the
\startsetups[letter:section:context]. And rememmber that you have only
one level of expansion.

Just in case it might help,

Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
       [not found] ` <597DFB2C.60001@gmail.com>
@ 2017-07-31 10:48   ` r.ermers
  2017-07-31 15:23     ` Pablo Rodriguez
  0 siblings, 1 reply; 16+ messages in thread
From: r.ermers @ 2017-07-31 10:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/html, Size: 4970 bytes --]

[-- Attachment #1.2: brieven2mkiv3.pdf --]
[-- Type: application/pdf, Size: 15697 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-07-30 15:38 ` Schmitz Thomas A.
@ 2017-07-31  8:09   ` r.ermers
  0 siblings, 0 replies; 16+ messages in thread
From: r.ermers @ 2017-07-31  8:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you Thomas and Wolfgang,

About startletter / starttext: the contents of my test file reflect a moment. I have made numerous tests with and without starttext/stoptext. The state of the test file is one in an endless row of tests.

I am not without total experience in programing. I more or less understand program scripts when they are not too complicated and I like tweaking them, yet I cannot think up a new program from scratch.

But anyway, I will go ahead with your suggestions!

Thank you very much again!

Robert



> Op 30 jul. 2017, om 17:38 heeft Schmitz Thomas A. <thomas.schmitz@uni-bonn.de> het volgende geschreven:
> 
> 
>> On 30. Jul 2017, at 14:15, r.ermers@hccnet.nl wrote:
>> 
>> Let me as a turcologist compare my problem to learning Kazakh: I am prepared to give you a manual with the grammatical rules, provide you with lists of nouns, verbs, adjectives and postpositions, explain the application of phonological rules, transliterations of the alphabet, give you a insight in the nominal cases and verb structure, and read with you a text in Kazakh. Nevertheless, without being rude, I bet that even then you are unable to flawlessly produce a poem or even a brief text in Kazakh yourself.
> 
> OK, I see your desperation, and I take your analogy (I’m a scholar myself, not a programmer): if someone came to you with the Iliad and explained that he doesn’t know a word of Kazakh but wants all of Homer’s poem, every line, every word, every nuance, expressed in Kazakh with the help of a grammar and a dictionary, you’d reply that this is not how learning languages works. You begin with simple sentences and work your way up. You have shown us several times examples that don’t work, and I have expressed my suspicion that this may be due to using the correspondence module. You weren’t sure whether you need it or not; which is something only you can know. What does this module offer that can’t be accomplished otherwise? If you look at the documentation of the module, you see that the \startletter … \stopletter pair starts an environment within a \starttext … \stoptext context document. When you look at your setup, you will see that you have a \startletter … \stopletter, then a few setups, and then a \starttext … \stoptext document. I’m not a programmer, but I see that this will not work. 
> 
> So for some simple rules: when you process an xml buffer (or document), you define xmlsetups for the different xml elements. When you write \xmlprocessbuffer, that’s when these elements will be processed - which means: that’s when your document will be built. You can’t go through your xml buffer/document and then add further text (well you can, but that’s more complicated), so what you have to do is add your text (for the sake of this example: \input knuth) WITHING THESE SETUPS. So let’s start with a simple document that will work:
> 
> \startbuffer[participants]
> <contacts>
>  <contact class='participant' label='Hendriks'>
>    <formalname>Hendriks</formalname>
>    <informalname>Karel</informalname>
>    <prefix>mr.</prefix>
>    <initials>K.</initials>
>    <city>Arnhem</city>
>    <address>
>      <p>Mr. K. Hendriks</p>
>      <p>Grotestraat 5</p>
>      <p>1234 BB Arnhem</p>
>    </address>
>    <kix>1234bb5</kix>
>  </contact>
>  <contact class='participant' label='Janssen'>
>    <formalname>Janssen</formalname>
>    <informalname>Piet</informalname>
>    <initials>P.</initials>
>    <prefix>mr.</prefix>
>    <city>Nijmegen</city>
>    <address>
>     <p>Mr. P. Janssen</p>
>     <p>Kortestraat 8</p>
>     <p>1234 AA Nijmegen</p>
>    </address>
>    <kix>1234aa8</kix>
>  </contact>
> </contacts>
> \stopbuffer
> 
> \startxmlsetups xml:setups
> \xmlsetsetup{#1}{contacts|contact|formalname|informalname|prefix|initials|address|city|text|kix|p}{xml:*}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:setups}
> 
> \startxmlsetups xml:contacts
> 	\xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:p
> 	\xmlflush{#1}\par
> \stopxmlsetups
> 
> \startxmlsetups xml:contact
> 	\xmltext{#1}{/address}
> 	\blank [3*line]
> 	Subject: your life in \xmltext{#1}{/city}
> 	\blank [2*line]
> 	Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
> 	\blank [line]
> 	\input knuth \relax
> 
> 	Kind regards
> 	\blank [line]
> 	X
> 	\page
> \stopxmlsetups
> 
> \setuppagenumbering [state=stop]
> 
> \starttext
> \xmlprocessbuffer{main}{participants}{}
> \stoptext
> 
> So you see what I’m doing here: I process every simple <contact> element, and I add all the stuff that will go into the letter for every single contact. Start with this document and then find out what you need in addition: a logo, some fancy lines across the letters, a special placement for the address and the subject, etc.? I’m guessing that it would be easier to do this with simple setup commands rather than using the correspondence module, but we have no idea what you need to accomplish. Once you find out what’s missing, you can modify the example and ask additional questions. But, to take your analogy: don’t start with irregular verbs and special cases that will complicate the picture. How is this line
> 
> \setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date
> 
> from your original example relevant to your problem? And again: please don’t give me the “I’m not a programmer” response; I’m not a programmer either, but I know that you have to reduce the complexity in problems to find a solution. You’re adding extra complexity.
> 
> The way I describe above is the easiest path. There are other approaches, of course: you can combine elements from several xml documents, or you can process the xml data with Lua. All of this may be unnecessary in your case, but nobody will be able to help unless we understand what you need. And to explain this, you will have to start with simple examples, not with a complex document.
> 
> Sorry for being somewhat stern, but I’m sure you would give similar advice to your students…
> 
> All best
> 
> Thomas
> 
> ___________________________________________________________________________________
> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: letters in context mkiv
  2017-07-30 12:15 r.ermers
@ 2017-07-30 15:38 ` Schmitz Thomas A.
  2017-07-31  8:09   ` r.ermers
       [not found] ` <597DFB2C.60001@gmail.com>
  1 sibling, 1 reply; 16+ messages in thread
From: Schmitz Thomas A. @ 2017-07-30 15:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> On 30. Jul 2017, at 14:15, r.ermers@hccnet.nl wrote:
> 
> Let me as a turcologist compare my problem to learning Kazakh: I am prepared to give you a manual with the grammatical rules, provide you with lists of nouns, verbs, adjectives and postpositions, explain the application of phonological rules, transliterations of the alphabet, give you a insight in the nominal cases and verb structure, and read with you a text in Kazakh. Nevertheless, without being rude, I bet that even then you are unable to flawlessly produce a poem or even a brief text in Kazakh yourself.

OK, I see your desperation, and I take your analogy (I’m a scholar myself, not a programmer): if someone came to you with the Iliad and explained that he doesn’t know a word of Kazakh but wants all of Homer’s poem, every line, every word, every nuance, expressed in Kazakh with the help of a grammar and a dictionary, you’d reply that this is not how learning languages works. You begin with simple sentences and work your way up. You have shown us several times examples that don’t work, and I have expressed my suspicion that this may be due to using the correspondence module. You weren’t sure whether you need it or not; which is something only you can know. What does this module offer that can’t be accomplished otherwise? If you look at the documentation of the module, you see that the \startletter … \stopletter pair starts an environment within a \starttext … \stoptext context document. When you look at your setup, you will see that you have a \startletter … \stopletter, then a few setups, and then a \starttext … \stoptext document. I’m not a programmer, but I see that this will not work. 

So for some simple rules: when you process an xml buffer (or document), you define xmlsetups for the different xml elements. When you write \xmlprocessbuffer, that’s when these elements will be processed - which means: that’s when your document will be built. You can’t go through your xml buffer/document and then add further text (well you can, but that’s more complicated), so what you have to do is add your text (for the sake of this example: \input knuth) WITHING THESE SETUPS. So let’s start with a simple document that will work:

\startbuffer[participants]
<contacts>
  <contact class='participant' label='Hendriks'>
    <formalname>Hendriks</formalname>
    <informalname>Karel</informalname>
    <prefix>mr.</prefix>
    <initials>K.</initials>
    <city>Arnhem</city>
    <address>
      <p>Mr. K. Hendriks</p>
      <p>Grotestraat 5</p>
      <p>1234 BB Arnhem</p>
    </address>
    <kix>1234bb5</kix>
  </contact>
  <contact class='participant' label='Janssen'>
    <formalname>Janssen</formalname>
    <informalname>Piet</informalname>
    <initials>P.</initials>
    <prefix>mr.</prefix>
    <city>Nijmegen</city>
    <address>
     <p>Mr. P. Janssen</p>
     <p>Kortestraat 8</p>
     <p>1234 AA Nijmegen</p>
    </address>
    <kix>1234aa8</kix>
  </contact>
</contacts>
\stopbuffer

\startxmlsetups xml:setups
\xmlsetsetup{#1}{contacts|contact|formalname|informalname|prefix|initials|address|city|text|kix|p}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:setups}

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

\startxmlsetups xml:p
	\xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:contact
	\xmltext{#1}{/address}
	\blank [3*line]
	Subject: your life in \xmltext{#1}{/city}
	\blank [2*line]
	Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},
	\blank [line]
	\input knuth \relax

	Kind regards
	\blank [line]
	X
	\page
\stopxmlsetups

\setuppagenumbering [state=stop]

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

So you see what I’m doing here: I process every simple <contact> element, and I add all the stuff that will go into the letter for every single contact. Start with this document and then find out what you need in addition: a logo, some fancy lines across the letters, a special placement for the address and the subject, etc.? I’m guessing that it would be easier to do this with simple setup commands rather than using the correspondence module, but we have no idea what you need to accomplish. Once you find out what’s missing, you can modify the example and ask additional questions. But, to take your analogy: don’t start with irregular verbs and special cases that will complicate the picture. How is this line

\setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date

from your original example relevant to your problem? And again: please don’t give me the “I’m not a programmer” response; I’m not a programmer either, but I know that you have to reduce the complexity in problems to find a solution. You’re adding extra complexity.

The way I describe above is the easiest path. There are other approaches, of course: you can combine elements from several xml documents, or you can process the xml data with Lua. All of this may be unnecessary in your case, but nobody will be able to help unless we understand what you need. And to explain this, you will have to start with simple examples, not with a complex document.

Sorry for being somewhat stern, but I’m sure you would give similar advice to your students…

All best

Thomas

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* letters in context mkiv
@ 2017-07-30 12:15 r.ermers
  2017-07-30 15:38 ` Schmitz Thomas A.
       [not found] ` <597DFB2C.60001@gmail.com>
  0 siblings, 2 replies; 16+ messages in thread
From: r.ermers @ 2017-07-30 12:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/html, Size: 10281 bytes --]

[-- Attachment #1.2: brieven2mkiv.pdf --]
[-- Type: application/pdf, Size: 15333 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* letters in context mkiv
@ 2017-07-28  6:18 r.ermers
  0 siblings, 0 replies; 16+ messages in thread
From: r.ermers @ 2017-07-28  6:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Dear Contex’ers,

I have used the letter module of mkii for serial letters with an xml database (see example), but now I would like to step forward to mkiv.

I have found out how to process the xml data from an xml file (now in the buffer). The recipient’s address neatly shows up in the designed place. (See pdf). So far, everything seems OK. 

Yet when I add text, only the text appears, and all address data from the xml file disappear.

You can try it out by uncommenting the %\input knuth or %tekst lines.

I have tried various options, but for now I have no idea how to proceed further.

Context Version: 2017.07.17 00:20
Lua 5.2.4, This is LuaTeX, Version 1.05.0.

Your help is much appreciated!

Kind regards,

Robert

\usemodule[letter]

\setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date
\setupletteroptions[language=netherlands,bodyfont={rm,10pt},whitespace=1.5ex]

\startbuffer[participants]
<contacts>
  <contact class='participant' label='Hendriks'>
    <formalname>Hendriks</formalname>
    <informalname>Karel</informalname>
    <prefix>mr.</prefix>
    <initials>K.</initials>
    <city>Arnhem</city>
    <address>
      <p>Mr. K. Hendriks</p>
      <p>Grotestraat 5</p>
      <p>1234 BB Arnhem</p>
    </address>
    <kix>1234bb5</kix>
  </contact>
  <contact class='participant' label='Janssen'>
    <formalname>Janssen</formalname>
    <informalname>Piet</informalname>
    <initials>P.</initials>
    <prefix>mr.</prefix>
    <city>Nijmegen</city>
    <address>
     <p>Mr. P. Janssen</p>
     <p>Kortestraat 8</p>
     <p>1234 AA Nijmegen</p>
    </address>
    <kix>1234aa8</kix>
  </contact>
</contacts>
\stopbuffer

\startxmlsetups xml:setups
\xmlsetsetup{#1}{document|contacts|contact|prefix|initials|address|city|text|kix|p}{xml:*}
%\xmlsetsetup{\xmldocument}{text:p}{xml:paragraph}
\stopxmlsetups

\xmlregistersetup{xml:setups}

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

\startxmlsetups xml:contact

\setupletter
[toaddress={\xmlall{#1}{/address/p}\par\xmltext{#1}{/kix}}]

\defineletterelement[layer][address][example]%
    {\correspondenceparameter{toname}\\\correspondenceparameter{toaddress}\par}

%toname is not used in setupletter because toaddress contains all data.
%kix is used for adding a barcode to the address.

\setupletterlayer[address][alternative=example,y=6cm,x=12cm,color=red,style=\tfa\sans]

\startletter
  [opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},
   closing={Kind regards,},
   subject={subject: your life in \xmltext{#1}{/city}},
   signature={X}]

\stopletter

\stopxmlsetups

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

\startxmlsetups xml:p
\xmlflushtext{#1}\par
\stopxmlsetups

\starttext

%\input knuth

%tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst

\xmlprocessbuffer{main}{participants}{}

\stoptext

[-- Attachment #1.2.1: Type: text/html, Size: 2231 bytes --]

[-- Attachment #1.2.2: brieven2mkiv.pdf --]
[-- Type: application/pdf, Size: 15333 bytes --]

[-- Attachment #1.2.3: Type: text/html, Size: 5337 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

* letters in context mkiv
@ 2017-07-25 11:14 r.ermers
  0 siblings, 0 replies; 16+ messages in thread
From: r.ermers @ 2017-07-25 11:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Dear Contex’ers,

I use Context for many things. One of them is letters.
I have used the letter module of mkii with an xml database (see example), but now I would like to step forward to mkiv.

I have found out how to process the xml data from an xml file (now in the buffer). The recipient’s address neatly shows up in the designed place. (See pdf). So far, everything seems OK. 

Yet when I add text, only the text appears, and all address data from the xml file disappear.

You can try it out by uncommenting the %\input knuth or %tekst lines.

I have tried various options, but for now I have no idea how to proceed further.

Context Version: 2017.07.17 00:20
Lua 5.2.4, This is LuaTeX, Version 1.05.0.

Your help is much appreciated!

Kind regards,

Robert

\usemodule[letter]

\setuplanguage[nl][date={year, –, mm, –, dd}] % ISO 8601 date
\setupletteroptions[language=netherlands,bodyfont={rm,10pt},whitespace=1.5ex]

\startbuffer[participants]
<contacts>
  <contact class='participant' label='Hendriks'>
    <formalname>Hendriks</formalname>
    <informalname>Karel</informalname>
    <prefix>mr.</prefix>
    <initials>K.</initials>
    <city>Arnhem</city>
    <address>
      <p>Mr. K. Hendriks</p>
      <p>Grotestraat 5</p>
      <p>1234 BB Arnhem</p>
    </address>
    <kix>1234bb5</kix>
  </contact>
  <contact class='participant' label='Janssen'>
    <formalname>Janssen</formalname>
    <informalname>Piet</informalname>
    <initials>P.</initials>
    <prefix>mr.</prefix>
    <city>Nijmegen</city>
    <address>
     <p>Mr. P. Janssen</p>
     <p>Kortestraat 8</p>
     <p>1234 AA Nijmegen</p>
    </address>
    <kix>1234aa8</kix>
  </contact>
</contacts>
\stopbuffer

\startxmlsetups xml:setups
\xmlsetsetup{#1}{document|contacts|contact|prefix|initials|address|city|text|kix|p}{xml:*}
%\xmlsetsetup{\xmldocument}{text:p}{xml:paragraph}
\stopxmlsetups

\xmlregistersetup{xml:setups}

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

\startxmlsetups xml:contact

\setupletter
[toaddress={\xmlall{#1}{/address/p}\par\xmltext{#1}{/kix}}]

\defineletterelement[layer][address][example]%
    {\correspondenceparameter{toname}\\\correspondenceparameter{toaddress}\par}

%toname is not used in setupletter because toaddress contains all data.
%kix is used for adding a barcode to the address.

\setupletterlayer[address][alternative=example,y=6cm,x=12cm,color=red,style=\tfa\sans]

\startletter
  [opening={Dear \xmltext{#1}{/prefix} \xmltext{#1}{/formalname},},
   closing={Kind regards,},
   subject={subject: your life in \xmltext{#1}{/city}},
   signature={X}]

\stopletter

\stopxmlsetups

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

\startxmlsetups xml:p
\xmlflushtext{#1}\par
\stopxmlsetups

\starttext

%\input knuth

%tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst tekst

\xmlprocessbuffer{main}{participants}{}

\stoptext

[-- Attachment #1.2.1: Type: text/html, Size: 1904 bytes --]

[-- Attachment #1.2.2: brieven2mkiv.pdf --]
[-- Type: application/pdf, Size: 15333 bytes --]

[-- Attachment #1.2.3: Type: text/html, Size: 4955 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-08-01 12:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-28  6:18 letters in context mkiv r.ermers
  -- strict thread matches above, loose matches on Subject: below --
2017-07-30 12:15 r.ermers
2017-07-30 15:38 ` Schmitz Thomas A.
2017-07-31  8:09   ` r.ermers
     [not found] ` <597DFB2C.60001@gmail.com>
2017-07-31 10:48   ` r.ermers
2017-07-31 15:23     ` Pablo Rodriguez
2017-07-31 16:58       ` r.ermers
2017-07-31 17:23         ` Pablo Rodriguez
2017-07-31 21:57         ` Schmitz Thomas A.
2017-08-01  7:55           ` r.ermers
2017-08-01  8:46             ` Schmitz Thomas A.
2017-08-01 10:15               ` r.ermers
2017-08-01 11:17                 ` Schmitz Thomas A.
2017-08-01 12:04                   ` r.ermers
2017-07-28  6:18 r.ermers
2017-07-25 11:14 r.ermers

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).