ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: Hans van der Meer <havdmeer@ziggo.nl>
Cc: NTG ConTeXt <ntg-context@ntg.nl>
Subject: Re: removing and reinstating xmlsetup's
Date: Fri, 31 Aug 2018 10:33:49 +0200	[thread overview]
Message-ID: <7f25ef7e-e948-32e3-5545-adc18bf69269@xs4all.nl> (raw)
In-Reply-To: <8346B0D7-1C10-4D3C-8B91-F1DC29E04B55@ziggo.nl>

On 8/30/2018 10:11 AM, Hans van der Meer wrote:
> 
>> On 30 Aug 2018, at 00:53, Hans Hagen <j.hagen@xs4all.nl 
>> <mailto:j.hagen@xs4all.nl>> wrote:
>>
>> On 8/29/2018 5:54 PM, Hans van der Meer wrote:
>>> Doing: \xmlremovesetup{SETUP}
>>> does not seems to have an effect.
>>> Is it possible to deactivate a xml setup and reinstate at at a later 
>>> point in time?
>> normally one uses modes for that (inside the setup)
>>
>> ir you can decide for explicit filtering (\xmlfilter)
>>
> I cannot imagine how to accomplish it that way, given my intentions.
> 
> Solved it with a global if (not so happy with global code, but could not 
> think of a neater, local solution).
> All other solutions I tried typeset multiple copies of <subsubnode>
> 
> <topnode>
> <subnode>
> <subsubnode>
> </subsubnode>
> </subnode>
> </topnode>
> 
> \startxmlsetups process:topnode  (structures the output, collects all 
> <subsubnode>s here)
> \global\topleveltrue
> \xmlall{#1}{subsubnode}
> \global\toplevelfalse
> \stopxmlsetups
> \startxmlsetups process:subsubnode
> \iftoplevel
> …
> \fi
> \stopxmlsetups
\startxmlsetups process:topnode
	\globalenablemode[toplevel]
         \xmlall{#1}{subsubnode}
	\globaldisablemode[toplevel]
\stopxmlsetups

\startxmlsetups process:subsubnode
	\doifmode {toplevel} {
         …
	}
\stopxmlsetups

you can also filter, i.e. explcitly apply setups

\startxmlsetups process:topnode
     \xmlfilter{#1}{subsubnode/command(xml:foo)}
\stopxmlsetups

if they are really topnodes you can do (watch the /):

\startxmlsetups process:topnode
     \xmlfilter{#1}{/subsubnode/command(xml:foo)}
\stopxmlsetups



-----------------------------------------------------------------
                                           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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2018-08-31  8:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 15:54 Hans van der Meer
2018-08-29 22:53 ` Hans Hagen
2018-08-30  8:11   ` Hans van der Meer
2018-08-31  8:33     ` Hans Hagen [this message]

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=7f25ef7e-e948-32e3-5545-adc18bf69269@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=havdmeer@ziggo.nl \
    --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).