Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 27 | Details | Compare with Previous | Last modification | View Log | RSS feed

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