Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / txm-filter-perseustreebank-xmlw.xsl @ 187

History | View | Annotate | Download (2.7 kB)

1
<?xml version="1.0"?>
2
<xsl:stylesheet
3
  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
4
  xmlns:edate="http://exslt.org/dates-and-times"
5
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
7
  xmlns:treebank="http://nlp.perseus.tufts.edu/syntax/treebank/1.5"
8
  exclude-result-prefixes="edate xd xsi treebank" version="2.0">
9
  
10
  
11
  <xd:doc type="stylesheet">
12
    <xd:short>
13
      A stylesheet to prepare PERSEUS Treebank XML texts to TXM XML/w import.
14
    </xd:short>
15
    <xd:detail>
16
      This stylesheet is free software; you can redistribute it and/or
17
      modify it under the terms of the GNU Lesser General Public
18
      License as published by the Free Software Foundation; either
19
      version 3 of the License, or (at your option) any later version.
20
      
21
      This stylesheet is distributed in the hope that it will be useful,
22
      but WITHOUT ANY WARRANTY; without even the implied warranty of
23
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24
      Lesser General Public License for more details.
25
      
26
      You should have received a copy of GNU Lesser Public License with
27
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
28
    </xd:detail>
29
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
30
    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
31
  </xd:doc>
32
  
33

    
34
  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
35
  
36
  <xsl:template match="*">
37
    <xsl:copy>
38
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>	
39
    </xsl:copy>
40
  </xsl:template>
41
  
42
  <xsl:template match="@*|comment()">
43
    <xsl:copy/>
44
  </xsl:template>
45
  
46
  <xsl:template match="processing-instruction()"/>
47
  
48
  <xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
49
  
50
<xsl:template match="treebank">
51
  <text type="treebank" version="{@version}" date="{normalize-space(child::date[1])}" annotator-short="{normalize-space(child::annotator[1]/short)}" annotator-name="{normalize-space(child::annotator[1]/name)}" annotator-address="{normalize-space(child::annotator[1]/address)}">
52
    <xsl:apply-templates select="descendant::sentence"/>
53
  </text>
54
</xsl:template>
55

    
56
<xsl:template match="annotator"/>
57
  
58
<xsl:template match="sentence">
59
  <xsl:copy>
60
    <xsl:apply-templates select="@*"/>
61
    <xsl:attribute name="annotator"><xsl:value-of select="child::annotator"/></xsl:attribute>
62
    <xsl:apply-templates/>
63
  </xsl:copy>
64
</xsl:template>
65
  
66
  <xsl:template match="word">
67
    <w>
68
      <xsl:apply-templates select="@*[not(name()='form')]"/>
69
      <xsl:value-of select="@form"></xsl:value-of>
70
    </w>
71
  </xsl:template>
72

    
73
</xsl:stylesheet>