[NTG-context] filtering xml

Hans Hagen pragma at wxs.nl
Tue Feb 22 09:59:56 CET 2011


On 22-2-2011 8:34, Thomas A. Schmitz wrote:

 > xml blob

	\xmlsetsetup{#1}{B/C/..[1]}{xml:C:first}

select all B
select all C in found B's
select first in all found



\startbuffer[test]
<A>
   <B>cat</B>
   <B><C>dog</C></B>
   <B><C>mouse</C></B>
   <B><C>donkey</C></B>
   <B>giraffe</B>
</A>
\stopbuffer

\startxmlsetups xml:testsetups
	\xmlsetsetup{#1}{A|B|C}{xml:*}
	\xmlsetsetup{#1}{B/C/..[1]}{xml:C:first}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

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

\startxmlsetups xml:C:first
	\color[red]{\xmlflush{#1}}
\stopxmlsetups

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

\starttext
     \xmlprocessbuffer{main}{test}{}
\stoptext

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list