Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / tools / extract-xsl-from-sch.xsl @ 187

History | View | Annotate | Download (2.2 kB)

1
<xsl:stylesheet
2
    xmlns:s="http://www.ascc.net/xml/schematron"
3
    xmlns:tei="http://www.tei-c.org/ns/1.0"
4
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
5
    xmlns:i="http://www.iso.org/ns/1.0"
6
    xmlns:XSL="http://www.w3.org/1999/XSL/TransformAlias" 
7
    exclude-result-prefixes="xsl s" 
8
    version="2.0"
9
>
10

    
11
<xsl:namespace-alias stylesheet-prefix="XSL" result-prefix="xsl"/>
12

    
13
<xsl:key name="CONTEXTS" use="." match="@context"/>
14
<xsl:key name="ALLCONTEXTS" use="1" match="@context"/>
15
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
16

    
17

    
18
<xsl:template match="/">
19
  <XSL:stylesheet
20
      xmlns:i="http://www.iso.org/ns/1.0"
21
      xmlns:tei="http://www.tei-c.org/ns/1.0"
22
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
23
      version="2.0"
24
      >
25
   
26
   <xsl:for-each select="key('ALLCONTEXTS',1)">
27
     <xsl:if test="generate-id(.)=generate-id(key('CONTEXTS',.)[1])">
28
       <XSL:template match="{.}" mode="checkSchematron">
29
	 <xsl:for-each select="key('CONTEXTS',.)">
30
	   <xsl:for-each select="parent::s:rule">
31
	     <xsl:for-each select="s:assert|s:report">
32
	       <xsl:choose>
33
		 <xsl:when test="self::s:assert">
34
		   <XSL:if test="not({@test})">
35
		     <XSL:call-template name="generateError">
36
		       <XSL:with-param name="message">
37
			 <xsl:value-of select="text()"/>
38
		       </XSL:with-param>
39
		     </XSL:call-template>
40
		   </XSL:if>
41
		 </xsl:when>
42
		 <xsl:when test="self::s:report">
43
		   <XSL:if test="{@test}">
44
		     <XSL:call-template name="generateError">
45
		       <XSL:with-param name="message">
46
			 <xsl:value-of select="text()"/>
47
		       </XSL:with-param>
48
		     </XSL:call-template>
49
		   </XSL:if>
50
		 </xsl:when>
51
	       </xsl:choose>
52
	     </xsl:for-each>
53
	   </xsl:for-each>
54
	 </xsl:for-each>
55
	 <XSL:call-template name="copyIt"/>
56
       </XSL:template>
57
     </xsl:if>
58
  </xsl:for-each>
59

    
60
  <XSL:template match="processing-instruction()" mode="checkSchematron">
61
    <XSL:call-template name="copyMe"/>
62
  </XSL:template>
63
  
64
  <XSL:template match="@*|text()|comment()" mode="checkSchematron">
65
    <XSL:call-template name="copyMe"/>
66
  </XSL:template>
67
  
68
  <XSL:template match="*" mode="checkSchematron">
69
    <XSL:call-template name="copyIt"/>
70
  </XSL:template>
71

    
72

    
73
</XSL:stylesheet>
74

    
75

    
76
</xsl:template>
77

    
78
</xsl:stylesheet>