ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: "Thomas A. Schmitz via ntg-context" <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: Xml filtering in Lua
Date: Wed, 16 Nov 2022 23:19:34 +0100	[thread overview]
Message-ID: <85566e11-a4c6-3cea-32ca-bb2d160dc7de@xs4all.nl> (raw)
In-Reply-To: <97c5e0b8-aab1-5742-ee72-a8ffdc9049cb@uni-bonn.de>

On 11/16/2022 10:09 PM, Thomas A. Schmitz via ntg-context wrote:
> On 11/16/22 21:51, Denis Maier via ntg-context wrote:
>> Just a quick question regarding this?
>> Is xml.filter equivalent to \xmlfilter? If so, how do you pass the 
>> match to a command as you'd do with \xmlfilter?
> 
> I'm still digesting and playing with Massi's reply; will probably be 
> back with more questions :-)
> 
> Anyway:
> 
> If you've filtered something out like this
> 
> local tree = xml.filter (t, "../chapter[@title='mytitle'")

always keep in mind that some expressions return a list of matches, that 
can be looped over and some commands just process the first

anyway, it can sometimes help to add

print(tstring(tree))

so see what you got

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:[~2022-11-16 22:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 16:10 Thomas A. Schmitz via ntg-context
2022-11-16 16:18 ` Duncan Hothersall via ntg-context
2022-11-16 17:33   ` Thomas A. Schmitz via ntg-context
2022-11-16 18:56     ` mf via ntg-context
2022-11-16 19:55       ` Thomas A. Schmitz via ntg-context
2022-11-16 20:51         ` Denis Maier via ntg-context
2022-11-16 21:09           ` Thomas A. Schmitz via ntg-context
2022-11-16 22:19             ` Hans Hagen via ntg-context [this message]
2022-11-16 19:56       ` mf via ntg-context
2022-11-17 10:04         ` Hans Hagen via ntg-context
2022-11-17 10:56           ` Thomas A. Schmitz via ntg-context
2022-11-20 18:19           ` Thomas A. Schmitz via ntg-context
2022-11-21  8:23             ` Thomas A. Schmitz via ntg-context

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=85566e11-a4c6-3cea-32ca-bb2d160dc7de@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@xs4all.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).