root/BADataMunger/trunk/nscleanup.xsl

Revision 1444, 3.7 kB (checked in by thomase, 2 months ago)

code and changes for converting raw directory html in well-formed xhtml (cleaned up) and a semantic xml that combines elements of our old frankenformat and the more recent batlas id schema

  • Property svn:eol-style set to native
Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
3     xmlns:mods="http://www.loc.gov/mods/v3" xmlns:tei="http://www.tei-c.org/ns/1.0"
4     xmlns:awmcgaz="http://www.unc.edu/awmc/gazetteer/schemata/ns/0.3"
5     xmlns:adlgaz="http://www.alexandria.ucsb.edu/gazetteer/ContentStandard/version3.2/"
6     xmlns:georss="http://www.georss.org/georss" xmlns:dc="http://purl.org/dc/elements/1.1/"
7     xmlns:pleiades="http://atlantides.org/batlas/"
8     xmlns:xlink="http://www.w3.org/1999/xlink">
9
10     <xsl:template match="/">
11         <xsl:apply-templates />
12     </xsl:template>
13
14     <xsl:template match="xhtml:*">
15         <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
16             <xsl:copy-of select="@*" />
17             <xsl:apply-templates />
18         </xsl:element>
19     </xsl:template>
20
21     <xsl:template match="pleiades:*">
22         <xsl:element name="{local-name()}" namespace="http://atlantides.org/batlas/">
23             <xsl:copy-of select="@*" />
24             <xsl:apply-templates />
25         </xsl:element>
26     </xsl:template>
27    
28     <xsl:template match="mods:*">
29         <xsl:element name="{local-name()}" namespace="http://www.loc.gov/mods/v3">
30             <xsl:copy-of select="@*" />
31             <xsl:apply-templates />
32         </xsl:element>
33     </xsl:template>
34
35     <xsl:template match="tei:*">
36         <xsl:element name="tei:{local-name()}" namespace="http://www.tei-c.org/ns/1.0">
37             <xsl:for-each select="@*">
38                 <xsl:choose>
39                     <xsl:when test="namespace-uri(.)='http://www.w3.org/1999/xlink'">
40                         <xsl:attribute name="xlink:{local-name()}" namespace="http://www.w3.org/1999/xlink"><xsl:value-of select="."/></xsl:attribute>
41                     </xsl:when>
42                     <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
43                 </xsl:choose>
44             </xsl:for-each>
45             <xsl:apply-templates />
46         </xsl:element>
47     </xsl:template>
48    
49     <xsl:template match="@*"><xsl:copy-of select="."/></xsl:template>
50
51     <xsl:template match="awmcgaz:geoEntity">
52         <awmcgaz:geoEntity xmlns:awmcgaz="http://www.unc.edu/awmc/gazetteer/schemata/ns/0.3"
53             xmlns:adlgaz="http://www.alexandria.ucsb.edu/gazetteer/ContentStandard/version3.2/"
54             xmlns:georss="http://www.georss.org/georss" xmlns:tei="http://www.tei-c.org/ns/1.0"
55             xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xlink="http://www.w3.org/1999/xlink" >
56             <xsl:copy-of select="@*" />
57             <xsl:apply-templates />
58         </awmcgaz:geoEntity>
59     </xsl:template>
60
61     <xsl:template match="awmcgaz:*">
62         <xsl:element name="awmcgaz:{local-name()}" namespace="http://www.unc.edu/awmc/gazetteer/schemata/ns/0.3">
63             <xsl:copy-of select="@*" />
64             <xsl:apply-templates />
65         </xsl:element>
66     </xsl:template>
67
68     <xsl:template match="adlgaz:*">
69         <xsl:element name="adlgaz:{local-name()}"
70             namespace="http://www.alexandria.ucsb.edu/gazetteer/ContentStandard/version3.2/">
71             <xsl:copy-of select="@*" />
72             <xsl:apply-templates />
73         </xsl:element>
74     </xsl:template>
75
76     <xsl:template match="georss:*">
77         <xsl:element name="georss:{local-name()}" namespace="http://www.georss.org/georss">
78             <xsl:copy-of select="@*" />
79             <xsl:apply-templates />
80         </xsl:element>
81     </xsl:template>
82
83     <xsl:template match="dc:*">
84         <xsl:element name="dc:{local-name()}" namespace="http://purl.org/dc/elements/1.1/">
85             <xsl:copy-of select="@*" />
86             <xsl:apply-templates />
87         </xsl:element>
88     </xsl:template>
89
90 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.