Re: [NTG-context] coupling node name to xmlsetup

2018-09-13 Thread Taco Hoekwater
Hi,

I’ll bump this, because the idea sounded intriguing to me as well. 

> On 12 Sep 2018, at 14:15, Hans van der Meer  wrote:
> 
> Suppose we have node  and want to execute the xmlsetup: 
> mysetups:examplehandler on it. The idea is not to hardcode this but to do it 
> on the fly from .
> 
> The following \xmlsetup comes into mind:
> 
> \startxmlsetups mysetups:definesetup
>   \xmlsetsetup{#1}{\xmlatt{#1}{name}}{mysetups:examplehandler}

I assume that should have been 

  \xmlsetsetup{\xmldocument}{\xmlatt{#1}{name}}{mysetups:examplehandler}

but with that, it does not work either. My MWE looks like this:

\enabletrackers[lxml.*]

\startxmlsetups mysetups:examplehandler
  examplehandler
\stopxmlsetups

\startxmlsetups mysetups:definesetup
  definesetup\par
  \xmlsetsetup{\xmldocument}{\xmlatt{#1}{name}}{mysetups:examplehandler}
\stopxmlsetups

\startxmlsetups mysetups:xml
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups mysetups:oursetups
  \xmlsetsetup{\xmldocument}{*}{+}
  \xmlsetsetup{\xmldocument}{xml|definesetup}{mysetups:*}
\stopxmlsetups

\xmlregistersetup{mysetups:oursetups}

\starttext
\startbuffer[xml]


   whatever


   inputted text


\stopbuffer

\xmlprocessbuffer{main}{xml}{}

\stoptext



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

[NTG-context] coupling node name to xmlsetup

2018-09-12 Thread Hans van der Meer
Suppose we have node  and want to execute the xmlsetup: 
mysetups:examplehandler on it. The idea is not to hardcode this but to do it on 
the fly from .

The following \xmlsetup comes into mind:

\startxmlsetups mysetups:definesetup
\xmlsetsetup{#1}{\xmlatt{#1}{name}}{mysetups:examplehandler}
\stopxmlsetups
\startxmlsetups mysetups:examplehandler
...
\stopxmlsetups

But this is either the wrong call or there is something missing, because on 
input of  the examplehandler is not invoked.
How to?

dr. Hans van der Meer


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