ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Michael Löscher" <mloescher27@outlook.de>
To: ntg-context@ntg.nl
Subject: [NTG-context] XML processing beginner's question
Date: Mon, 21 Aug 2023 17:29:36 +0200	[thread overview]
Message-ID: <GV2P251MB099380CFD6239892B6989149DD1EA@GV2P251MB0993.EURP251.PROD.OUTLOOK.COM> (raw)

Hello list,

having the xml data at the bottom, I would like to process it so that 
the result is like this:

---
What it is (e.g. bold formatted)
date: 2023-08-01 (italic)
Description (small font size)
Another text (small font size)

hd1 - Header 1

§ 1 First  (A first short description)
AAAAAAAAAA
BBBBBBBBBB

§ 2 Second (A second short description)
CCCCCCCCCC
DDDDDDDDDD

§ 3 Third (A third short description)
EEEEEEEEEE
FFFFFFFFFF
---

How can I process the <element>s differently? The first element contains 
a <date> tag and so it differs from the other ones. The second element's 
<name> tag contains the word "Header" which makes it different again. 
The other elements contain a <shortdescription> tag that they all have 
in common.

What could be the appropriate xml setups to generate the above output?

Michael

---
xml data:
\startbuffer[xmlcontent]
<?xml version="1.0" encoding="UTF-8" ?>
<document>
   <element>
     <mdata>
       <name>What it is</name>
       <date>2023-08-01</date>
     </mdata>
     <tdata>
       <content>
         <p>Description</p>
         <p>Another text</p>
       </content>
     </tdata>
   </element>
   <element>
     <mdata>
       <num>hd1</num>
       <name>Header 1</name>
     </mdata>
     <tdata>
       <content>
         <p>Text of Header 1</p>
       </content>
     </tdata>
   </element>
   <element>
     <mdata>
       <num>1</num>
       <name>First</name>
       <shortdescription>A first short description</shortdescription>
     </mdata>
     <tdata>
       <content>
         <p>AAAAAAAAAA</p>
         <p>BBBBBBBBBB</p>
       </content>
     </tdata>
   </element>
   <element>
     <mdata>
       <num>2</num>
       <name>Second</name>
       <shortdescription>A second short description</shortdescription>
     </mdata>
     <tdata>
       <content>
         <p>CCCCCCCCCC</p>
         <p>DDDDDDDDDD</p>
       </content>
     </tdata>
   </element>
   <element>
     <mdata>
       <num>3</num>
       <name>Third</name>
       <shortdescription>A third short description</shortdescription>
     </mdata>
     <tdata>
       <content>
         <p>EEEEEEEEEE</p>
         <p>FFFFFFFFFF</p>
       </content>
     </tdata>
   </element>
</document>
\stopbuffer

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2023-08-21 15:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-21 15:29 Michael Löscher [this message]
2023-08-21 15:45 ` [NTG-context] " Thomas A. Schmitz
2023-08-21 15:59   ` Michael Löscher
2023-08-21 16:19     ` Thomas A. Schmitz
     [not found]       ` <GV2P251MB09935835934E71D701185407DD1EA@GV2P251MB0993.EURP251.PROD.OUTLOOK.COM>
2023-08-21 16:56         ` Thomas A. Schmitz
2023-08-21 17:08           ` Hans Hagen via ntg-context
2023-08-22  6:53             ` denis.maier
2023-08-22  7:43               ` Hans Hagen via ntg-context
2023-08-22  7:06       ` denis.maier
2023-08-22  7:46         ` Hans Hagen via ntg-context
2023-08-21 19:21     ` Hans Hagen

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=GV2P251MB099380CFD6239892B6989149DD1EA@GV2P251MB0993.EURP251.PROD.OUTLOOK.COM \
    --to=mloescher27@outlook.de \
    --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).