ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* defineXMLpush and grouping
@ 2002-02-08 20:58 Simon Pepping
  2002-02-10 20:36 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Pepping @ 2002-02-08 20:58 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

\defineXMLpush actually makes its definition when the pushed element
occurs. When a parent element defines a group, then the pushed element
is not visible outside that group. In \TeX\ this problem is usually
solved by doing a \gdef. Perhaps this problem can be solved in the
same manner, by providing a \gdefineXMLpush.

See attached example.

-- 
Simon Pepping
email: spepping@scaprea.hobby.nl

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: problem9.tex --]
[-- Type: text/x-tex, Size: 1156 bytes --]

% cont-en

\defineXMLenvironment[author]
% \defineXMLpush is defines the pushed element at the level at which
% it occurs;
	{\bgroup\defineXMLpush[affiliation]\startalignment[middle]\bfb}
	{1:\XMLpop{affiliation}\stopalignment 2:\XMLpop{affiliation}\egroup}
\defineXMLenvironment[address]
	{\startalignment[middle]\it}
	{\stopalignment}
\defineXMLgrouped[email] {Email: \tt}

\setupindenting[medium]

\starttext

\type{\defineXMLpush} actually makes its definition when the pushed
	element occurs. When a parent element defines a group, then the
	pushed element is not visible outside that group. In \TeX\ this
	problem is usually solved by doing a \type{\gdef}. Perhaps this
	problem can be solved in the same manner, by providing a
	\type{\gdefineXMLpush}.

In the example below the affiliation is output within the alignment
set up by author (marked by 1:), but not outside of it (marked by 2:).

\blank[2*big]

\startbuffer
<author>
   <firstname>Stein</firstname>
   <surname>Gjoen</surname>
   <affiliation>
      <address>
         <email>sgjoen@nyx.net</email>
      </address>
   </affiliation>
</author>
\stopbuffer

\processXMLbuffer

\stoptext

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

* Re: defineXMLpush and grouping
  2002-02-08 20:58 defineXMLpush and grouping Simon Pepping
@ 2002-02-10 20:36 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2002-02-10 20:36 UTC (permalink / raw)
  Cc: ntg-context

At 09:58 PM 2/8/2002 +0100, Simon Pepping wrote:
>\defineXMLpush actually makes its definition when the pushed element
>occurs. When a parent element defines a group, then the pushed element
>is not visible outside that group. In \TeX\ this problem is usually
>solved by doing a \gdef. Perhaps this problem can be solved in the
>same manner, by providing a \gdefineXMLpush.

Btw, push is now save (more correct name, but push will be available for 
backward comp)

In xtag-ini search for \redoXMLsave and add:

\long\gdef\dododefineXMLgsave#1%
   {\letvalue{\@@XMLdata:#1}\longempty
    \long\setvalue{\@@XMLelement:#1/}{\long\setgvalue{\@@XMLdata:#1}{}}%
    \long\setvalue{\@@XMLelement:#1}{\redoXMLgsave{#1}}}

\gdef\redoXMLgsave#1%
   {\long\@EA\def\@EA\next\@EA##\@EA1\@EA<\@EA/\currentXMLelement>%
      {\long\@EA\gdef\csname\@@XMLdata:#1\endcsname{##1}}%
    \next}

regenerate the format and off you go. [this macro looks awful, which is due 
to dynamic namespace mapping]

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-pod.nl
-------------------------------------------------------------------------


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

end of thread, other threads:[~2002-02-10 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-08 20:58 defineXMLpush and grouping Simon Pepping
2002-02-10 20:36 ` Hans Hagen

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