ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: xml, language, btx problems
Date: Sun, 17 Jun 2018 22:10:12 +0200	[thread overview]
Message-ID: <3051e56b-49cd-84f7-e8ad-bd6927ebf343@uni-bonn.de> (raw)
In-Reply-To: <0a7b2424-caeb-d438-9e17-cfe46973651d@gmx.es>

On 06/17/2018 09:37 PM, Pablo Rodriguez wrote:
> Hi Thomas,
> 
> this may work in your case:
> 
>   \startxmlsetups xml:document
>       \mainlanguage[\xmlatt{#1}{language}]
>       \doifmodeelse{**en}
> 	{\usebtxdefinitions [english]}
> 	{\usebtxdefinitions [deutsch]}
>   \stopxmlsetups
> 
> I have just checked in with another document and it worked as expected.

Thank you for your suggestion, Pablo, but this is just a slightly 
different syntax to express the same test, this doesn't change anything. 
Maybe this document is clearer in explaining my problem (and results are 
identical with the \doifmodeelse syntax):

\startbuffer[test]
<document language="de">
    test
</document>
\stopbuffer

\startxmlsetups xml:testsetups
	\xmlsetsetup{\xmldocument}{document}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
	\mainlanguage[\xmlatt{#1}{language}]
	Language settings work correctly here:

	\doifelse {\currentmainlanguage} {de}
	{\color [blue] {Deutsch}}
	{\color [red]  {English}}\par
	\xmlflush{#1}
\stopxmlsetups

\starttext
This is where the btx set has to be loaded, and language settings do not 
work as needed:

	\doifelse {\currentmainlanguage} {de}
	{\color [blue] {Deutsch}}
	{\color [red]  {English}}\par

\xmlprocessbuffer{main}{test}{}

\stoptext

Is there any way to set the language before the <document> element is 
processed? I experimented with this

\startxmlsetups xml:language:initiate
	\mainlanguage[\xmlattribute{\xmldocument}{root::/document}{language}]
\stopxmlsetups

\xmlbeforedocumentsetup{\xmldocument}{xml:language:initiate}{xml:testsetups}

but this doesn't work, and I'm not sure I'm using it the right way.

All best

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2018-06-17 20:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-17 17:52 Thomas A. Schmitz
2018-06-17 19:37 ` Pablo Rodriguez
2018-06-17 20:10   ` Thomas A. Schmitz [this message]
2018-06-17 20:36     ` Wolfgang Schuster
2018-06-18 16:36     ` Pablo Rodriguez
2018-06-17 22:58 ` Alan Braslau
2018-06-18 10:19   ` Thomas A. Schmitz
2018-06-18 10:53     ` Hans Hagen
2018-06-18 11:07       ` Thomas A. Schmitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3051e56b-49cd-84f7-e8ad-bd6927ebf343@uni-bonn.de \
    --to=thomas.schmitz@uni-bonn.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).