[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/vendor/propel-generator/resources/xsl/ -> database.xsl (source)

   1  <?xml version="1.0" encoding="UTF-8"?>
   2  
   3  <!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>
   4  
   5  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   6  
   7      <xsl:output method="xml" indent="yes" encoding="UTF-8" />
   8  
   9      <xsl:template match="/">
  10          <xsl:apply-templates select='database'/>
  11      </xsl:template>
  12  
  13      <xsl:template match='database'>
  14          <database>
  15              <xsl:if test='not(boolean(@defaultIdMethod))'>
  16                  <xsl:attribute name='defaultIdMethod'>none</xsl:attribute>
  17              </xsl:if>
  18              <xsl:if test='not(boolean(@defaultPhpNamingMethod))'>
  19                  <xsl:attribute name='defaultPhpNamingMethod'>underscore</xsl:attribute>
  20              </xsl:if>
  21              <xsl:if test='not(boolean(@heavyIndexing))'>
  22                  <xsl:attribute name='heavyIndexing'>false</xsl:attribute>
  23              </xsl:if>
  24              <xsl:apply-templates select='@*'/>
  25              <xsl:apply-templates select='external-schema'/>
  26              <xsl:apply-templates select='table'/>
  27          </database>
  28      </xsl:template>
  29  
  30      <xsl:template match='@defaultPhPNamingMethod'>
  31          <xsl:attribute name='defaultPhPNamingMethod'><xsl:value-of select='translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'/></xsl:attribute>
  32      </xsl:template>
  33  
  34      <xsl:template match='@onDelete'>
  35          <xsl:choose>
  36              <xsl:when test='.=""'>
  37                  <xsl:attribute name='onDelete'>none</xsl:attribute>
  38              </xsl:when>
  39              <xsl:otherwise>
  40                  <xsl:attribute name='onDelete'><xsl:value-of select='translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'/></xsl:attribute>
  41              </xsl:otherwise>
  42          </xsl:choose>
  43      </xsl:template>
  44  
  45      <xsl:template match='@OnDelete'>
  46          <xsl:choose>
  47              <xsl:when test='.=""'>
  48                  <xsl:attribute name='onDelete'>none</xsl:attribute>
  49              </xsl:when>
  50              <xsl:otherwise>
  51                  <xsl:attribute name='onDelete'><xsl:value-of select='translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'/></xsl:attribute>
  52              </xsl:otherwise>
  53          </xsl:choose>
  54      </xsl:template>
  55  
  56      <xsl:template match='@onUpdate'>
  57          <xsl:choose>
  58              <xsl:when test='.=""'>
  59                  <xsl:attribute name='onUpdate'>none</xsl:attribute>
  60              </xsl:when>
  61              <xsl:otherwise>
  62                  <xsl:attribute name='onUpdate'><xsl:value-of select='translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'/></xsl:attribute>
  63              </xsl:otherwise>
  64          </xsl:choose>
  65      </xsl:template>
  66  
  67      <xsl:template match='@OnUpdate'>
  68          <xsl:choose>
  69              <xsl:when test='.=""'>
  70                  <xsl:attribute name='onUpdate'>none</xsl:attribute>
  71              </xsl:when>
  72              <xsl:otherwise>
  73                  <xsl:attribute name='onUpdate'><xsl:value-of select='translate(., "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'/></xsl:attribute>
  74              </xsl:otherwise>
  75          </xsl:choose>
  76      </xsl:template>
  77  
  78      <xsl:template match='@IdMethod'>
  79          <xsl:attribute name='idMethod'><xsl:value-of select='.'/></xsl:attribute>
  80      </xsl:template>
  81  
  82      <xsl:template match='@*' priority='-1'>
  83          <xsl:copy-of select='.'/>
  84      </xsl:template>
  85  
  86      <xsl:template match='external-schema'>
  87          <external-schema>
  88              <xsl:apply-templates select='@*'/>
  89          </external-schema>
  90      </xsl:template>
  91  
  92      <xsl:template match='table'>
  93          <table>
  94              <xsl:if test='not(boolean(@skipSql))'>
  95                  <xsl:attribute name='skipSql'>false</xsl:attribute>
  96              </xsl:if>
  97              <xsl:if test='not(boolean(@abstract))'>
  98                  <xsl:attribute name='abstract'>false</xsl:attribute>
  99              </xsl:if>
 100              <xsl:apply-templates select='@*'/>
 101              <xsl:apply-templates select='column'/>
 102              <xsl:apply-templates select='foreign-key'/>
 103              <xsl:apply-templates select='index'/>
 104              <xsl:apply-templates select='unique'/>
 105              <xsl:apply-templates select='id-method-parameter'/>
 106              <xsl:apply-templates select='validator'/>
 107              <xsl:apply-templates select='vendor'/>
 108          </table>
 109      </xsl:template>
 110  
 111      <xsl:template match='foreign-key'>
 112          <foreign-key>
 113              <xsl:if test='not(boolean(@onDelete)) and not(boolean(@OnDelete))'>
 114                  <xsl:attribute name='onDelete'>none</xsl:attribute>
 115              </xsl:if>
 116              <xsl:if test='not(boolean(@onUpdate)) and not(boolean(@OnUpdate))'>
 117                  <xsl:attribute name='onUpdate'>none</xsl:attribute>
 118              </xsl:if>
 119              <xsl:apply-templates select='@*'/>
 120              <xsl:apply-templates select='reference'/>
 121              <xsl:apply-templates select='vendor'/>
 122          </foreign-key>
 123      </xsl:template>
 124  
 125      <xsl:template match='index'>
 126          <index>
 127              <xsl:apply-templates select='@*'/>
 128              <xsl:apply-templates select='index-column'/>
 129          </index>
 130      </xsl:template>
 131  
 132      <xsl:template match='unique'>
 133          <unique>
 134              <xsl:apply-templates select='@*'/>
 135              <xsl:apply-templates select='unique-column'/>
 136          </unique>
 137      </xsl:template>
 138  
 139      <xsl:template match='unique-column'>
 140          <unique-column>
 141              <xsl:apply-templates select='@*'/>
 142              <xsl:apply-templates select='vendor'/>
 143          </unique-column>
 144      </xsl:template>
 145  
 146      <xsl:template match='index-column'>
 147          <index-column>
 148              <xsl:apply-templates select='@*'/>
 149              <xsl:apply-templates select='vendor'/>
 150          </index-column>
 151      </xsl:template>
 152  
 153      <xsl:template match='id-method-parameter'>
 154          <id-method-parameter>
 155              <xsl:if test='not(boolean(@name))'>
 156                  <xsl:attribute name='name'>default</xsl:attribute>
 157              </xsl:if>
 158              <xsl:apply-templates select='@*'/>
 159          </id-method-parameter>
 160      </xsl:template>
 161  
 162      <xsl:template match='validator'>
 163          <validator>
 164              <xsl:apply-templates select='@*'/>
 165              <xsl:apply-templates select='rule'/>
 166          </validator>
 167      </xsl:template>
 168  
 169      <xsl:template match='rule'>
 170          <rule>
 171              <xsl:if test='not(boolean(@name))'>
 172                  <xsl:attribute name='name'>class</xsl:attribute>
 173              </xsl:if>
 174              <xsl:apply-templates select='@*'/>
 175          </rule>
 176      </xsl:template>
 177  
 178      <xsl:template match='parameter'>
 179          <parameter>
 180              <xsl:apply-templates select='@*'/>
 181          </parameter>
 182      </xsl:template>
 183  
 184      <xsl:template match='vendor'>
 185          <vendor>
 186              <xsl:apply-templates select='@*'/>
 187              <xsl:apply-templates select='parameter'/>
 188          </vendor>
 189      </xsl:template>
 190  
 191      <xsl:template match='inheritance'>
 192          <inheritance>
 193              <xsl:apply-templates select='@*'/>
 194          </inheritance>
 195      </xsl:template>
 196  
 197      <xsl:template match='column'>
 198          <column>
 199              <xsl:if test='not(boolean(@primaryKey))'>
 200                  <xsl:attribute name='primaryKey'>false</xsl:attribute>
 201              </xsl:if>
 202              <xsl:if test='not(boolean(@required))'>
 203                  <xsl:attribute name='required'>false</xsl:attribute>
 204              </xsl:if>
 205              <xsl:if test='not(boolean(@type))'>
 206                  <xsl:attribute name='type'>VARCHAR</xsl:attribute>
 207              </xsl:if>
 208              <xsl:if test='not(boolean(@autoIncrement))'>
 209                  <xsl:attribute name='autoIncrement'>false</xsl:attribute>
 210              </xsl:if>
 211              <xsl:if test='not(boolean(@lazyLoad))'>
 212                  <xsl:attribute name='lazyLoad'>false</xsl:attribute>
 213              </xsl:if>
 214              <xsl:apply-templates select='@*'/>
 215              <xsl:apply-templates select='inheritance'/>
 216              <xsl:apply-templates select='vendor'/>
 217          </column>
 218      </xsl:template>
 219  
 220      <xsl:template match='reference'>
 221          <reference>
 222              <xsl:apply-templates select='@*'/>
 223          </reference>
 224      </xsl:template>
 225  
 226  </xsl:stylesheet>


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7