From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/95785 Path: news.gmane.org!.POSTED!not-for-mail From: Mica Semrick Newsgroups: gmane.comp.tex.context Subject: Re: TEI to context XML mappings? Date: Sat, 13 Aug 2016 22:03:37 -0700 Message-ID: <2B42FC6C-E73B-4FBC-8C3F-FAAFECF16C42@silentumbrella.com> References: <7D10B88F-FB76-465E-A1E5-1DAE8137966E@silentumbrella.com> <56CD67D2.2070703@wxs.nl> <56CD7392.5000606@gmx.es> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0531219125875689907==" X-Trace: blaine.gmane.org 1471151075 31956 195.159.176.226 (14 Aug 2016 05:04:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 14 Aug 2016 05:04:35 +0000 (UTC) User-Agent: K-9 Mail for Android To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Aug 14 07:04:31 2016 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 1bYnb4-00084Y-T2 for gctc-ntg-context-518@m.gmane.org; Sun, 14 Aug 2016 07:04:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 09BBA14DC6; Sun, 14 Aug 2016 07:04:03 +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 HIqDWxMbjqcE; Sun, 14 Aug 2016 07:04:01 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 4BC6814DC7; Sun, 14 Aug 2016 07:04:01 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4752A14DC3 for ; Sun, 14 Aug 2016 07:03:59 +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 hM8MpxXJtKUS for ; Sun, 14 Aug 2016 07:03:52 +0200 (CEST) Original-Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 6666A14DC2 for ; Sun, 14 Aug 2016 07:03:42 +0200 (CEST) Original-Received: from mfilter37-d.gandi.net (mfilter37-d.gandi.net [217.70.178.168]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id 11D75FB883 for ; Sun, 14 Aug 2016 07:03:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter37-d.gandi.net Original-Received: from relay6-d.mail.gandi.net ([IPv6:::ffff:217.70.183.198]) by mfilter37-d.gandi.net (mfilter37-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id wyk1n6cRb27k for ; Sun, 14 Aug 2016 07:03:40 +0200 (CEST) X-Originating-IP: 71.189.197.214 Original-Received: from drhilarious.lan (unknown [71.189.197.214]) (Authenticated sender: mica@silentumbrella.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id E2B11FB887 for ; Sun, 14 Aug 2016 07:03:39 +0200 (CEST) In-Reply-To: <56CD7392.5000606@gmx.es> 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:95785 Archived-At: --===============0531219125875689907== Content-Type: multipart/alternative; boundary="----QUPRHIFQ4WWEWKY8D24HVKFOD1WC6I" Content-Transfer-Encoding: 8bit ------QUPRHIFQ4WWEWKY8D24HVKFOD1WC6I Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 After doing some research, I stumbled upon saxon-lint (https://github.com/sputnick-dev/saxon-lint), a perl program capable of using xpath3 expressions. In the crudest form possible: !# /bin/bash for ELM in `saxon-lint.pl --xpath "distinct-values(//*/name())" file.xml` do echo -e "\\startxmlsetups xml:$ELM \n\t \\xmlflush{#1} \n \\stopxmlsetups" done I still need to write $ELM into an array to make it do the following: \startxmlsetups xml:blank:map % xml:[filename] would be also fine \xmlsetsetup{\xmldocument} {xml:elements:from:the:variable:elm} % list the results from saxon-lint {xml:*} \stopxmlsetups That would give me the "blank" mapping file I want, saving me the trouble of typing out the whole thing every time. Best, Mica Pablo Rodriguez @ 2016-02-24 01:10 PST: > On 02/24/2016 09:20 AM, Hans Hagen wrote: >> On 2/23/2016 10:26 PM, Mica Semrick wrote: >>> Reading the docbook thread earlier today reminded me to ask this: >>> >>> Is there any feature or script that anyone can share that will read in >>> an XML document and spit out a blank mapping file? >> >> what is a blank mapping file > > Just guessing (or that would be useful for me too), a file with the > following scheme: > > \startxmlsetups xml:blank:map % xml:[filename] would be also fine > \xmlsetsetup{\xmldocument} > {xml:elements} % all elements used in document listed here > {xml:*} > > \xmlsetsetup{\xmldocument} > {h2[contains(@class,'author')]} % list also all elements > {xml:title:author} % with attributes > \stopxmlsetups > > \xmlregistersetup{xml:pandoc} > > \startxmlsetups xml:elements % basic configuration for elements > \xmlflush{#1} > \stopxmlsetups > > \startxmlsetups xml:title:author % basic configuration for attributes > \xmlflush{#1} > \stopxmlsetups > > I guess that the usefulness of this is not the actual configuration, but > to know what you have to configure. > > I hope it helps, > > Pablo ------QUPRHIFQ4WWEWKY8D24HVKFOD1WC6I Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
After doing some research, I stumbled upon saxon-lint (https://github.com/sputnick-dev/saxon-lint), a perl program
capable of using xpath3 expressions.

In the crudest form possible:

!# /bin/bash
for ELM in `saxon-lint.pl --xpath "distinct-values(//*/name())" file.xml`
do
echo -e "\\startxmlsetups xml:$ELM \n\t \\xmlflush{#1} \n \\stopxmlsetups"
done

I still need to write $ELM into an array to make it do the following:

\startxmlsetups xml:blank:map % xml:[filename] would be also fine
\xmlsetsetup{\xmldocument}
{xml:elements:from:the:variable:elm} % list the results from saxon-lint
{xml:*}
\stopxmlsetups

That would give me the "blank" mapping file I want, saving me the
trouble of typing out the whole thing every time.

Best,
Mica

Pablo Rodriguez <oinos@gmx.es> @ 2016-02-24 01:10 PST:

> On 02/24/2016 09:20 AM, Hans Hagen wrote:
>> On 2/23/2016 10:26 PM, Mica Semrick wrote:
>>> Reading the docbook thread earlier today reminded me to ask this:
>>>
>>> Is there any feature or script that anyone can share that will read in
>>> an XML document and spit out a blank mapping file?
>>
>> what is a blank mapping file
>
> Just guessing (or that would be useful for me too), a file with the
> following scheme:
>
> \startxmlsetups xml:blank:map % xml:[filename] would be also fine
> \xmlsetsetup{\xmldocument}
> {xml:elements} % all elements used in document listed here
> {xml:*}
>
> \xmlsetsetup{\xmldocument}
> {h2[contains(@class,'author')]} % list also all elements
> {xml:title:author} % with attributes
> \stopxmlsetups
>
> \xmlregistersetup{xml:pandoc}
>
> \startxmlsetups xml:elements % basic configuration for elements
> \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:title:author % basic configuration for attributes
> \xmlflush{#1}
> \stopxmlsetups
>
> I guess that the usefulness of this is not the actual configuration, but
> to know what you have to configure.
>
> I hope it helps,
>
> Pablo
------QUPRHIFQ4WWEWKY8D24HVKFOD1WC6I-- --===============0531219125875689907== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============0531219125875689907==--