wlpotter / csv-to-srophe

A set of XQuery modules for converting CSV data to Srophe-compliant TEI XML records. Developed for Syriaca.org
GNU General Public License v3.0
1 stars 1 forks source link

change xmlns declarations to be generated using computed namespace constructors #40

Closed wlpotter closed 2 years ago

wlpotter commented 2 years ago

I was not using computed element constructors as I did not realize namespaces could be dynamically constructed. A better way to handle this is to have somewhere in the config (I think) a list of the namespaces that should occur based on the entity type.

This can be created in the config module and used by the transform and templating scripts to dictate the output of the xmlns declarations on the TEI element (this avoids any duplication in the sub-elements).

The current setup does not allow entity-specific customization of which namespaces are declared on the TEI root element. Changing to something like the below should be much more useful

<listNamespace>
    <namespace prefix="srophe" entity="all">http://srophe.app</namespace>
    <namespace prefix="svg" entity="persons places">http://www.w3.org/2000/svg</namespace>
    <namespace prefix="skos" entity="subjects">http://www.w3.org/2004/02/skos/core#</namespace>
</listNamespace>

In config, then, loop through the namespace elements, test if @entity is all or the one selected and add create a namespace using

namespace {$prefix} {$text-node}

This list of prefixes can then be added to the element constructor for the TEI root element.

Priority because of #39