ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XML and context
@ 2005-02-23  2:31 Paul Tremblay
  2005-02-23  8:33 ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Tremblay @ 2005-02-23  2:31 UTC (permalink / raw)


I've been looking over some articles published on context and XML,
nameely http://www.pragma-ade.com/show-mag-9.htm. 

According to this article, there is a Relax schema for an XML version of
context. The namespace is 'http://www.pragma-ade.com/rlg/foxet.rng'. 

This implies that the Relax schema can only be used if using FO, or? I
was wondering if could directly convert to the XML at the namespace
above and then process the resulting document with context. 

This would be easier than using the mapping method.

Thanks

Paul

-- 

************************
*Paul Tremblay         *
*phthenry@iglou.com    *
************************

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

* Re: XML and context
  2005-02-23  2:31 XML and context Paul Tremblay
@ 2005-02-23  8:33 ` Hans Hagen
  2005-02-23 17:25   ` Paul Tremblay
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2005-02-23  8:33 UTC (permalink / raw)


Paul Tremblay wrote:
> I've been looking over some articles published on context and XML,
> nameely http://www.pragma-ade.com/show-mag-9.htm. 
> 
> According to this article, there is a Relax schema for an XML version of
> context. The namespace is 'http://www.pragma-ade.com/rlg/foxet.rng'. 
> 
> This implies that the Relax schema can only be used if using FO, or? I
> was wondering if could directly convert to the XML at the namespace
> above and then process the resulting document with context. 
> 
> This would be easier than using the mapping method.

there are several ways to process xml with context and the magazine mentioned 
just explores a few of them;

- here i mostly map xml onto context commands using commands like:

\defineXMLenvironment[orderedlist]
   {\startitemize[n,packed]}
   {\startitemize}

\defineXMLenvironment[unorderedlist]
   {\startitemize[packed]}
   {\startitemize}

\defineXMLenvironment[item]
   {\item}
   {\endgraf}

- often we get messy xml, so some clean up is needed on forehand, which we do 
with either xslt or with scripting

- another option is to use foxet and xsl-fo formatted input (texexec --pdf 
--foxet somefile.fo) but (1) foxet is not yet perfect and (2) fo-based 
typesetting is suboptimal)

The mapping variant discussed in the magazine can be seen as a future xml based 
layer around the context tex core; a kind xml based typesetting engine so that 
one can do without tex programming and stick to xml tools (which some prefer)

Hans



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: XML and context
  2005-02-23  8:33 ` Hans Hagen
@ 2005-02-23 17:25   ` Paul Tremblay
  2005-02-23 18:53     ` luigi.scarso
  2005-02-24 10:32     ` XML and context h h extern
  0 siblings, 2 replies; 12+ messages in thread
From: Paul Tremblay @ 2005-02-23 17:25 UTC (permalink / raw)


On Wed, Feb 23, 2005 at 09:33:40AM +0100, Hans Hagen wrote:
> 
> The mapping variant discussed in the magazine can be seen as a future xml 
> based layer around the context tex core; a kind xml based typesetting 
> engine so that one can do without tex programming and stick to xml tools 
> (which some prefer)
> 
> Hans
> 

But my unerstanding is that the mapping technique does not take care of
white space. So if I have:

<p>Some paragrah in XmL

with 

space
</p>

This could get converted as:

Some paragrah in XmL

with 

space
\par

Which would produce 3 paragrahs.

There is actually a nice small tool TeXML (at sourceforge) that takes
care of this problem. It allows you to use an XML to issue TeX commands,
and then converts those commands into TeX (or LaTeX or ConText). It
takes care of white space.

I am one of those people who likes to stick to XML tools, who likes to
convert a tree to a tree. I was wondering the best way to do this. It
seems that using TeXML is the best way. I just wanted to make sure there
was not a more direct way in ConTeXt.

Thanks

Paul


-- 

************************
*Paul Tremblay         *
*phthenry@iglou.com    *
************************

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

* Re: XML and context
  2005-02-23 17:25   ` Paul Tremblay
@ 2005-02-23 18:53     ` luigi.scarso
  2005-02-23 22:18       ` Adam Lindsay
  2005-02-24 10:32     ` XML and context h h extern
  1 sibling, 1 reply; 12+ messages in thread
From: luigi.scarso @ 2005-02-23 18:53 UTC (permalink / raw)


Paul Tremblay wrote:

>But my unerstanding is that the mapping technique does not take care of
>white space. So if I have:
>
><p>Some paragrah in XmL
>
>with 
>
>space
></p>
>
>This could get converted as:
>
>Some paragrah in XmL
>
>with 
>
>space
>\par
>
>Which would produce 3 paragrahs.
>
>  
>
I remember DocBook In Context customization in 2002....

I still think that XML (but not XSL formatting object ) better
describe structure rather than presentation
(ConTexT it useful for structure AND presentation).
For example,spaces inside a xml are dangerous: how can I transform them ?
Do I use  a newline, a kern ,  a skip with glue, a space '\ ', a space ' 
',  a \blank... ?
With what amount ?

I still think that (xml structure / TeX presentation)
is better than (xml structure / xml presentation);
TeX is a typographical programming language, maybe not so easy,
but ConTeXt is  an excellent  high-level layer: XML is not a programming 
language, and has not any typographics issues (XSL FO apart: but I 
consider it not so good as TeX).

By the way, I still think that for stickers (a relative simple 
tipographical document) an xml layer is really useful and I moving into 
this directions for my future works;
but just typesetting a simple book with (xml structure / xml presentation)
seem to me an unnecessary complication.

luigi

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

* Re: XML and context
  2005-02-23 18:53     ` luigi.scarso
@ 2005-02-23 22:18       ` Adam Lindsay
  2005-02-23 23:50         ` Paul Tremblay
  0 siblings, 1 reply; 12+ messages in thread
From: Adam Lindsay @ 2005-02-23 22:18 UTC (permalink / raw)


luigi.scarso said this at Wed, 23 Feb 2005 19:53:01 +0100:

>>Some paragrah in XmL
>>
>>with 
>>
>>space
>>\par
>>
>>Which would produce 3 paragrahs.
>
>I remember DocBook In Context customization in 2002....

Indeed. And since this the whitespace processing is with an XSLT
transform, you can notionally keep such processing within the ConTeXt
`family':
   <http://www.leverkruid.nl/context/#whitespace>
...by \applyXSLTscript commands and the like!

No sense in being purist about these things... If a bit of XSLT is the
right tool for the job, may as well use that!
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Adam T. Lindsay, Computing Dept.     atl@comp.lancs.ac.uk
 Lancaster University, InfoLab21        +44(0)1524/510.514
 Lancaster, LA1 4WA, UK             Fax:+44(0)1524/510.492
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

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

* Re: XML and context
  2005-02-23 22:18       ` Adam Lindsay
@ 2005-02-23 23:50         ` Paul Tremblay
  2005-02-24  9:34           ` luigi.scarso
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Tremblay @ 2005-02-23 23:50 UTC (permalink / raw)


On Wed, Feb 23, 2005 at 10:18:59PM +0000, Adam Lindsay wrote:
>    <http://www.leverkruid.nl/context/#whitespace>
> ...by \applyXSLTscript commands and the like!
> 

That assumes you are using xalan as your xslt processor. I use xsltproc.
In general, stripping white space in XML is nearly impossible with xslt.
That is why the utility TeXML uses SAX to do so. 

> No sense in being purist about these things... If a bit of XSLT is the
> right tool for the job, may as well use that!
> -- 

Well, since I'm conerting from TEI, I do need a bit of XSLT! 

Thanks

Paul

-- 

************************
*Paul Tremblay         *
*phthenry@iglou.com    *
************************

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

* Re: XML and context
  2005-02-23 23:50         ` Paul Tremblay
@ 2005-02-24  9:34           ` luigi.scarso
  2005-02-24 16:33             ` customizing headers/footers first page phthenry
  0 siblings, 1 reply; 12+ messages in thread
From: luigi.scarso @ 2005-02-24  9:34 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 587 bytes --]

Paul Tremblay wrote:

>On Wed, Feb 23, 2005 at 10:18:59PM +0000, Adam Lindsay wrote:
>  
>
>>   <http://www.leverkruid.nl/context/#whitespace>
>>...by \applyXSLTscript commands and the like!
>>
>>    
>>
>
>That assumes you are using xalan as your xslt processor. I use xsltproc.
>  
>
Hmm, I haven't found xalan inside context distr: I found
base/xtag-xsl.tex:  {\executesystemcommand{xsltproc -o #3 #1 #2}}

>In general, stripping white space in XML is nearly impossible with xslt.
>That is why the utility TeXML uses SAX to do so. 
>
>  
>
it's in python.....wow.....


luigi scarso


[-- Attachment #1.2: Type: text/html, Size: 1250 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: XML and context
  2005-02-23 17:25   ` Paul Tremblay
  2005-02-23 18:53     ` luigi.scarso
@ 2005-02-24 10:32     ` h h extern
  1 sibling, 0 replies; 12+ messages in thread
From: h h extern @ 2005-02-24 10:32 UTC (permalink / raw)


Paul Tremblay wrote:
> On Wed, Feb 23, 2005 at 09:33:40AM +0100, Hans Hagen wrote:
> 
>>The mapping variant discussed in the magazine can be seen as a future xml 
>>based layer around the context tex core; a kind xml based typesetting 
>>engine so that one can do without tex programming and stick to xml tools 
>>(which some prefer)
>>
>>Hans
>>
> 
> 
> But my unerstanding is that the mapping technique does not take care of
> white space. So if I have:
> 
> <p>Some paragrah in XmL
> 
> with 
> 
> space
> </p>
> 
> This could get converted as:
> 
> Some paragrah in XmL
> 
> with 
> 
> space
> \par
> 
> Which would produce 3 paragrahs.
> 
> There is actually a nice small tool TeXML (at sourceforge) that takes
> care of this problem. It allows you to use an XML to issue TeX commands,
> and then converts those commands into TeX (or LaTeX or ConText). It
> takes care of white space.
> 
> I am one of those people who likes to stick to XML tools, who likes to
> convert a tree to a tree. I was wondering the best way to do this. It
> seems that using TeXML is the best way. I just wanted to make sure there
> was not a more direct way in ConTeXt.

\starttext

\unprotected \defineXMLenvironment
   [p]
   {\bgroup\def\obeyedspace{\removeunwantedspaces\space\ignorespaces}\ignorelines}
   {\egroup}


\startbuffer
   <p>test

   test
test
   test</p>
\stopbuffer

\processXMLbuffer

\stoptext
-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

* customizing headers/footers first page
  2005-02-24  9:34           ` luigi.scarso
@ 2005-02-24 16:33             ` phthenry
  2005-02-24 16:48               ` Steve Grathwohl
  0 siblings, 1 reply; 12+ messages in thread
From: phthenry @ 2005-02-24 16:33 UTC (permalink / raw)


I poured over the documentation last night, and I want to make sure I 
reached the right conclusion in thinking that there is no way to put a 
different header/footer on the first page in ConTeXt. 

I know that you can suppress the header/footer by various means, such as:

\setupheaders[state=high]
% or
\setuphead[chapter][header=empty]
\chapter

But I don't believe you can acutally put a different header on the first 
page, such as:

First Page Header
==================

Here is the body text for the first page.

Rest Header
=============

Here is the body text for the rest of the chapter

Also, is there any way to do things with the last page in a section? By 
do things, I mean set different page dimmensions or set up different 
headers/footers.

I am asking these questions because I am coming from fo, and I am 
looking for the closest ways to mimic its formatting.

Thanks

Paul

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

* Re: customizing headers/footers first page
  2005-02-24 16:33             ` customizing headers/footers first page phthenry
@ 2005-02-24 16:48               ` Steve Grathwohl
  2005-02-25  5:54                 ` Paul Tremblay
  0 siblings, 1 reply; 12+ messages in thread
From: Steve Grathwohl @ 2005-02-24 16:48 UTC (permalink / raw)


How about

\definetext[chapterstart][header][First Header]
\setuphead[chapter][header=chapterstart]

for starters?

Steve

On Thu, 24 Feb 2005 11:33:11 -0500, phthenry@iglou.com
<phthenry@iglou.com> wrote:
> I poured over the documentation last night, and I want to make sure I
> reached the right conclusion in thinking that there is no way to put a
> different header/footer on the first page in ConTeXt.
> 
> I know that you can suppress the header/footer by various means, such as:
> 
> \setupheaders[state=high]
> % or
> \setuphead[chapter][header=empty]
> \chapter
> 
> But I don't believe you can acutally put a different header on the first
> page, such as:
> 
> First Page Header
> ==================
> 
> Here is the body text for the first page.
> 
> Rest Header
> =============
> 
> Here is the body text for the rest of the chapter
> 
> Also, is there any way to do things with the last page in a section? By
> do things, I mean set different page dimmensions or set up different
> headers/footers.
> 
> I am asking these questions because I am coming from fo, and I am
> looking for the closest ways to mimic its formatting.
> 
> Thanks
> 
> Paul
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> 


-- 
Steve Grathwohl || Digital Content Developer
Duke University Press Journals || +1 919 687 3634
905 W Main St || Durham, NC 27701 USA

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

* Re: customizing headers/footers first page
  2005-02-24 16:48               ` Steve Grathwohl
@ 2005-02-25  5:54                 ` Paul Tremblay
  2005-02-25  8:33                   ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Tremblay @ 2005-02-25  5:54 UTC (permalink / raw)


On Thu, Feb 24, 2005 at 11:48:32AM -0500, Steve Grathwohl wrote:
> 
> How about
> 
> \definetext[chapterstart][header][First Header]
> \setuphead[chapter][header=chapterstart]
> 
> for starters?
> 
> Steve
> 

Thanks. Are there any other location keywords besides chapterstart? 

%???

\definetext[chapterlast][footer][last footer]
\setuphead[chapter][footer=chapterlast]

Paul

-- 

************************
*Paul Tremblay         *
*phthenry@iglou.com    *
************************

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

* Re: customizing headers/footers first page
  2005-02-25  5:54                 ` Paul Tremblay
@ 2005-02-25  8:33                   ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2005-02-25  8:33 UTC (permalink / raw)


Paul Tremblay wrote:
> On Thu, Feb 24, 2005 at 11:48:32AM -0500, Steve Grathwohl wrote:
> 
>>How about
>>
>>\definetext[chapterstart][header][First Header]
>>\setuphead[chapter][header=chapterstart]
>>
>>for starters?
>>
>>Steve
>>
> 
> 
> Thanks. Are there any other location keywords besides chapterstart? 
> 
> %???
> 
> \definetext[chapterlast][footer][last footer]
> \setuphead[chapter][footer=chapterlast]

you can have any keyword you want; it's just a reference to what you define and 
recall later

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

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

end of thread, other threads:[~2005-02-25  8:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-23  2:31 XML and context Paul Tremblay
2005-02-23  8:33 ` Hans Hagen
2005-02-23 17:25   ` Paul Tremblay
2005-02-23 18:53     ` luigi.scarso
2005-02-23 22:18       ` Adam Lindsay
2005-02-23 23:50         ` Paul Tremblay
2005-02-24  9:34           ` luigi.scarso
2005-02-24 16:33             ` customizing headers/footers first page phthenry
2005-02-24 16:48               ` Steve Grathwohl
2005-02-25  5:54                 ` Paul Tremblay
2005-02-25  8:33                   ` Hans Hagen
2005-02-24 10:32     ` XML and context h h extern

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