ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Handling XML docs.
@ 2002-07-11  5:32 scarsoluigi
  0 siblings, 0 replies; 3+ messages in thread
From: scarsoluigi @ 2002-07-11  5:32 UTC (permalink / raw)
  Cc: ntg-context

> Luigi,
> 
> You try to automate things a lot. But you use a type of XML that I do
> not favor; it is a mixture of XML and tex. My XML would be something
> like this:
> 
> <node frame="top" backgroundcolor="cyan" rulethickness="3pt">
> 0 lev.
> <node frame="bottom" backgroundcolor="magenta" rulethickness="3pt">
> I lev.
> <node frame="left" backgroundcolor="yellow" rulethickness="3pt">
> II lev.
> <node frame="right" backgroundcolor="darkgray" rulethickness="3pt">
> (yes it's gray)III lev.</node>
> </node>
> </node>
> </node>
> 
> And then your context mapping should translate this to context's
> \framedtext command and its settings, using \processaction, string
> comparison, \mapXMLvalue, etc.
> 
> Regards, Simon

Absolutly good. 

Yesterday I forget to write that attr. type is CDATA and
is the only way to specified  formatting parameter
(well, i think to <para> element in docbook and role attribute)

thanks
luigi


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

* Re: Handling XML docs.
  2002-07-10 16:45 scarsoluigi
@ 2002-07-10 20:37 ` Simon Pepping
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Pepping @ 2002-07-10 20:37 UTC (permalink / raw)


Luigi,

You try to automate things a lot. But you use a type of XML that I do
not favor; it is a mixture of XML and tex. My XML would be something
like this:

<node frame="top" backgroundcolor="cyan" rulethickness="3pt">
0 lev.
<node frame="bottom" backgroundcolor="magenta" rulethickness="3pt">
I lev.
<node frame="left" backgroundcolor="yellow" rulethickness="3pt">
II lev.
<node frame="right" backgroundcolor="darkgray" rulethickness="3pt">
(yes it's gray)III lev.</node>
</node>
</node>
</node>

And then your context mapping should translate this to context's
\framedtext command and its settings, using \processaction, string
comparison, \mapXMLvalue, etc.

Regards, Simon

On Wed, Jul 10, 2002 at 06:45:42PM +0200, scarsoluigi@libero.it wrote:
> Here some works on xml and context
> 
> setupcolors[state=start,rgb=no,cmyk=yes]
> \defineXMLenvironment [node][type=]
> {%Start tag
> %{\ss\tfx attr type=''\XMLpar{node}{type}{}''}
> \expanded{\beforesplitstring{\XMLpar{node}{type}{}}}\at [\to\Type%  
> \expanded{\aftersplitstring{\XMLpar{node}{type}{}}}\at [\to\rawOptions%  
> \expanded{\beforesplitstring{\rawOptions}}\at ]\to\Options%  
> %{\ss\tfx Type=\Type}\par
> %{\ss\tfx Option=\Options}\par
> \doifelse{\Type}{framedtext}%
>   {%then
>   \expanded{\framed[\Options]}\bgroup
>   }{%else
>   \relax}
> }
> {%End tag
> \egroup
>  %%{\blank\ss$<$/node$>$\blank}
> }
> 
> 
> \starttext
> \processXMLfilegrouped{test-5.xml}
> {\tfx
> \typefile{test-5.xml}}
> \stoptext
> 
> 
> and test-5.xml is 
> 
> <?xml version="1.0" ?>
> <node type="framedtext[frame=off,topframe=on,
>                        background=color,
>                        backgroundcolor=cyan,
>                        rulethickness=3pt]">
> 0 lev.
> <node type="framedtext[frame=off,bottomframe=on,
>                        background=color,
>                        backgroundcolor=magenta,
>                        rulethickness=3pt]">
> I lev.
> <node type="framedtext[frame=off,leftframe=on,
>                        background=color,
>                        backgroundcolor=yellow,
>                        rulethickness=3pt]">
> II lev.
> <node type="framedtext[frame=off,rightframe=on,
>                        background=color,
>                        backgroundcolor=darkgray,
>                        rulethickness=3pt]">
> (yes it's gray)III lev.</node>
> </node>
> </node>
> </node>
> 
> happy contexting
> luigi

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


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

* Handling XML docs.
@ 2002-07-10 16:45 scarsoluigi
  2002-07-10 20:37 ` Simon Pepping
  0 siblings, 1 reply; 3+ messages in thread
From: scarsoluigi @ 2002-07-10 16:45 UTC (permalink / raw)


Here some works on xml and context

setupcolors[state=start,rgb=no,cmyk=yes]
\defineXMLenvironment [node][type=]
{%Start tag
%{\ss\tfx attr type=''\XMLpar{node}{type}{}''}
\expanded{\beforesplitstring{\XMLpar{node}{type}{}}}\at [\to\Type%  
\expanded{\aftersplitstring{\XMLpar{node}{type}{}}}\at [\to\rawOptions%  
\expanded{\beforesplitstring{\rawOptions}}\at ]\to\Options%  
%{\ss\tfx Type=\Type}\par
%{\ss\tfx Option=\Options}\par
\doifelse{\Type}{framedtext}%
  {%then
  \expanded{\framed[\Options]}\bgroup
  }{%else
  \relax}
}
{%End tag
\egroup
 %%{\blank\ss$<$/node$>$\blank}
}

\starttext
\processXMLfilegrouped{test-5.xml}
{\tfx
\typefile{test-5.xml}}
\stoptext

and test-5.xml is 

<?xml version="1.0" ?>
<node type="framedtext[frame=off,topframe=on,
                       background=color,
                       backgroundcolor=cyan,
                       rulethickness=3pt]">
0 lev.
<node type="framedtext[frame=off,bottomframe=on,
                       background=color,
                       backgroundcolor=magenta,
                       rulethickness=3pt]">
I lev.
<node type="framedtext[frame=off,leftframe=on,
                       background=color,
                       backgroundcolor=yellow,
                       rulethickness=3pt]">
II lev.
<node type="framedtext[frame=off,rightframe=on,
                       background=color,
                       backgroundcolor=darkgray,
                       rulethickness=3pt]">
(yes it's gray)III lev.</node>
</node>
</node>
</node>

happy contexting
luigi


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

end of thread, other threads:[~2002-07-11  5:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-11  5:32 Handling XML docs scarsoluigi
  -- strict thread matches above, loose matches on Subject: below --
2002-07-10 16:45 scarsoluigi
2002-07-10 20:37 ` Simon Pepping

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