ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Fwd: Re:  xml-processing: missing or ungrouped '='
@ 2011-01-08 10:20 Achim Jander
  2011-01-08 11:15 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Achim Jander @ 2011-01-08 10:20 UTC (permalink / raw)
  To: ntg-context@ntg.nl >> mailing list for ConTeXt users


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

Achim
>
>>  %number=\xmldoifelse{#1}{/num}{yes}{no}, %works
>>  %ownnumber=\xmldoifelse{#1}{/num}{\xmlcommand{#1}{/num}{xml:ueberForceFlush}}{},%works
>>
>>
>>  %title={\xmlflush{#1}},%works
>
>  there's also \xmlraw{#1}{spec} which works nice with tables of content
>  as it passes the node id
>
>  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
>  -----------------------------------------------------------------
>

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Re: xml-processing: missing or ungrouped '='
  2011-01-08 10:20 Fwd: Re: xml-processing: missing or ungrouped '=' Achim Jander
@ 2011-01-08 11:15 ` Hans Hagen
  2011-01-08 12:39   ` Achim Jander
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2011-01-08 11:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Re: xml-processing: missing or ungrouped '='
  2011-01-08 11:15 ` Hans Hagen
@ 2011-01-08 12:39   ` Achim Jander
  2011-01-08 13:07     ` Thomas A. Schmitz
  0 siblings, 1 reply; 7+ messages in thread
From: Achim Jander @ 2011-01-08 12:39 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

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

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Re: xml-processing: missing or ungrouped '='
  2011-01-08 12:39   ` Achim Jander
@ 2011-01-08 13:07     ` Thomas A. Schmitz
  2011-01-08 14:23       ` Achim Jander
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas A. Schmitz @ 2011-01-08 13:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Jan 8, 2011, at 1:39 PM, Achim Jander wrote:

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

Excuse me, your example makes my head spin. Just from looking at it, there appears to be a fundamental error: you flush the content of <title> into a context \startchapter \stopchapter environment, AFAICS. But that's not right: the title is not the content of the chapter, but just its, errm, title. Can this be the reason why your code doesn't work? 

Thomas
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Re: xml-processing: missing or ungrouped '='
  2011-01-08 13:07     ` Thomas A. Schmitz
@ 2011-01-08 14:23       ` Achim Jander
  2011-01-08 17:00         ` Thomas A. Schmitz
  0 siblings, 1 reply; 7+ messages in thread
From: Achim Jander @ 2011-01-08 14:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz

Hi Thomas,
yes, of course you are right, but thats not making the problems. Its 
switched in while making a "minimal" example.
My problem or maxbe misunderstanding ist what I try to achieve with

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


or in a more complex way:

\startxmlsetups xml:title
\startchapter[

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

%stop here

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

what I want to do is to process the part between %start here and %stop 
here in another template
which I can reuse in different hierarchies. But I cant find no way to do so.

Greetings,
Achim


Am 08.01.2011 14:07, schrieb Thomas A. Schmitz:
> On Jan 8, 2011, at 1:39 PM, Achim Jander wrote:
>
>> Hi Hans,
>> sorry, i'll try to make it more clear:
> Excuse me, your example makes my head spin. Just from looking at it, there appears to be a fundamental error: you flush the content of<title>  into a context \startchapter \stopchapter environment, AFAICS. But that's not right: the title is not the content of the chapter, but just its, errm, title. Can this be the reason why your code doesn't work?
>
> Thomas
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Re: xml-processing: missing or ungrouped '='
  2011-01-08 14:23       ` Achim Jander
@ 2011-01-08 17:00         ` Thomas A. Schmitz
  2011-01-09 11:05           ` Achim Jander
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas A. Schmitz @ 2011-01-08 17:00 UTC (permalink / raw)
  To: mailing ConTeXt users list for


On Jan 8, 2011, at 3:23 PM, Achim Jander wrote:

> Hi Thomas,
> yes, of course you are right, but thats not making the problems. Its switched in while making a "minimal" example.
> My problem or maxbe misunderstanding ist what I try to achieve with

Sorry, but I still don't have the faintest idea what it is you want to do. Your minimal example doesn't show it, and your explanations differ from one message to the next. 

In one of your mails, you said this:

> 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

If this is what you're looking for, here's what I would suggest:

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

\startxmlsetups xml:testsetups
  \xmlsetsetup{\xmldocument}{a|b|chapter}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

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

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

\startxmlsetups xml:chapter
 \doifelse {\xmlatt{#1}{num}} {}
 {\setuphead[chapter][number=no]
  \startchapter[title={\xmlatt{#1}{title}}]
    \xmlflush{#1}
  \stopchapter}
 {\setuphead[chapter][number=yes]
  \setupheadnumber[chapter][\xmlatt{#1}{num}]
  \startchapter[title={\xmlatt{#1}{title}}] 
    \xmlflush{#1}
  \stopchapter}
\stopxmlsetups

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

It's trivial to change the test from an attribute to a <num> element>, but maybe that's not what you're looking for...

Thomas
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Re: xml-processing: missing or ungrouped '='
  2011-01-08 17:00         ` Thomas A. Schmitz
@ 2011-01-09 11:05           ` Achim Jander
  0 siblings, 0 replies; 7+ messages in thread
From: Achim Jander @ 2011-01-09 11:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thomas A. Schmitz

Hi Thomas,
sorry, I dont want to bother you. But in fact that is not what I'm 
looking for. Maybe its my fault that I mixed a - as I thougt - related 
problem in my second mail.
What I try to do is reduce redundancy. I cannot see where my 
explanations differ. In fact, I started with something like your 
example. But from a redundancy point of view
thats a mess so I tried to improve it. I came to something like

\startxmlsetups xml:chapter
   \startchapter[
      title={\xmlatt{#1}{title}},
      number=\xmldoifelse{#1}{./attribute('num')}{yes}{no},
      ownnumber=\xmldoifelse{#1}{./attribute('num')}{\xmlatt{#1}{num}}{}
   ]
     \xmlflush{#1}
   \stopchapter
\stopxmlsetups

which works fine and at least in my eyes has a clearer structure, but 
still some redundancy. Now is the point where I think the 
misunderstandings started, because now I tried two different approaches to
decrease redundancy: First step i tried to simplyfy *this* setup and 
came to something like

\startxmlsetups xml:chapter
   \startchapter[
      title={\xmlatt{#1}{title}},
      
\xmldoifelse{#1}{./attribute('num')}{ownnumber=\xmlatt{#1}{num}}{number=no},
   ]
     \xmlflush{#1}
   \stopchapter
\stopxmlsetups

which would nicely eliminate every redundance but doesn't work and 
complains about the mystery "missing or ungrouped '='"
The other attempt was - though i have not only to deal with chapters but 
up to about 15 hierarchies, all structured in a similar way,
so I tried to delegate the processing like

\startxmlsetups xml:fillTitleAtts
      title={\xmlatt{#1}{title}},
      number=\xmldoifelse{#1}{./attribute('num')}{yes}{no},
      ownnumber=\xmldoifelse{#1}{./attribute('num')}{\xmlatt{#1}{num}}{}
\stopxmlsetups

\startxmlsetups xml:chapter
   \startchapter[
      \xmlcommand{#1}{.}{xml:fillTitleAtts}
   ]
     \xmlflush{#1}
   \stopchapter
\stopxmlsetups

which would be nicely reusable but that attempt failed whith the same 
error message - thus I thought they are related.
I have to mention, that I try not to process one file but to write 
setups for a bunch of similar but slightly different books (we're doing 
about 1000 books per year),
so my setups have to be clearly structured and easyly adaptable to 
different needs.

I dunno if that can clear up things, if not, I think its not worth much 
more discussion.

Thanks,
Achim


Am 08.01.2011 18:00, schrieb Thomas A. Schmitz:
> On Jan 8, 2011, at 3:23 PM, Achim Jander wrote:
>
>> Hi Thomas,
>> yes, of course you are right, but thats not making the problems. Its switched in while making a "minimal" example.
>> My problem or maxbe misunderstanding ist what I try to achieve with
> Sorry, but I still don't have the faintest idea what it is you want to do. Your minimal example doesn't show it, and your explanations differ from one message to the next.
>
> In one of your mails, you said this:
>
>> 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
> If this is what you're looking for, here's what I would suggest:
>
> \startbuffer[test]
> <a>
>   <chapter title="some text">
>     <b>more text</b>
>     <b>more text</b>
>   </chapter>
>   <chapter num="333" title="more text">
>     <b>more text</b>
>     <b>more text</b>
>   </chapter>
> </a>
> \stopbuffer
>
> \startxmlsetups xml:testsetups
>    \xmlsetsetup{\xmldocument}{a|b|chapter}{xml:*}
> \stopxmlsetups
>
> \xmlregistersetup{xml:testsetups}
>
> \startxmlsetups xml:a
>    \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:b
>    \startparagraph
>    \xmlflush{#1}
>    \stopparagraph
> \stopxmlsetups
>
> \startxmlsetups xml:chapter
>   \doifelse {\xmlatt{#1}{num}} {}
>   {\setuphead[chapter][number=no]
>    \startchapter[title={\xmlatt{#1}{title}}]
>      \xmlflush{#1}
>    \stopchapter}
>   {\setuphead[chapter][number=yes]
>    \setupheadnumber[chapter][\xmlatt{#1}{num}]
>    \startchapter[title={\xmlatt{#1}{title}}]
>      \xmlflush{#1}
>    \stopchapter}
> \stopxmlsetups
>
> \starttext
> \xmlprocessbuffer{main}{test}{}
> \stoptext
>
> It's trivial to change the test from an attribute to a<num>  element>, but maybe that's not what you're looking for...
>
> Thomas
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-09 11:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-08 10:20 Fwd: Re: xml-processing: missing or ungrouped '=' Achim Jander
2011-01-08 11:15 ` Hans Hagen
2011-01-08 12:39   ` Achim Jander
2011-01-08 13:07     ` Thomas A. Schmitz
2011-01-08 14:23       ` Achim Jander
2011-01-08 17:00         ` Thomas A. Schmitz
2011-01-09 11:05           ` Achim Jander

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).