Skip to content

Commit

Permalink
Add program for fixing USAS taxonomy, cf. #202.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomazErjavec committed Mar 30, 2022
1 parent 343b44e commit e7bbb29
Show file tree
Hide file tree
Showing 4 changed files with 3,220 additions and 1,359 deletions.
4 changes: 4 additions & 0 deletions Data/Taxonomies/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fix-usas:
$s -xsl:fix-usastaxo.xsl usas-taxonomy.orig.xml > usas-taxonomy.xml
xmllint --noout usas-taxonomy.orig.xml
s = java -jar /usr/share/java/saxon.jar
42 changes: 42 additions & 0 deletions Data/Taxonomies/fix-usastaxo.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!-- Fix USAS taxonomy -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns="http://www.tei-c.org/ns/1.0"
xmlns:et="http://nl.ijs.si/et"
exclude-result-prefixes="#all"
version="2.0">

<xsl:output method="xml" indent="yes"/>

<xsl:template match="tei:teiCorpus | tei:teiHeader">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

<xsl:template match="@id">
<xsl:attribute name="xml:id">
<xsl:value-of select="replace(
replace(
replace(., ':', '.'),
'\-', 'n'),
'\+', 'p')
"/>
</xsl:attribute>
</xsl:template>

<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*">
<xsl:copy/>
</xsl:template>

</xsl:stylesheet>
Loading

0 comments on commit e7bbb29

Please sign in to comment.