ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: [NTG-context] Re: XML processing beginner's question
Date: Mon, 21 Aug 2023 19:08:32 +0200	[thread overview]
Message-ID: <1588a8b3-d43f-89aa-6b8b-0dd671b57706@freedom.nl> (raw)
In-Reply-To: <a3a4e966-822b-21b2-4b43-fb522f834eb1@uni-bonn.de>

On 8/21/2023 6:56 PM, Thomas A. Schmitz wrote:
> On 8/21/23 18:36, Michael Löscher wrote:
>> Thank you so far. But what I would like to understand first ist how 
>> the different setups work togehter. How are they processed? What is 
>> the order of processing, which are the stets taken by the enginge when 
>> processing an xml document? Without understanding how that works, it 
>> is not possible to apply certain tests on the xml nodes.
>>
> As the manual mk.pdf, chapter XVII states: it's a mixture of streaming 
> parser and tree manipulation. The whole xml document is transformed into 
> a Lua table and then processed. But I definitely get the "do my homework 
> for me" vibe, so this will be all from me.
in addition:

you need a bit of imagination because basically (depends a bit on what 
you do) one big nested expansion is going on, as Thomas explained: using 
setups which are basically macros. The #1 is the current node (but you 
can store it in a macro and use it later if needed). So, only references 
are passed around.

for thomas: we now also have (in lmtx)

\ifxml         {id}{pattern}      \else \fi
\ifxmltext     {id}{pattern}      \else \fi
\ifxmlatt      {id}{name}{value}  \else \fi
\ifxmlattempty {id}{pattern}      \else \fi
\ifxmlempty    {id}{pattern}      \else \fi
\ifxmlselfempty{id}               \else \fi

which in some cases is more efficient

there is also \xmllastatt etc which can be used after a test which 
avoids a second lookup

Hans



-----------------------------------------------------------------
                                           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 / 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 17:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-21 15:29 [NTG-context] " Michael Löscher
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 [this message]
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=1588a8b3-d43f-89aa-6b8b-0dd671b57706@freedom.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@freedom.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).