| Line 1... |
Line 1... |
| 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"><?
|
5 |
<xsl:template match="/macroelement"><?
|
| 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 |
|
- |
|
| Line 13... |
Line 8... |
| 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"/>
|
| Line 24... |
Line 19... |
| 24 |
}
|
19 |
}
|
| Line 25... |
Line 20... |
| 25 |
|
20 |
|
| 26 |
-->
|
- |
|
| 27 |
|
- |
|
| 28 |
}
|
21 |
-->
|
| 29 |
|
22 |
|
| 30 |
|
23 |
}
|
| 31 |
?>
|
24 |
?>
|
| 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>
|
- |
|
| 56 |
|
48 |
<xsl:template match="parametre[position()=last()]" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) </xsl:template>
|
| 57 |
<xsl:template match="parametre" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) and </xsl:template>
|
49 |
|
| 58 |
|
- |
|
| 59 |
|
- |
|
| 60 |
<xsl:template match="*" mode="level1root">
|
- |
|
| 61 |
$element= new domElement('<xsl:value-of select="name()"/>');
|
- |
|
| 62 |
$this->baseDOM->appendChild($element);
|
- |
|
| 63 |
<xsl:apply-templates select="@*"/>
|
- |
|
| 64 |
<xsl:apply-templates select="text()"/>
|
- |
|
| 65 |
</xsl:template>
|
- |
|
| 66 |
|
- |
|
| 67 |
<xsl:template match="mapping" mode="fetch">
|
- |
|
| 68 |
<xsl:apply-templates select="*" mode="level1"/>
|
- |
|
| 69 |
</xsl:template>
|
- |
|
| 70 |
|
- |
|
| 71 |
<xsl:template match="*" mode="level1">
|
- |
|
| 72 |
$element= new domElement('<xsl:value-of select="name()"/>');
|
- |
|
| 73 |
$this->baseDOM->appendChild($element);
|
- |
|
| 74 |
<xsl:apply-templates select="@*"/>
|
- |
|
| 75 |
<xsl:apply-templates select="text()"/>
|
- |
|
| 76 |
<xsl:apply-templates select="*" mode="level2"/>
|
- |
|
| 77 |
</xsl:template>
|
- |
|
| 78 |
|
- |
|
| 79 |
<xsl:template match="*" mode="level2">
|
- |
|
| 80 |
$this->baseDOM = $element;
|
- |
|
| 81 |
$element= new domElement('<xsl:value-of select="name()"/>');
|
- |
|
| 82 |
$this->baseDOM->appendChild($element);
|
- |
|
| 83 |
<xsl:apply-templates select="@*"/>
|
- |
|
| 84 |
<xsl:apply-templates select="text()"/>
|
- |
|
| 85 |
<xsl:apply-templates select="*" mode="level3"/>
|
- |
|
| 86 |
</xsl:template>
|
- |
|
| 87 |
|
- |
|
| 88 |
<xsl:template match="*" mode="level3">
|
- |
|
| 89 |
$this->baseDOM = $element;
|
- |
|
| 90 |
$element= new domElement('<xsl:value-of select="name()"/>');
|
- |
|
| 91 |
$this->baseDOM->appendChild($element);
|
- |
|
| 92 |
<xsl:apply-templates select="@*"/>
|
- |
|
| 93 |
<xsl:apply-templates select="text()"/>
|
- |
|
| 94 |
<xsl:apply-templates select="*" mode="level4"/>
|
- |
|
| 95 |
</xsl:template>
|
- |
|
| 96 |
|
50 |
<xsl:template match="parametre" mode="renseigne">!empty($contexte['<xsl:value-of select="@nom"/>']) and </xsl:template>
|
| 97 |
<xsl:template match="*" mode="level4">
|
51 |
|
| 98 |
$this->baseDOM = $element;
|
52 |
<xsl:template match="*" mode="level1root">
|
| 99 |
$element= new domElement('<xsl:value-of select="name()"/>');
|
53 |
$element= new domElement('<xsl:value-of select="name()"/>');
|
| - |
|
54 |
$this->baseDOM->appendChild($element);
|
| 100 |
$this->baseDOM->appendChild($element);
|
55 |
<xsl:apply-templates select="@*"/>
|
| - |
|
56 |
<xsl:apply-templates select="text()"/>
|
| - |
|
57 |
</xsl:template>
|
| 101 |
<xsl:apply-templates select="@*"/>
|
58 |
|
| 102 |
<xsl:apply-templates select="text()"/>
|
59 |
<xsl:template match="mapping" mode="fetch">
|
| - |
|
60 |
<xsl:apply-templates select="*" mode="level1"/>
|
| - |
|
61 |
</xsl:template>
|
| - |
|
62 |
|
| 103 |
|
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>
|
| 104 |
</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);
|
| 105 |
|
75 |
<xsl:apply-templates select="@*"/>
|
| 106 |
<xsl:template match="@*">
|
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;
|
| 107 |
$element->setAttribute('<xsl:value-of select="name()"/>',<xsl:value-of select="."/>);
|
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>
|
| 108 |
</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>
|
| 109 |
|
96 |
|
| 110 |
<xsl:template match="text()">
|
97 |
<xsl:template match="@*">
|
| - |
|
98 |
$element->setAttribute('<xsl:value-of select="name()"/>',<xsl:value-of select="."/>);
|
| - |
|
99 |
</xsl:template>
|
| - |
|
100 |
|
| 111 |
/*text(<xsl:value-of select="."/>)*/
|
101 |
<xsl:template match="text()">
|
| 112 |
</xsl:template>
|
102 |
/*text(<xsl:value-of select="."/>)*/
|
| 113 |
|
103 |
</xsl:template>
|