Statistics
| Revision:

root / tmp / org.txm.oriflamms.rcp / res / oriflamms-tokenize-chars-2-identify.xsl @ 2398

History | View | Annotate | Download (2.8 kB)

1
<?xml version="1.0"?>
2
<xsl:stylesheet
3
	xmlns:edate="http://exslt.org/dates-and-times"
4
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
	xmlns:tei="http://www.tei-c.org/ns/1.0"
6
	exclude-result-prefixes="tei edate" version="2.0">
7

    
8
	<xsl:output method="xml" encoding="utf-8"
9
		omit-xml-declaration="no" />
10

    
11
	<xsl:template match="node()|@*">
12
		<!-- Copy the current node -->
13
		<xsl:copy>
14
			<!-- Including any attributes it has and any child nodes -->
15
			<xsl:apply-templates select="@*|node()" />
16
		</xsl:copy>
17
	</xsl:template>
18

    
19
	<!-- <xsl:variable name="filename"> <xsl:analyze-string select="document-uri(.)" 
20
		regex="^(.*)/([^/]+)\.[^/]+$"> <xsl:matching-substring> <xsl:value-of select="regex-group(2)"/> 
21
		</xsl:matching-substring> </xsl:analyze-string> </xsl:variable> <xsl:variable 
22
		name="filedir"> <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$"> 
23
		<xsl:matching-substring> <xsl:value-of select="regex-group(1)"/> </xsl:matching-substring> 
24
		</xsl:analyze-string> </xsl:variable> <xsl:variable name="filenameresult"> 
25
		<xsl:value-of select="replace($filename,'(-ori)?-w$','')"/> </xsl:variable> 
26
		<xsl:variable name="path"> <xsl:value-of select="concat($filedir,'/',$filenameresult,'-c-temp/?select=*.xml;recurse=yes;on-error=warning')"/> 
27
		</xsl:variable> <xsl:variable name="files" select="collection($path)"/> <xsl:template 
28
		match="/"> <root>Processing files from <xsl:value-of select="$filedir/$filenameresult"/>-c-temp 
29
		directory. Result files saved in <xsl:value-of select="$filedir/$filenameresult"/>-c 
30
		directory.</root> <xsl:for-each select="$files"> <xsl:variable name="filename2"> 
31
		<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+).xml$"> 
32
		<xsl:matching-substring> <xsl:value-of select="regex-group(2)"></xsl:value-of> 
33
		</xsl:matching-substring> </xsl:analyze-string></xsl:variable> <xsl:result-document 
34
		href="{$filedir}/{$filenameresult}-c/{$filename2}-c.xml"> <xsl:apply-templates/> 
35
		</xsl:result-document> </xsl:for-each> </xsl:template> -->
36

    
37

    
38
	<xsl:template match="tei:c">
39
		<xsl:variable name="w-id">
40
			<xsl:choose>
41
				<xsl:when test="ancestor::tei:pc">
42
					<xsl:value-of select="ancestor::tei:pc[1]/@xml:id" />
43
				</xsl:when>
44
				<xsl:when test="ancestor::tei:w">
45
					<xsl:value-of select="ancestor::tei:w[1]/@xml:id" />
46
				</xsl:when>
47
				<xsl:when test="ancestor::tei:seg[@type='deleted']">
48
					<xsl:value-of
49
						select="ancestor::tei:seg[@type='deleted'][1]/@xml:id" />
50
				</xsl:when>
51
			</xsl:choose>
52
		</xsl:variable>
53
		<xsl:variable name="position">
54
			<xsl:number from="tei:w|tei:pc|tei:seg[@type='deleted']"
55
				level="any" />
56
		</xsl:variable>
57
		<xsl:copy>
58
			<xsl:apply-templates select="@*" />
59
			<xsl:attribute name="xml:id"><xsl:value-of
60
				select="concat('c_',$w-id,'_',$position)" /></xsl:attribute>
61
			<xsl:apply-templates />
62
		</xsl:copy>
63
	</xsl:template>
64

    
65

    
66

    
67
</xsl:stylesheet>