[NTG-context] XML - accessing parental children attribute (was: some troubles)

Procházka Lukáš Ing. - Pontex s. r. o. LPr at pontex.cz
Wed Feb 18 08:31:00 CET 2015


Hello,

thanks Hans, this works perfectly...

Lukas


> \startbuffer[demo]
> <a>
>    <aa number="--">--</aa>
>    <aa number="a1">A1</aa>
>    <ax number="x1">X1</ab>
>    <ab number="b1">B1</ab>
>    <aa number="--">--</aa>
>    <aa number="a2">A2</aa>
>    <ax number="x2">X2</ab>
>    <ab number="b2">B2</ab>
>    <aa number="--">--</aa>
>    <aa number="a3">A3</aa>
>    <ax number="x3">X3</ab>
>    <ab number="b3">B3</ab>
> </a>
> \stopbuffer
>
> \startxmlsetups xml:initialize
>      \xmlsetsetup{#1}{*}{xml:*}
> \stopxmlsetups
>
> \startxmlsetups xml:a
>      \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:aa
>      \par
>      <aa>\xmlflush{#1}</aa>
>      \par
> \stopxmlsetups
>
> \startxmlsetups xml:ax
>      \par
>      <ax>\xmlflush{#1}</ax>
>      \par
> \stopxmlsetups
>
> \startxmlsetups xml:ab
>      \par
>      <ab>
>      \xmlflush{#1}:\space
>      aa: \xmlfilter{#1}{reverse-sibling::[tag() ==
> 'aa']/attribute('number')}\space
>      ax: \xmlfilter{#1}{reverse-sibling::[tag() ==
> 'ax']/attribute('number')}\space
>      </ab>
>      \par
> \stopxmlsetups
>
> \xmlregistersetup{xml:initialize}
>
> \starttext
>    \xmlprocessbuffer{main}{demo}{}
> \stoptext


-- 
Ing. Lukáš Procházka | mailto:LPr at pontex.cz
Pontex s. r. o.      | mailto:pontex at pontex.cz | http://www.pontex.cz
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751
Fax: +420 244 461 038



More information about the ntg-context mailing list