From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/101022 Path: news.gmane.org!.POSTED!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: xml, language, btx problems Date: Sun, 17 Jun 2018 22:36:39 +0200 Message-ID: <5B26C657.3070108@gmail.com> References: <77dfd9f9-cc57-51cf-7dc8-68ca20f28130@uni-bonn.de> <0a7b2424-caeb-d438-9e17-cfe46973651d@gmx.es> <3051e56b-49cd-84f7-e8ad-bd6927ebf343@uni-bonn.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6227568080060269941==" X-Trace: blaine.gmane.org 1529267698 21275 195.159.176.226 (17 Jun 2018 20:34:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 17 Jun 2018 20:34:58 +0000 (UTC) User-Agent: Postbox 5.0.25 (Macintosh/20180328) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jun 17 22:34:53 2018 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fUeNx-0005Sx-Pq for gctc-ntg-context-518@m.gmane.org; Sun, 17 Jun 2018 22:34:53 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2E48B37638; Sun, 17 Jun 2018 22:36:56 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ObxQVbMTJwJf; Sun, 17 Jun 2018 22:36:55 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 5A65237644; Sun, 17 Jun 2018 22:36:55 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 849AA37638 for ; Sun, 17 Jun 2018 22:36:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4fAbmqIm5WU8 for ; Sun, 17 Jun 2018 22:36:52 +0200 (CEST) Original-Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 99D3737630 for ; Sun, 17 Jun 2018 22:36:42 +0200 (CEST) Original-Received: by mail-wr0-f170.google.com with SMTP id w7-v6so14686038wrn.6 for ; Sun, 17 Jun 2018 13:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=Cmys01hTadM4d8tyCRF/KTNQ0pXVHmN+Bs06WFS2BNM=; b=pwNePQR4weP2mKkOEXjedlUQjc3a9H6BC6/Wssgzqi1wBb1nYMk6+s4oGF3xXAPqmc iKIUc6C4Sj2zEpKqPXbcmlZKM8qNySOAKX77GEJnJlhQQh5hSiib9EjIGIRphxQLn+/K avD0oCxpsNQuH+7E6YazREvLPiu78K6yH31lX4sQumpB3Jx96ngTpvBAYysX0AVp02dm Bt5hO6GuSTEX7TbkMxVCcyNtSFUVAiEq/gAmhAfQxDoo85rTSNZazBoWaMW20/frfYrK TWSBPi1xVcwVqMtHV6rUNusERYIqkE3dRdbTAAS0ZxKmLQOORdBpayL4an1XR5munjIz o5+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=Cmys01hTadM4d8tyCRF/KTNQ0pXVHmN+Bs06WFS2BNM=; b=SeArz4s3MhYKSUOn7UGzft3nAAfsKLAp05QcMobi/d/7czkjgnbYeP5zbTylsy8Dxr AabHLMcZ22cS7IWDYN3UgTc/Dzy6q9qZZLPVSePWD/VgrCsp7mC4r9NV907hqTFp3ZUt GInaZSfQ3Ke6rfJ4cD04efhaJEyjVgtBmX41UpG1IZvzlZQAEd9dISFwr+N6TR+koglf OIu9kTurdGlDoUzvhMREHPmVYtZrgHvD3ZCp3agQgeF1isJQmd+/8RF0hTewx4UgIqNM YjmhIF2UmuX0vgHpdb+AvM05CAkOhzdI0DcCON/4TG6Qw5BzA0WYmfqBHNO8ODXwPLvD qdqA== X-Gm-Message-State: APt69E2H30osB2S5a9OYBixowqucRT9tbT7w8tR3+kfeoNrC2yi/e2ul pZ7euoBiF/Ukc3C7+ANUzmdM07dq X-Google-Smtp-Source: ADUXVKLxblrnCFMnRjLtmsDF8t9yRql1HgtbpJdjXZunGnmesnjEq5rLsxhP8nU0bfZMMjraewurow== X-Received: by 2002:adf:dc8b:: with SMTP id r11-v6mr7890994wrj.166.1529267801928; Sun, 17 Jun 2018 13:36:41 -0700 (PDT) Original-Received: from [192.168.1.12] (x4dbd4e36.dyn.telefonica.de. [77.189.78.54]) by smtp.gmail.com with ESMTPSA id b124-v6sm8960776wmf.11.2018.06.17.13.36.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jun 2018 13:36:41 -0700 (PDT) In-Reply-To: <3051e56b-49cd-84f7-e8ad-bd6927ebf343@uni-bonn.de> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:101022 Archived-At: This is a multi-part message in MIME format. --===============6227568080060269941== Content-Type: multipart/alternative; boundary="------------050000020305050408070300" This is a multi-part message in MIME format. --------------050000020305050408070300 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit One option is to load your document at the beginning with different setups where you only process the language information. Another option is to put the language dependent options in a setups block and load them when you process the XML file. \startbuffer[test] test \stopbuffer \startxmlsetups [xml:testsetups] \xmlsetsetup{\xmldocument}{document}{xml:*} \stopxmlsetups \xmlregistersetup{xml:testsetups} \startxmlsetups [xml:document] \mainlanguage[\xmlatt{#1}{language}] \startdocument \xmlflush{#1} \stopdocument \stopxmlsetups % The “document:start” setup is used by default with % the before key of the \startdocument command \startsetups [document:start] \startmodeset [**de] {This document is in german.\par} [**en] {This document is in english.\par} [default] {This document uses the default language.\par} \stopmodeset \stopsetups \starttext \xmlprocessbuffer{main}{test}{} \stoptext Wolfgang > Thomas A. Schmitz > 17. Juni 2018 um 19:52 > Hi, > > I have a conceptual problem integrating btx into my xml workflow. > There are too many files involved, so no minimal example, but a > minimal description. Root of my xml document: > > > ... > > > I have two files with btx definitions: > > publ-imp-deutsch.mkvi > > publ-imp-english.mkvi > > Loading one of these two should depend on the main language: > > \doifelse {\currentlanguage} {en} > {\usebtxdefinitions [english]} > {\usebtxdefinitions [deutsch]} > > My problem: the main language is set within the processing rules for > the root of my xml document: > > \startxmlsetups xml:document > \mainlanguage[\xmlatt{#1}{language}] > \stopxmlsetups > > However, this implies a \starttext. And the btxdefinitions need to be > loaded before \starttext, or so it seems. Which means: the processing > rules for \usebtxdefinitions need to be set outside of the xml setups. > But at this moment, the main language is not set yet, and the > \doifelse fails. Any hints how to get out of this conundrum? > > Thanks, and 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 > ___________________________________________________________________________________ > Pablo Rodriguez > 17. Juni 2018 um 21:37 > > 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. > > Of course, "\doifelse{\currentmainlanguage}{en}" also works fine for me. > > I hope it helps, > > Pablo > Thomas A. Schmitz > 17. Juni 2018 um 22:10 > > > 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] > > test > > \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 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 > ___________________________________________________________________________________ --------------050000020305050408070300 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit One option is to load your document at the beginning with different setups where you only process the language information.

Another option is to put the language dependent options in a setups block and load them when you process the XML file.

\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}]
    \startdocument
    \xmlflush{#1}
    \stopdocument
\stopxmlsetups

% The “document:start” setup is used by default with
% the before key of the \startdocument command

\startsetups [document:start]
    \startmodeset
        [**de]    {This document is in german.\par}
        [**en]    {This document is in english.\par}
        [default] {This document uses the default language.\par}
    \stopmodeset
\stopsetups

\starttext
\xmlprocessbuffer{main}{test}{}
\stoptext

Wolfgang
17. Juni 2018 um 19:52
Hi,

I have a conceptual problem integrating btx into my xml workflow. There are too many files involved, so no minimal example, but a minimal description. Root of my xml document:

<document language="en">
...
</document>

I have two files with btx definitions:

publ-imp-deutsch.mkvi

publ-imp-english.mkvi

Loading one of these two should depend on the main language:

\doifelse {\currentlanguage} {en}
    {\usebtxdefinitions [english]}
    {\usebtxdefinitions [deutsch]}

My problem: the main language is set within the processing rules for the root of my xml document:

\startxmlsetups xml:document
   \mainlanguage[\xmlatt{#1}{language}]
\stopxmlsetups

However, this implies a \starttext. And the btxdefinitions need to be loaded before \starttext, or so it seems. Which means: the processing rules for \usebtxdefinitions need to be set outside of the xml setups. But at this moment, the main language is not set yet, and the \doifelse fails. Any hints how to get out of this conundrum?

Thanks, and 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
___________________________________________________________________________________
17. Juni 2018 um 21:37

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.

Of course, "\doifelse{\currentmainlanguage}{en}" also works fine for me.

I hope it helps,

Pablo
17. Juni 2018 um 22:10


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
___________________________________________________________________________________

--------------050000020305050408070300-- --===============6227568080060269941== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============6227568080060269941==--