ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XML ConTeXt
@ 2010-11-02 19:50 Daniel Grycman
  2010-11-02 20:22 ` Jano Kula
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Grycman @ 2010-11-02 19:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello list,

I'm working with XML in ConTeXt. Now I want parse a XML-File with the
following structure, which is an export from a database.

<?xml version="1.0" encoding="UTF-8"?>
<personal>
    <person>
        <Name></Name>
        <Vorname></Vorname>
        <Titel></Titel>
        <Bezeichnung></Bezeichnung>
        <Mail></Mail>
        <Raum></Raum>
        <Telefon></Telefon>
    </person>


I'm using this ConTeXt script.

\setuppapersize [A4,landscape][A4,landscape]
\usemodule [simplefonts]
\setmainfont[rubscalatz]
\setsansfont[rubflama]
\startxmlsetups xml:personen:base % associate setups with elements
\xmlsetsetup{personen}{personal|person}{xml:personen:*}
\stopxmlsetups
\xmlregisterdocumentsetup{personen}{xml:personen:base}

\startxmlsetups xml:personen:personal
\title{Personalverzeichnis}
\placelist[chapter]
\page
\xmlflush{#1} 
\stopxmlsetups

\startxmlsetups xml:personen:personal:person % associate setups with
elements
\bTABLE
\bTR \bTD {/Name} \eTD \eTR
\eTABLE
\stopxmlsetups

\starttext
\xmlprocessfile{personen}{personen.xml}{}
\stoptext


The generated PDF-file only consists of one page with the chapter
"Personalverzeichnis". Can anybody tell me, where the mistake is?

Daniel


___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML ConTeXt
  2010-11-02 19:50 XML ConTeXt Daniel Grycman
@ 2010-11-02 20:22 ` Jano Kula
  2010-11-02 21:17   ` Daniel Grycman
  0 siblings, 1 reply; 7+ messages in thread
From: Jano Kula @ 2010-11-02 20:22 UTC (permalink / raw)
  To: ntg-context

Hi Daniel,

On 11/02/2010 08:50 PM, Daniel Grycman wrote:
> Hello list,
>
> I'm working with XML in ConTeXt. Now I want parse a XML-File with the
> following structure, which is an export from a database.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <personal>
>      <person>
>          <Name></Name>
>          <Vorname></Vorname>
>          <Titel></Titel>
>          <Bezeichnung></Bezeichnung>
>          <Mail></Mail>
>          <Raum></Raum>
>          <Telefon></Telefon>
>      </person>

</personal>

First, there is nothing to flush in the elements. You want to flush 
content of the elements (now empty), or their names?


> \setuppapersize [A4,landscape][A4,landscape]
> \usemodule [simplefonts]
> \setmainfont[rubscalatz]
> \setsansfont[rubflama]
> \startxmlsetups xml:personen:base % associate setups with elements
> \xmlsetsetup{personen}{personal|person}{xml:personen:*}
> \stopxmlsetups
> \xmlregisterdocumentsetup{personen}{xml:personen:base}
>
> \startxmlsetups xml:personen:personal
> \title{Personalverzeichnis}
> \placelist[chapter]
> \page
> \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:personen:personal:person

   \startxmlsetups xml:personen:person

   this is above registered xmlsetup

> \bTABLE
> \bTR \bTD {/Name} \eTD \eTR

\bTR \bTD \xmltext{#1}{/Name} \eTD \eTR

you either flush "named" element with \xmltext or all elements with 
\xmlflush

> \eTABLE
> \stopxmlsetups
>
> \starttext
> \xmlprocessfile{personen}{personen.xml}{}
> \stoptext
>
>
> The generated PDF-file only consists of one page with the chapter
> "Personalverzeichnis". Can anybody tell me, where the mistake is?
>
> Daniel


Jano

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML ConTeXt
  2010-11-02 20:22 ` Jano Kula
@ 2010-11-02 21:17   ` Daniel Grycman
  2010-11-02 21:38     ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Grycman @ 2010-11-02 21:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Jano and list,

it works so far. But how can I set up a tablehead for the whole table?

Daniel

Am 02.11.10 21:22 schrieb "Jano Kula" unter <jano.kula@tiscali.cz>:

>Hi Daniel,
>
>On 11/02/2010 08:50 PM, Daniel Grycman wrote:
>> Hello list,
>>
>> I'm working with XML in ConTeXt. Now I want parse a XML-File with the
>> following structure, which is an export from a database.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <personal>
>>      <person>
>>          <Name></Name>
>>          <Vorname></Vorname>
>>          <Titel></Titel>
>>          <Bezeichnung></Bezeichnung>
>>          <Mail></Mail>
>>          <Raum></Raum>
>>          <Telefon></Telefon>
>>      </person>
>
></personal>
>
>First, there is nothing to flush in the elements. You want to flush
>content of the elements (now empty), or their names?
>
>
>> \setuppapersize [A4,landscape][A4,landscape]
>> \usemodule [simplefonts]
>> \setmainfont[rubscalatz]
>> \setsansfont[rubflama]
>> \startxmlsetups xml:personen:base % associate setups with elements
>> \xmlsetsetup{personen}{personal|person}{xml:personen:*}
>> \stopxmlsetups
>> \xmlregisterdocumentsetup{personen}{xml:personen:base}
>>
>> \startxmlsetups xml:personen:personal
>> \title{Personalverzeichnis}
>> \placelist[chapter]
>> \page
>> \xmlflush{#1}
>> \stopxmlsetups
>>
>> \startxmlsetups xml:personen:personal:person
>
>   \startxmlsetups xml:personen:person
>
>   this is above registered xmlsetup
>
>> \bTABLE
>> \bTR \bTD {/Name} \eTD \eTR
>
>\bTR \bTD \xmltext{#1}{/Name} \eTD \eTR
>
>you either flush "named" element with \xmltext or all elements with
>\xmlflush
>
>> \eTABLE
>> \stopxmlsetups
>>
>> \starttext
>> \xmlprocessfile{personen}{personen.xml}{}
>> \stoptext
>>
>>
>> The generated PDF-file only consists of one page with the chapter
>> "Personalverzeichnis". Can anybody tell me, where the mistake is?
>>
>> Daniel
>
>
>Jano
>
>__________________________________________________________________________
>_________
>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://tex.aanhet.net
>archive  : http://foundry.supelec.fr/projects/contextrev/
>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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML ConTeXt
  2010-11-02 21:17   ` Daniel Grycman
@ 2010-11-02 21:38     ` Wolfgang Schuster
  2010-11-02 21:59       ` Daniel Grycman
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2010-11-02 21:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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


Am 02.11.2010 um 22:17 schrieb Daniel Grycman:

> Hi Jano and list,
> 
> it works so far. But how can I set up a tablehead for the whole table?

http://wiki.contextgarden.net/TABLE#Multipage_TABLEs

Wolfgang


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

[-- Attachment #2: Type: text/plain, Size: 486 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: XML ConTeXt
  2010-11-02 21:38     ` Wolfgang Schuster
@ 2010-11-02 21:59       ` Daniel Grycman
  2010-11-02 22:07         ` Aditya Mahajan
  2010-11-03  0:09         ` Jano Kula
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Grycman @ 2010-11-02 21:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Wolfgang and list,

I already used this multipage table. But the result showed a header for
every entry of   the xml-source. Is there an option which I missed?

\startxmlsetups xml:personen:person % associate setups with elements
\bTABLE[split=yes,width=11em]
\setupTABLE[row][*][width=\textwidth]
\bTABLEhead
\bTR \bTH Name \eTH \bTH Vorname \eTH \bTH Email-Adresse \eTH \bTH Raum
\eTH \bTH Telefon \eTH \eTR
\eTABLEhead
\bTABLEbody
\bTR \bTD \xmltext{#1}{/Titel} \xmltext{#1}{/Name}  \eTD \bTD
\xmltext{#1}{/Vorname} \eTD \bTD \xmltext{#1}{/Mail} \eTD \bTD
\xmltext{#1}{/Raum} \eTD \bTD \xmltext{#1}{/Telefon} \eTD \eTR
\eTABLEbody
\eTABLE
\stopxmlsetups



Daniel

Am 02.11.10 22:38 schrieb "Wolfgang Schuster" unter
<schuster.wolfgang@googlemail.com>:

>
>Am 02.11.2010 um 22:17 schrieb Daniel Grycman:
>
>
>Hi Jano and list,
>
>it works so far. But how can I set up a tablehead for the whole table?
>
>
>
>
>
>http://wiki.contextgarden.net/TABLE#Multipage_TABLEs
>
>Wolfgang
>
>__________________________________________________________________________
>_________
>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://tex.aanhet.net
>archive  : http://foundry.supelec.fr/projects/contextrev/
>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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML ConTeXt
  2010-11-02 21:59       ` Daniel Grycman
@ 2010-11-02 22:07         ` Aditya Mahajan
  2010-11-03  0:09         ` Jano Kula
  1 sibling, 0 replies; 7+ messages in thread
From: Aditya Mahajan @ 2010-11-02 22:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

A side remark: Try to indent your context code so that it is easier to read
(just like you indent xml). For example (adding | so that the email client 
does not reformt it)

| \startxmlsetups xml:personen:person % associate setups with elements
|   \bTABLE[split=yes,width=11em]
|     \setupTABLE[row][*][width=\textwidth]
|     \bTABLEhead
|       \bTR 
|         \bTH Name          \eTH 
|         \bTH Vorname       \eTH 
|         \bTH Email-Adresse \eTH 
|         \bTH Raum          \eTH 
|         \bTH Telefon       \eTH
|       \eTR
|     \eTABLEhead
|     \bTABLEbody
|       \bTR 
|         \bTD \xmltext{#1}{/Titel} \xmltext{#1}{/Name}   \eTD 
|         \bTD \xmltext{#1}{/Vorname}                     \eTD 
|         \bTD \xmltext{#1}{/Mail}                        \eTD 
|         \bTD \xmltext{#1}{/Raum}                        \eTD 
|         \bTD \xmltext{#1}{/Telefon}                     \eTD 
|       \eTR
|     \eTABLEbody
|   \eTABLE
| \stopxmlsetups

This makes it much easier to see what is going on.

Aditya
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: XML ConTeXt
  2010-11-02 21:59       ` Daniel Grycman
  2010-11-02 22:07         ` Aditya Mahajan
@ 2010-11-03  0:09         ` Jano Kula
  1 sibling, 0 replies; 7+ messages in thread
From: Jano Kula @ 2010-11-03  0:09 UTC (permalink / raw)
  To: ntg-context

On 11/02/2010 10:59 PM, Daniel Grycman wrote:
> Hi Wolfgang and list,
>
> I already used this multipage table. But the result showed a header for
> every entry of   the xml-source. Is there an option which I missed?

No option, you want to set up the header only once, hence you need to 
typeset it in the parent element of multiple <person> elements, here 
<personal>.

\startxmlsetups xml:personen:personal
\title{Personalverzeichnis}
\placelist[chapter]
\page
  % open table
  \bTABLE[split=yes,width=11em]
  \setupTABLE[row][*][width=\textwidth]
  \bTABLEhead
  \bTR \bTH Name \eTH \bTH Vorname \eTH \bTH Email-Adresse \eTH \bTH Raum
  \eTH \bTH Telefon \eTH \eTR
  \eTABLEhead
  \bTABLEbody
     % and now deeper to multiple persons (rows)
     \xmlflush{#1}
  % close table
  \eTABLEbody
  \eTABLE
\stopxmlsetups

\startxmlsetups xml:personen:person
   % here every person generates one row
   \bTR \bTD \xmltext{#1}{/Titel} \xmltext{#1}{/Name}  \eTD \bTD
   \xmltext{#1}{/Vorname} \eTD \bTD \xmltext{#1}{/Mail} \eTD \bTD
   \xmltext{#1}{/Raum} \eTD \bTD \xmltext{#1}{/Telefon} \eTD \eTR
\stopxmlsetups

Jano

> \startxmlsetups xml:personen:person % associate setups with elements
> \bTABLE[split=yes,width=11em]
> \setupTABLE[row][*][width=\textwidth]
> \bTABLEhead
> \bTR \bTH Name \eTH \bTH Vorname \eTH \bTH Email-Adresse \eTH \bTH Raum
> \eTH \bTH Telefon \eTH \eTR
> \eTABLEhead
> \bTABLEbody
> \bTR \bTD \xmltext{#1}{/Titel} \xmltext{#1}{/Name}  \eTD \bTD
> \xmltext{#1}{/Vorname} \eTD \bTD \xmltext{#1}{/Mail} \eTD \bTD
> \xmltext{#1}{/Raum} \eTD \bTD \xmltext{#1}{/Telefon} \eTD \eTR
> \eTABLEbody
> \eTABLE
> \stopxmlsetups
>
>
>
> Daniel
>
> Am 02.11.10 22:38 schrieb "Wolfgang Schuster" unter
> <schuster.wolfgang@googlemail.com>:
>
>>
>> Am 02.11.2010 um 22:17 schrieb Daniel Grycman:
>>
>>
>> Hi Jano and list,
>>
>> it works so far. But how can I set up a tablehead for the whole table?
>>
>>
>>
>>
>>
>> http://wiki.contextgarden.net/TABLE#Multipage_TABLEs
>>
>> Wolfgang
>>
>> __________________________________________________________________________
>> _________
>> 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://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2010-11-03  0:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 19:50 XML ConTeXt Daniel Grycman
2010-11-02 20:22 ` Jano Kula
2010-11-02 21:17   ` Daniel Grycman
2010-11-02 21:38     ` Wolfgang Schuster
2010-11-02 21:59       ` Daniel Grycman
2010-11-02 22:07         ` Aditya Mahajan
2010-11-03  0:09         ` Jano Kula

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