Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / tools / checkxsl.xsl @ 187

History | View | Annotate | Download (2.6 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
		version="2.0">
4
<!--This software is dual-licensed:
5

    
6
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
7
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
8

    
9
2. http://www.opensource.org/licenses/BSD-2-Clause
10
		
11
All rights reserved.
12

    
13
Redistribution and use in source and binary forms, with or without
14
modification, are permitted provided that the following conditions are
15
met:
16

    
17
* Redistributions of source code must retain the above copyright
18
notice, this list of conditions and the following disclaimer.
19

    
20
* Redistributions in binary form must reproduce the above copyright
21
notice, this list of conditions and the following disclaimer in the
22
documentation and/or other materials provided with the distribution.
23

    
24
This software is provided by the copyright holders and contributors
25
"as is" and any express or implied warranties, including, but not
26
limited to, the implied warranties of merchantability and fitness for
27
a particular purpose are disclaimed. In no event shall the copyright
28
holder or contributors be liable for any direct, indirect, incidental,
29
special, exemplary, or consequential damages (including, but not
30
limited to, procurement of substitute goods or services; loss of use,
31
data, or profits; or business interruption) however caused and on any
32
theory of liability, whether in contract, strict liability, or tort
33
(including negligence or otherwise) arising in any way out of the use
34
of this software, even if advised of the possibility of such damage.
35

    
36
$Id: checkxsl.xsl 9646 2011-11-05 23:39:08Z rahtz $
37

    
38
2008, TEI Consortium
39
-->
40

    
41
<xsl:output method="text"/>
42
   <xsl:key name="TEMPLATES" match="xsl:template[@name]" use="1"/>
43
   <xsl:key name="CALLED_TEMPLATES" match="xsl:call-template[@name]" use="@name"/>
44

    
45
   <xsl:template match="xsl:stylesheet">
46
      <xsl:variable name="all">
47
         <xsl:copy-of select="xsl:template"/>
48
         <xsl:call-template name="inclusions"/>
49
      </xsl:variable>
50
      <xsl:for-each select="$all">
51
         <xsl:for-each select="key('TEMPLATES',1)">
52
            <xsl:if test="count(key('CALLED_TEMPLATES',@name))=0">
53
	Template <xsl:value-of select="@name"/> is not used
54
      </xsl:if>
55
         </xsl:for-each>
56
      </xsl:for-each>
57
   </xsl:template>
58

    
59
   <xsl:template name="inclusions">
60
      <xsl:for-each select="xsl:import|xsl:include">
61
         <xsl:for-each select="document(@href)/xsl:stylesheet">
62
            <xsl:copy-of select="xsl:template"/>
63
            <xsl:call-template name="inclusions"/>
64
         </xsl:for-each>
65
      </xsl:for-each>
66
   </xsl:template>
67
</xsl:stylesheet>