On 2/28/2021 7:32 PM, David van Diepen wrote:
Hello,

My son is very much interested in genealogy. He already has collected
information on thousands of people. Now it would be nice to be able to
present this information in the form of a book. There is a possibility
to have this done by a commercial service, however then it's not
possible to adapt the format or to insert custom text. Media can be
added but not in the way we like it.

Genealogical information is stored as structured data. I have added a
fragment of an Gramps XML file below. In such a file there are events,
people, families and other groupings of data and these are linked by
handles.

What we would like to produce is a book with a number of blocks on
every page describing a family: Father, mother, dates of birth and
death, date of marriage, occupations and children. It would also be
good it there are references to the grandparents.

My question is: Where should I get started with a project in which a
document is generated automatically from data? As far as I know context
should be very suitable for this but I don't have any experience with
this. Until now I've used context to make documents without any data
being added automatically, except for the bibliography.

Thank you in advance,

David van Diepen

Example Gramps XML file is below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database PUBLIC "-//Gramps//DTD Gramps XML 1.7.1//EN"
"http://gramps-project.org/xml/1.7.1/grampsxml.dtd";>
<database xmlns="http://gramps-project.org/xml/1.7.1/";>
   <header>
     <created date="2021-02-03" version="5.1.2"/>
     <researcher>
     </researcher>
   </header>
   <events>
       <event handle="_eaa1eb8157f4e812f219719a7b" change="1612382260"
id="E1746">
       <type>Birth</type>
       <dateval val="1886-05-01"/>
       <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
       <citationref hlink="_eaa1eb815867f8610a89cf6ce74"/>
     </event>
     <event handle="_eaa1eb8158f53693508394c0c48" change="1612382260"
id="E1747">
       <type>Death</type>
       <dateval val="1886-05-18"/>
       <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
       <citationref hlink="_eaa1eb815964a4157b91beb0bcb"/>
     </event>
     <event handle="_eaa1eb99c423cc862cf41d591a7" change="1612382270"
id="E6977">
       <type>Marriage</type>
       <dateval val="1883-03-11"/>
       <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
       <citationref hlink="_eaa1eb99c4870fe758b76275a86"/>
     </event>
   </events>
   <people>
       <person handle="_eaa1eb8157e1aa01007c5a920d1" change="1612382260"
id="I0987">
       <gender>F</gender>
       <name type="Birth Name">
         <first>Catharina</first>
         <surname>Geldof</surname>
       </name>
       <eventref hlink="_eaa1eb8157f4e812f219719a7b" role="Primary"/>
       <eventref hlink="_eaa1eb8158f53693508394c0c48" role="Primary"/>
       <childof hlink="_eaa1eb79b3313e7e3c96019665c"/>
     </person>
      <person handle="_eaa1eb7a37226ca41e414cd2f36" change="1612382258"
id="I0049">
       <gender>M</gender>
       <name type="Birth Name">
         <first>Cornelis</first>
         <surname>Geldof</surname>
       </name>
       <eventref hlink="_eaa1eb7a3735b3bd6acb1a5aa1c" role="Primary"/>
       <eventref hlink="_eaa1eb7a3831437df21bf3f6924" role="Primary"/>
       <eventref hlink="_eaa1eb7a3942a2fb185331a9edf" role="Primary"/>
       <childof hlink="_eaa1eb7a39a2dfce87e06b0adab"/>
       <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
     </person>
     <person handle="_eaa1eb7a3a54ad77d5f29a821c9" change="1612382258"
id="I0050">
       <gender>F</gender>
       <name type="Birth Name">
         <first>Maatje</first>
         <surname>de Voogd</surname>
       </name>
       <eventref hlink="_eaa1eb7a3a731714abad9183560" role="Primary"/>
       <eventref hlink="_eaa1eb7a3b74da1e4ff36adcaab" role="Primary"/>
       <eventref hlink="_eaa1eb7a3c8685236291abfcbc9" role="Primary"/>
       <childof hlink="_eaa1eb7a3cd3853b21c39baab9a"/>
       <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
     </person>
   </people>
   <families>
     <family handle="_eaa1eb79b3313e7e3c96019665c" change="1612382261"
id="F0016">
       <rel type="Married"/>
       <father hlink="_eaa1eb7a37226ca41e414cd2f36"/>
       <mother hlink="_eaa1eb7a3a54ad77d5f29a821c9"/>
       <eventref hlink="_eaa1eb99c423cc862cf41d591a7" role="Family"/>
       <childref hlink="_eaa1eb79b0b8526fca40e502ca"/>
       <childref hlink="_eaa1eb815521c4281a23ee688d2"/>
       <childref hlink="_eaa1eb8157e1aa01007c5a920d1"/>
       <childref hlink="_eaa1eb815a9647c05a8560739f3"/>
       <childref hlink="_eaa1eb815d632b4145a6a964cd1"/>
       <childref hlink="_eaa1eb81603107eb844e1d0a1ce"/>
       <childref hlink="_eaa1eb816306fa3946fe9a88f1b"/>
       <childref hlink="_eaa1eb81651258b725548dba1dc"/>
       <childref hlink="_eaa1eb8167243fc0ae5b90986c1"/>
       <childref hlink="_eaa1eb818cf2e229c88b97b192e"/>
       <childref hlink="_eaa1eb818ec579ca7141aa0efbe"/>
       <childref hlink="_eaa1eb8191314350b99ec3ade67"/>
     </family>
  </families>

\startbuffer[test]
<?xml version="1.0" encoding="UTF-8"?>
<database xmlns="http://gramps-project.org/xml/1.7.1/";>
  <header>
    <created date="2021-02-03" version="5.1.2"/>
    <researcher>
    </researcher>
  </header>
  <events>
<event handle="_eaa1eb8157f4e812f219719a7b" change="1612382260" id="E1746">
      <type>Birth</type>
      <dateval val="1886-05-01"/>
      <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
      <citationref hlink="_eaa1eb815867f8610a89cf6ce74"/>
    </event>
<event handle="_eaa1eb8158f53693508394c0c48" change="1612382260" id="E1747">
      <type>Death</type>
      <dateval val="1886-05-18"/>
      <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
      <citationref hlink="_eaa1eb815964a4157b91beb0bcb"/>
    </event>
<event handle="_eaa1eb99c423cc862cf41d591a7" change="1612382270" id="E6977">
      <type>Marriage</type>
      <dateval val="1883-03-11"/>
      <place hlink="_eaa1eb79a6e5b1f282813dc5826"/>
      <citationref hlink="_eaa1eb99c4870fe758b76275a86"/>
    </event>
  </events>
  <people>
<person handle="_eaa1eb8157e1aa01007c5a920d1" change="1612382260" id="I0987">
      <gender>F</gender>
      <name type="Birth Name">
        <first>Catharina</first>
        <surname>Geldof</surname>
      </name>
      <eventref hlink="_eaa1eb8157f4e812f219719a7b" role="Primary"/>
      <eventref hlink="_eaa1eb8158f53693508394c0c48" role="Primary"/>
      <childof hlink="_eaa1eb79b3313e7e3c96019665c"/>
    </person>
<person handle="_eaa1eb7a37226ca41e414cd2f36" change="1612382258" id="I0049">
      <gender>M</gender>
      <name type="Birth Name">
        <first>Cornelis</first>
        <surname>Geldof</surname>
      </name>
      <eventref hlink="_eaa1eb7a3735b3bd6acb1a5aa1c" role="Primary"/>
      <eventref hlink="_eaa1eb7a3831437df21bf3f6924" role="Primary"/>
      <eventref hlink="_eaa1eb7a3942a2fb185331a9edf" role="Primary"/>
      <childof hlink="_eaa1eb7a39a2dfce87e06b0adab"/>
      <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
    </person>
<person handle="_eaa1eb7a3a54ad77d5f29a821c9" change="1612382258" id="I0050">
      <gender>F</gender>
      <name type="Birth Name">
        <first>Maatje</first>
        <surname>de Voogd</surname>
      </name>
      <eventref hlink="_eaa1eb7a3a731714abad9183560" role="Primary"/>
      <eventref hlink="_eaa1eb7a3b74da1e4ff36adcaab" role="Primary"/>
      <eventref hlink="_eaa1eb7a3c8685236291abfcbc9" role="Primary"/>
      <childof hlink="_eaa1eb7a3cd3853b21c39baab9a"/>
      <parentin hlink="_eaa1eb79b3313e7e3c96019665c"/>
    </person>
  </people>
  <families>
<family handle="_eaa1eb79b3313e7e3c96019665c" change="1612382261" id="F0016">
      <rel type="Married"/>
      <father hlink="_eaa1eb7a37226ca41e414cd2f36"/>
      <mother hlink="_eaa1eb7a3a54ad77d5f29a821c9"/>
      <eventref hlink="_eaa1eb99c423cc862cf41d591a7" role="Family"/>
      <childref hlink="_eaa1eb8157e1aa01007c5a920d1"/>
    </family>
 </families>
</database>
\stopbuffer

%  mapping

\startxmlsetups xml:mysetups
    \xmlsetsetup{#1}{database|families|family|person|childref}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:mysetups}

\startxmlsetups xml:database
    \xmlfirst{#1}{/families}
\stopxmlsetups

\startxmlsetups xml:families
    \xmlall{#1}{/family}
\stopxmlsetups

\startxmlsetups xml:person
    \starttabulate[|||]
        \BC name    \NC \xmlfirst{#1}{name/first/text()} \NC \NR
        \BC surname \NC \xmlfirst{#1}{name/surname/text()} \NC \NR
        \BC gender  \NC \xmlfirst{#1}{gender} \NC \NR
    \stoptabulate
\stopxmlsetups

\startxmlsetups xml:childref
%     \startsubsubject[title=Child]

\xmlfirst{main}{/database/people/person[@handle='\xmlatt{#1}{hlink}']}
%     \stopsubsubject
\stopxmlsetups

\startxmlsetups xml:family
    \xmldoif {#1}{/father} {
        \startsubject[title=Father]

\xmlfirst{main}{/database/people/person[@handle='\xmlattribute{#1}{/father}{hlink}']}
        \stopsubject
    }
    \xmldoif {#1}{/mother} {
        \startsubject[title=Mother]

\xmlfirst{main}{/database/people/person[@handle='\xmlattribute{#1}{/mother}{hlink}']}
        \stopsubject
    }
    \xmldoif {#1}{/childref} {
        \startsubject[title=Children]
            \xmlall{#1}{/childref}
        \stopsubject
    }
\stopxmlsetups

\starttext
%     \xmlprocess{main}{somefile.xml}{}
    \xmlprocessbuffer{main}{test}{}
\stoptext


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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 via email to