ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Re: Passing the name of an XML file to process via the command line
       [not found]   ` <119521435.12870.1751301029165@office.mailbox.org>
@ 2025-06-30 16:40     ` Wolfgang Schuster
       [not found]     ` <CAN8fp9W9j43XsQNU64wY5b=+VqA35RrK=jRWTkHv3YehYgi-Ng@mail.gmail.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2025-06-30 16:40 UTC (permalink / raw)
  To: ntg-context

Am 30.06.2025 um 18:30 schrieb Denis Maier via ntg-context:
> Do you actually need
> \xmlprocessfile{...}{\inputfilename}{}
> ?
> I just use
> context --environment=mytexfile myxmlfile.xml
> and it works just fine.

I don't use xml files so I can be wrong here.

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Passing the name of an XML file to process via the command line
       [not found]           ` <CAN8fp9VZtwazewUcL+mvZKtw94TZtbNFcHsjctLb=gwayqki9w@mail.gmail.com>
@ 2025-07-03 10:36             ` Denis Maier via ntg-context
       [not found]               ` <CAN8fp9WueR0LHA7wAJy60XJL=yavdmZhsbzJ-87x-1CzN9XbcQ@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Maier via ntg-context @ 2025-07-03 10:36 UTC (permalink / raw)
  To: 'Duncan Hothersall'
  Cc: 'mailing list for ConTeXt users', denismaier


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

Well, in that case it might depend on the exact file. I have to admit I’ve never stumpled upon something similar, and more setups are also not trivial.

 

But maybe something to consider: in my xmlsetups I match against some node from the xml document (maybe the root or maybe a body – it depends on the source document structure of course) and translate that into a proper starttext…stoptext structure.

 

Also, I usually split my setups in at least two files: one deals with the structure, the other with layout information.

So: context myfile.xml --environments=styles,mapping

 

mapping.tex will contain all the information to build a valid context document from the xml source (that means including \starttext … \stoptext etc.)

styles.tex will deal with fonts, page setups etc.

 

Also consider this older thread and Wolfgang’s response there: https://lists.contextgarden.net/archives/list/ntg-context@ntg.nl/thread/ZLEPCDIUYYJK2O53RPRPJNWEFHDAWBGH/

 

Best,

Denis

 

 

 

Von: Duncan Hothersall <dh@capdm.com> 
Gesendet: Donnerstag, 3. Juli 2025 11:55
An: denismaier@mailbox.org
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Betreff: Re: [NTG-context] Re: Passing the name of an XML file to process via the command line

 

I had tested using a MWE but in reality I have a rather involved set of XML setups with some lua code inclusions and multi-language handling bits and when I ran that as an environment without the explicit \starttext \xmlprocessfile{...}{\inputfilename}{} \stoptext, while some parts did work (fonts, colours, language switches) some of the page layout information was lost. When I added the \starttext \xmlprocessfile{...}{\inputfilename}{} \stoptext back in, it worked properly.

 

I'm not sure exactly which bits "fell out" but something definitely did. But the explicit calling as above fixed it.

 

Duncan

 

On Thu, 3 Jul 2025 at 10:46, < <mailto:denismaier@mailbox.org> denismaier@mailbox.org> wrote:

What do you mean by this?

 

Von: Duncan Hothersall < <mailto:dh@capdm.com> dh@capdm.com> 
Gesendet: Donnerstag, 3. Juli 2025 10:50
An: mailing list for ConTeXt users < <mailto:ntg-context@ntg.nl> ntg-context@ntg.nl>
Betreff: [NTG-context] Re: Passing the name of an XML file to process via the command line

 

Just coming back to this to say after further testing, for anyone copying in future, actually you can lose some of your setups if you just strip the \starttext \xmlprocessfile ... \stoptext from the environment file completely. Wolfgang's original recipe solves that problem.

 

On Mon, 30 Jun 2025 at 19:51, Duncan Hothersall < <mailto:dh@capdm.com> dh@capdm.com> wrote:

Thanks both. I stripped out the \starttext \xmlprocessfile ... \stoptext from my tex file and just used the command line invocation as suggested and it worked perfectly. So I've learned two things for the price of one!

 

Thanks again.

 

Duncan

 

On Mon, 30 Jun 2025 at 17:34, Denis Maier via ntg-context < <mailto:ntg-context@ntg.nl> ntg-context@ntg.nl> wrote:

Do you actually need 

\xmlprocessfile{...}{\inputfilename}{}  

? 

  

I just use  

context --environment=mytexfile myxmlfile.xml 

and it works just fine. 

Wolfgang Schuster <wolfgang.schuster.lists@gmail.com <mailto:wolfgang.schuster.lists@gmail.com> > hat am 30.06.2025 18:21 CEST geschrieben: 

  

  

Am 30.06.2025 um 17:59 schrieb Duncan Hothersall: 

Hello list. I feel this should be an easy question to answer but I 

couldn't find a hint. 

  

I have a ConTeXt file which pulls in an XML file for processing using 

the command 

  

\xmlprocessfile{mydomain}{myXMLfile.xml}{} 

  

I would like instead to call context with the XML file name in the 

command line (so that I can use the same ConTeXt setups on multiple XML 

sources). 

  

How can I do that? 

\xmlprocessfile{...}{\inputfilename}{} 

  

and process it with 

  

context --environment=mytexfile myxmlfile.xml 

  

Wolfgang 

  

___________________________________________________________________________________ 

If your question is of interest to others as well, please add an entry to the Wiki! 

  

maillist :  <mailto:ntg-context@ntg.nl> ntg-context@ntg.nl /  <https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl 

webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) 

archive : https://github.com/contextgarden/context 

wiki :  <https://wiki.contextgarden.net> https://wiki.contextgarden.net 

___________________________________________________________________________________ 

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>  / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________


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

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Passing the name of an XML file to process via the command line
       [not found]               ` <CAN8fp9WueR0LHA7wAJy60XJL=yavdmZhsbzJ-87x-1CzN9XbcQ@mail.gmail.com>
@ 2025-07-03 13:31                 ` Thomas A. Schmitz
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas A. Schmitz @ 2025-07-03 13:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Not sure if this may be of interest to you: it is also relatively easy 
to do part of the processing and typesetting in Lua. If you have your 
environment file environment.tex, just include the line

\registerctxluafile{environment}{1.001}

and you can define your commands in lua (I wrote a page on the wiki 
about it). I find some tests and transformations way easier to do in Lua 
than in TeX, especially if you want to do more than just typeset the xml 
serially.

All best

Thomas

On 7/3/25 12:45 PM, Duncan Hothersall wrote:
> Ah, yes, that makes sense. I'm only slowly shifting my brain to the 
> paradigm of processing XML directly using ConTeXt - for many years I've 
> used other languages to pre-process XML into TeX and then process that 
> using ConTeXt, and the flexibility that that gives is enormous, but it 
> also creates a complexity that I am keen to engineer out. But all of 
> what I've built so far has been based on examples (many of which turn 
> out to be out of date) and snippets I've found, so I guess that's why I 
> ended up with the structure I have.
> 
> Many thanks for the additional pointers, much appreciated.
> 
> Duncan


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2025-07-03 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAN8fp9UB6tyjBajMCK_t00MhboJYBapmq-ZAC77nSx-JZY+c=Q@mail.gmail.com>
     [not found] ` <232b12ec-6d80-4f32-b72d-9ad4bf432e81@gmail.com>
     [not found]   ` <119521435.12870.1751301029165@office.mailbox.org>
2025-06-30 16:40     ` [NTG-context] Re: Passing the name of an XML file to process via the command line Wolfgang Schuster
     [not found]     ` <CAN8fp9W9j43XsQNU64wY5b=+VqA35RrK=jRWTkHv3YehYgi-Ng@mail.gmail.com>
     [not found]       ` <CAN8fp9UH=CgkNQZ9XrqDskc_PrkM5Prh0Xzz0S5ov_VViPoUXQ@mail.gmail.com>
     [not found]         ` <006901dbebff$59888a70$0c999f50$@mailbox.org>
     [not found]           ` <CAN8fp9VZtwazewUcL+mvZKtw94TZtbNFcHsjctLb=gwayqki9w@mail.gmail.com>
2025-07-03 10:36             ` Denis Maier via ntg-context
     [not found]               ` <CAN8fp9WueR0LHA7wAJy60XJL=yavdmZhsbzJ-87x-1CzN9XbcQ@mail.gmail.com>
2025-07-03 13:31                 ` Thomas A. Schmitz

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