[NTG-context] Fwd: Re: xml-processing: missing or ungrouped '='

Achim Jander achim at jander.de
Sat Jan 8 13:39:07 CET 2011


Hi Hans,
sorry, i'll try to make it more clear:

\startbuffer[test]
<a>
<title>some text</title>
<b>more text </b>
<b>more text </b>
<title><num>333</num>some text</title>
<b>more text </b>
<b>more text </b>
</a>
\stopbuffer

\startxmlsetups xml:testsetups
     \xmlsetsetup{\xmldocument}{a|b|title}{xml:*}
     \xmlsetsetup{\xmldocument}{num}{-}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

\startxmlsetups xml:b
     \startparagraph
     \xmlflush{#1}
     \stopparagraph
\stopxmlsetups

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

\startxmlsetups xml:getOwnNumber
\xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceFlush}}{}
\stopxmlsetups

\startxmlsetups xml:title
\startchapter[
%\xmldoifelse{#1}{/num}{ownnumber=\xmlcommand{#1}{/num}{xml:ueberForceFlush}}{number=no}
title={Testcase}
]
\xmlflush{#1}
\stopchapter
\stopxmlsetups

\setupheader[chapter][ownnumber=yes]

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

The relevant part is the line I've commented out because of the error.
In the setup xml:title I start the chapter. If the title comes with an 
number-element  I want to set ownnumber=..., but if they have no 
numbers, I want to set number=no
But this approach seems not to work. In my real application the problem 
is, that I have a more complex setting of defining the title=, 
ownnumber= etc attributes, but equal in different
(up to 15) hierarchies. So I tried to call inside the one setup another 
setup which should do the work, but also without success (this was my 
original example).
The plan was to call that setup from each hierarchy to avoid redundancy
It was like

\startxmlsetups xml:title
\startchapter[
%---> here call another template to set title= ownnumber= etc.
]
\xmlflush{#1}
\stopchapter
\stopxmlsetups

Here again the complete example:

\startbuffer[test]
<a>
<title>some text</title>
<b>more text </b>
<b>more text </b>
<title><num>333</num>some text</title>
<b>more text </b>
<b>more text </b>
</a>
\stopbuffer

\startxmlsetups xml:testsetups
     \xmlsetsetup{\xmldocument}{a|b|title}{xml:*}
     \xmlsetsetup{\xmldocument}{num}{-}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

\startxmlsetups xml:b
     \startparagraph
     \xmlflush{#1}
     \stopparagraph
\stopxmlsetups

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

\startxmlsetups xml:splitHeader %works not
number=\xmldoifelse{#1}{/num}{yes}{no},
ownnumber=\xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceFlush}}{}, 

title={\xmlflush{#1}},
\stopxmlsetups


\startxmlsetups xml:title
\startchapter[

%trying to call another template to set
%title=
%ownnumber=
%and other stuff...
\xmlcommand{#1}{.}{xml:splitHeader}


%number=\xmldoifelse{#1}{/num}{yes}{no}, %works
%ownnumber=\xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceFlush}}{},%works 

%title={\xmlflush{#1}},%works
]
\xmlflush{#1}
\stopchapter
\stopxmlsetups

\setupheader[chapter][ownnumber=yes]

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


Thanks you and have a nice Weekend
Achim


Am 08.01.2011 12:15, schrieb Hans Hagen:
> On 8-1-2011 11:20, Achim Jander wrote:
>>
>> Am 07.01.2011 22:52, schrieb Hans Hagen:
>>> On 7-1-2011 7:04, Achim Jander wrote:
>>>
>>>> \startxmlsetups xml:title
>>>> \startchapter[
>>>> \xmlcommand{#1}{.}{xml:splitHeader}
>>>
>>> title=...
>> Thanks.
>> So it seems not to be possible, to have the whatever= part inside an
>> xmlcommand?
>> I even tried things like
>>
>> \xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{ownnumber=123}}{number=no}
>>
>> to set either ownnumber or number but with the same error
>
> the \xmlcommand is completely unrelated to (say) \startchapter
>
> \xmlcommand{node number}{lpath expression}{setup id}
>
> so i have no clue what you want to do with it, unless ownnumber=123 is 
> the name of a setup
>
> Hans
>
>
> -----------------------------------------------------------------
>                                           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