File size: 1,143 Bytes
9a1f9ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" version="1.0" exclude-result-prefixes="tei">


  <xsl:template match="/">
    <xsl:processing-instruction name="xml-stylesheet">
      type="text/xsl" href="../custom.xsl"
    </xsl:processing-instruction>
    <xsl:apply-templates/>
  </xsl:template>

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

  <xsl:template match="@* | text() | processing-instruction() | comment()">
    <xsl:copy/>
  </xsl:template>

  <xsl:template match="tei:persName | tei:term | tei:placeName">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:if test="contains(@key, '#')">
	<xsl:attribute name="key">
	  <xsl:value-of select="translate(@key, '#', '')"/>
	</xsl:attribute>
      </xsl:if>
      <xsl:if test="not(@xml:id)">
	<xsl:attribute name="xml:id">
	  <xsl:value-of select="generate-id()"/>
	</xsl:attribute>
      </xsl:if>
      <xsl:apply-templates select="* | text()"/>
    </xsl:copy>
  </xsl:template>

  
</xsl:stylesheet>