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
On 02/24/2016 01:10 AM, Pablo Rodriguez wrote:
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@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
___________________________________________________________________________________