[NTG-context] TEI to context XML mappings?

Hans Hagen pragma at wxs.nl
Sun Aug 14 15:38:07 CEST 2016


On 8/14/2016 7:03 AM, Mica Semrick wrote:
>
> 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 <http://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.

we already have an analyzer:

context --extra=xml --analyze --autopdf music-collection.xml

i'll add a --template option for generating a bunch of setups (not the 
most efficient way to define a mapping but anyway)

context --extra=xml --analyze --template --autopdf music-collection.xml

> Best,
> Mica
>
> Pablo Rodriguez <oinos at 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
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>


-- 

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


More information about the ntg-context mailing list