Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 27 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27 Rev 105
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
-
 
2
<!-- Note : enregistrer ce fichier avec l'encodage UTF-8 cookie. -->
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
    <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>
4
  <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>
4
    
-
 
5
    <xsl:template match="/macroelement">&lt;?
5
  <xsl:template match="/macroelement">&lt;?
6
      
-
 
7
        <xsl:apply-templates select="//balise2" mode="require_once"/>
6
    <xsl:apply-templates select="//balise2" mode="require_once"/>
8
        
-
 
9
    
-
 
10
        
-
 
11
        class <xsl:value-of select="@nom"/> extends macroElement {
7
        class <xsl:value-of select="@nom"/> extends macroElement {
12
        
-
 
13
            
8
            
14
            function getSQL()
9
            function getSQL()
15
            {
10
            {
16
                $contexte = array();
11
                $contexte = array();
17
                <xsl:apply-templates select="requetes/requete"/>
12
                <xsl:apply-templates select="requetes/requete"/>
18
                return;
13
                return;
19
            }
14
            }
20
        
15
              
21
            <!--function buildRoot()
16
            <!--function buildRoot()
22
            {
17
            {
23
                <xsl:apply_templates select="mapping" mode="root"/>
18
                <xsl:apply_templates select="mapping" mode="root"/>
24
            }
19
            }
25
 
20
 
26
            -->
21
            -->
27
        
22
        
28
        }
23
        }
29
        
-
 
30
        
-
 
31
?&gt;
24
?&gt;
32
    </xsl:template>
25
  </xsl:template>
33
    
26
  
34
    <xsl:template match="mapping" mode="root">
27
  <xsl:template match="mapping" mode="root">
35
        <xsl:apply-templates select="*[@root]" mode="level1root"/>
28
    <xsl:apply-templates select="*[@root]" mode="level1root"/>
36
    </xsl:template>
29
  </xsl:template>
37
    
30
  
38
    <xsl:template match="requete">
31
  <xsl:template match="requete">
39
                  if (<xsl:apply-templates select="parametres/parametre" mode="isnull"/>) 
32
                  if (<xsl:apply-templates select="parametres/parametre" mode="isnull"/>) 
40
                  {    
33
                  {    
41
                      <xsl:apply-templates select="parametres/parametre" mode="contexte"/>
34
                      <xsl:apply-templates select="parametres/parametre" mode="contexte"/>
42
                      if(<xsl:apply-templates select="parametres/parametre" mode="renseigne"/>)
35
                      if(<xsl:apply-templates select="parametres/parametre" mode="renseigne"/>)
43
                      {    return "<xsl:value-of select="sql"/>";  }
36
                      {    return "<xsl:value-of select="sql"/>";  }
44
                  }
37
                  }
45
    </xsl:template>
38
  </xsl:template>
46
    
39
  
47
    <xsl:template match="parametre[position()=last()]" mode="isnull">array_key_exists('<xsl:value-of select="@nom"/>',$this->contexteRef) </xsl:template>
40
  <xsl:template match="parametre[position()=last()]" mode="isnull">array_key_exists('<xsl:value-of select="@nom"/>',$this->contexteRef) </xsl:template>
48
    
41
  
49
    <xsl:template match="parametre" mode="isnull">array_key_exists('<xsl:value-of select="@nom"/>',$this->contexteRef) and </xsl:template>
42
  <xsl:template match="parametre" mode="isnull">array_key_exists('<xsl:value-of select="@nom"/>',$this->contexteRef) and </xsl:template>
50
    
43
  
51
    <xsl:template match="parametre" mode="contexte">
44
  <xsl:template match="parametre" mode="contexte">
52
                    $contexte['<xsl:value-of select="@nom"/>']= $this->contexteRef['<xsl:value-of select="@nom"/>'];
45
                    $contexte['<xsl:value-of select="@nom"/>']= $this->contexteRef['<xsl:value-of select="@nom"/>'];
53
    </xsl:template>
46
  </xsl:template>
54
 
47
  
55
    <xsl:template match="parametre[position()=last()]" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) </xsl:template>
48
  <xsl:template match="parametre[position()=last()]" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) </xsl:template>
56
 
49
  
57
    <xsl:template match="parametre" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) and </xsl:template>
50
  <xsl:template match="parametre" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) and </xsl:template>
58
 
-
 
59
    
51
  
60
    <xsl:template match="*" mode="level1root">
52
  <xsl:template match="*" mode="level1root">
61
           $element= new domElement('<xsl:value-of select="name()"/>');
53
           $element= new domElement('<xsl:value-of select="name()"/>');
62
            $this->baseDOM->appendChild($element);
54
            $this->baseDOM->appendChild($element);
63
            <xsl:apply-templates select="@*"/>
55
            <xsl:apply-templates select="@*"/>
64
            <xsl:apply-templates select="text()"/>
56
            <xsl:apply-templates select="text()"/>
65
    </xsl:template>
57
  </xsl:template>
66
    
58
  
67
   <xsl:template match="mapping" mode="fetch">
59
  <xsl:template match="mapping" mode="fetch">
68
       <xsl:apply-templates select="*" mode="level1"/>
60
    <xsl:apply-templates select="*" mode="level1"/>
69
    </xsl:template>
61
  </xsl:template>
70
    
62
  
71
    <xsl:template match="*" mode="level1">
63
  <xsl:template match="*" mode="level1">
72
           $element= new domElement('<xsl:value-of select="name()"/>');
64
    $element= new domElement('<xsl:value-of select="name()"/>');
73
            $this->baseDOM->appendChild($element);
65
    $this->baseDOM->appendChild($element);
74
            <xsl:apply-templates select="@*"/>
66
    <xsl:apply-templates select="@*"/>
75
            <xsl:apply-templates select="text()"/>
67
    <xsl:apply-templates select="text()"/>
76
        <xsl:apply-templates select="*" mode="level2"/>
68
    <xsl:apply-templates select="*" mode="level2"/>
77
    </xsl:template>
69
  </xsl:template>
78
    
70
  
79
    <xsl:template match="*" mode="level2">
71
  <xsl:template match="*" mode="level2">
80
            $this->baseDOM = $element;
72
    $this->baseDOM = $element;
81
           $element= new domElement('<xsl:value-of select="name()"/>');
73
    $element= new domElement('<xsl:value-of select="name()"/>');
82
            $this->baseDOM->appendChild($element);
74
    $this->baseDOM->appendChild($element);
83
            <xsl:apply-templates select="@*"/>
75
    <xsl:apply-templates select="@*"/>
84
            <xsl:apply-templates select="text()"/>
76
    <xsl:apply-templates select="text()"/>
85
        <xsl:apply-templates select="*" mode="level3"/>
77
    <xsl:apply-templates select="*" mode="level3"/>
86
    </xsl:template>
78
  </xsl:template>
87
    
79
  
88
    <xsl:template match="*" mode="level3">
80
  <xsl:template match="*" mode="level3">
89
            $this->baseDOM = $element;
81
    $this->baseDOM = $element;
90
           $element= new domElement('<xsl:value-of select="name()"/>');
82
    $element= new domElement('<xsl:value-of select="name()"/>');
91
            $this->baseDOM->appendChild($element);
83
    $this->baseDOM->appendChild($element);
92
            <xsl:apply-templates select="@*"/>
84
    <xsl:apply-templates select="@*"/>
93
            <xsl:apply-templates select="text()"/>
85
    <xsl:apply-templates select="text()"/>
94
        <xsl:apply-templates select="*" mode="level4"/>
86
    <xsl:apply-templates select="*" mode="level4"/>
95
    </xsl:template>
87
  </xsl:template>
96
    
88
  
97
    <xsl:template match="*" mode="level4">
89
  <xsl:template match="*" mode="level4">
98
            $this->baseDOM = $element;
90
    $this->baseDOM = $element;
99
           $element= new domElement('<xsl:value-of select="name()"/>');
91
    $element= new domElement('<xsl:value-of select="name()"/>');
100
            $this->baseDOM->appendChild($element);
92
    $this->baseDOM->appendChild($element);
101
            <xsl:apply-templates select="@*"/>
93
    <xsl:apply-templates select="@*"/>
102
            <xsl:apply-templates select="text()"/>
94
    <xsl:apply-templates select="text()"/>
103
    
-
 
104
    </xsl:template>
95
  </xsl:template>
105
    
96
  
106
    <xsl:template match="@*">
97
  <xsl:template match="@*">
107
            $element->setAttribute('<xsl:value-of select="name()"/>',<xsl:value-of select="."/>);
98
    $element->setAttribute('<xsl:value-of select="name()"/>',<xsl:value-of select="."/>);
108
    </xsl:template>
99
  </xsl:template>
109
    
100
  
110
    <xsl:template match="text()">
101
  <xsl:template match="text()">
111
        /*text(<xsl:value-of select="."/>)*/
102
    /*text(<xsl:value-of select="."/>)*/
112
    </xsl:template>
103
  </xsl:template>
113
    
-
 
114
    
104
  
115
</xsl:stylesheet>
105
</xsl:stylesheet>