[NTG-context] Re: XML processing beginner's question

2023-08-21 Thread Michael Löscher
Yes, I have done that. But I don't seem to have the basic context of how 
the processing works in order. All I have so far is this as a starting 
point:


\startxmlsetups xml:mysetup

\xmlsetsetup{main}{document|element|mdata|tdata|name|date|num|content|shortdescription|p}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:mysetup}

\startxmlsetups xml:mysetup:document
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:mysetup:element
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:mysetup:mdata
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:mysetup:tdata
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:mysetup:name
\xmlflush
\stopxmlsetups

\startxmlsetups xml:mysetup:num
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:mysetup:content
\xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:mysetup:shortdescription
\xmlflush{#1}
\stopxmlsetups

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

\starttext
  \xmlprocessbuffer {mysetup}{xmlcontent}{}
\stoptext

Am 21.08.2023 um 17:45 schrieb Thomas A. Schmitz:
Have you looked at chapter 3.10 "Testing" of the manual xml-mkiv.pdf? 
There are a lot of commands there that should help you, such as


\xmldoiftext {#1} {/mdata/date}
  {\bf \xmlflush {#1}}

or \xmldoifelsetext.

There's also \xmlfilter, which you can use to test for the content of 
tags. And of course, you can process in Lua and search for strings or 
use lpeg. However, your question is a bit vague now. Show us some code 
you have and we can take it from there; that's easier than writing the 
whole setup for you.


Thomas


On 8/21/23 17:29, Michael Löscher wrote:

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)
AA
BB

§ 2 Second (A second short description)
CC
DD

§ 3 Third (A third short description)
EE
FF
---

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


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

Michael

---
xml data:
\startbuffer[xmlcontent]


   
 
   What it is
   2023-08-01
 
 
   
 Description
 Another text
   
 
   
   
 
   hd1
   Header 1
 
 
   
 Text of Header 1
   
 
   
   
 
   1
   First
   A first short description
 
 
   
 AA
 BB
   
 
   
   
 
   2
   Second
   A second short description
 
 
   
 CC
 DD
   
 
   
   
 
   3
   Third
   A third short description
 
 
   
 EE
 FF
   
 
   

\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
___

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

[NTG-context] XML processing beginner's question

2023-08-21 Thread Michael Löscher

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)
AA
BB

§ 2 Second (A second short description)
CC
DD

§ 3 Third (A third short description)
EE
FF
---

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


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

Michael

---
xml data:
\startbuffer[xmlcontent]


  

  What it is
  2023-08-01


  
Description
Another text
  

  
  

  hd1
  Header 1


  
Text of Header 1
  

  
  

  1
  First
  A first short description


  
AA
BB
  

  
  

  2
  Second
  A second short description


  
CC
DD
  

  
  

  3
  Third
  A third short description


  
EE
FF
  

  

\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
___