Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / common2 / textstructure.xsl @ 187

History | View | Annotate | Download (3.9 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
3
                
4
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
                exclude-result-prefixes="tei"
6
                version="2.0">
7
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
8
      <desc>
9
         <p> TEI stylesheet dealing with elements from the textstructure
10
      module. </p>
11
         <p>This software is dual-licensed:
12

    
13
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
14
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
15

    
16
2. http://www.opensource.org/licenses/BSD-2-Clause
17
		
18
All rights reserved.
19

    
20
Redistribution and use in source and binary forms, with or without
21
modification, are permitted provided that the following conditions are
22
met:
23

    
24
* Redistributions of source code must retain the above copyright
25
notice, this list of conditions and the following disclaimer.
26

    
27
* Redistributions in binary form must reproduce the above copyright
28
notice, this list of conditions and the following disclaimer in the
29
documentation and/or other materials provided with the distribution.
30

    
31
This software is provided by the copyright holders and contributors
32
"as is" and any express or implied warranties, including, but not
33
limited to, the implied warranties of merchantability and fitness for
34
a particular purpose are disclaimed. In no event shall the copyright
35
holder or contributors be liable for any direct, indirect, incidental,
36
special, exemplary, or consequential damages (including, but not
37
limited to, procurement of substitute goods or services; loss of use,
38
data, or profits; or business interruption) however caused and on any
39
theory of liability, whether in contract, strict liability, or tort
40
(including negligence or otherwise) arising in any way out of the use
41
of this software, even if advised of the possibility of such damage.
42
</p>
43
         <p>Author: See AUTHORS</p>
44
         <p>Id: $Id: textstructure.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
45
         <p>Copyright: 2011, TEI Consortium</p>
46
      </desc>
47
   </doc>
48
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
49
      <desc>Establish nesting depth of sections</desc>
50
   </doc>
51
  <xsl:template match="tei:text" mode="depth">
52
    <xsl:value-of select="count(ancestor::tei:text)-1"/>
53
  </xsl:template>
54
  <xsl:template match="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6"
55
                 mode="depth">
56
      <xsl:choose>
57
	<xsl:when test="ancestor::tei:text/parent::tei:group and
58
			self::tei:div">
59
	   <xsl:value-of select="count(ancestor::tei:div) + 1"/>
60
	</xsl:when>
61
         <xsl:when test="local-name(.) = 'div'">
62
            <xsl:value-of select="count(ancestor::tei:div)"/>
63
         </xsl:when>
64
	<xsl:when test="ancestor::tei:text/parent::tei:group">
65
	   <xsl:value-of select="number(substring-after(local-name(.),'div')) "/>
66
	</xsl:when>
67
	<xsl:when test="ancestor::tei:text/parent::tei:group">
68
	  <xsl:value-of select="number(substring-after(local-name(.),'div'))"/>
69
	</xsl:when>
70
	<xsl:otherwise>
71
	  <xsl:value-of select="number(substring-after(local-name(.),'div')) - 1"/>
72
         </xsl:otherwise>
73
      </xsl:choose>
74
  </xsl:template>
75

    
76
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
77
      <desc>Generate revision description</desc>
78
  </doc>
79
  <xsl:template match="tei:divGen[@type='revHist']">
80
    <xsl:variable name="r">
81
      <div xmlns="http://www.tei-c.org/ns/1.0" rend='nonumber'>
82
	<head>Revision history</head>
83
	<table rend="rules" >
84
	  <xsl:for-each
85
	      select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:revisionDesc/tei:change">
86
	    <row>
87
	      <cell><xsl:value-of select="@when"/></cell>
88
	      <cell><xsl:value-of select="@who"/></cell>
89
	      <cell><xsl:value-of select="."/></cell>
90
	    </row>
91
	  </xsl:for-each>
92
	</table>
93
      </div>
94
    </xsl:variable>
95
    <xsl:for-each select="$r">
96
      <xsl:apply-templates/>
97
    </xsl:for-each>
98
  </xsl:template>
99

    
100

    
101

    
102
</xsl:stylesheet>