Browse Source

- reindented

Jan Janak 17 years ago
parent
commit
7014913861

+ 124 - 124
doc/stylesheets/dbschema/xsl/common.xsl

@@ -1,78 +1,78 @@
 <?xml version='1.0'?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-	version='1.0'>
-    
-    <xsl:key name="column_id" match="column" use="@id|xml:id"/>
-
-    <xsl:param name="prefix" select="_"/>
-    <xsl:param name="dir" select="mm"/>
-    <xsl:param name="db" select="_"/>
-
-    <xsl:variable name="sign-prefix">unsigned </xsl:variable>
-    
-    <!-- Do not output text -->
-    <xsl:template match="text()|@*"/>
-    <xsl:template match="text()|@*" mode="drop"/>
-
-    <!-- Return the name of the context element, first look for a database
-         specific name, use the common name if no database-specific name
-         is found.
+				version='1.0'>
+  
+  <xsl:key name="column_id" match="column" use="@id|xml:id"/>
+
+  <xsl:param name="prefix" select="_"/>
+  <xsl:param name="dir" select="mm"/>
+  <xsl:param name="db" select="_"/>
+
+  <xsl:variable name="sign-prefix">unsigned </xsl:variable>
+  
+  <!-- Do not output text -->
+  <xsl:template match="text()|@*"/>
+  <xsl:template match="text()|@*" mode="drop"/>
+
+  <!-- Return the name of the context element, first look for a database
+       specific name, use the common name if no database-specific name
+       is found.
     -->
-    <xsl:template name="get-name">
+  <xsl:template name="get-name">
 	<xsl:param name="select" select="."/>
 	<xsl:choose>
-	    <!-- override test -->
-	    <xsl:when test="count($select/name[@db=$db])='1'">
+	  <!-- override test -->
+	  <xsl:when test="count($select/name[@db=$db])='1'">
 		<xsl:value-of select="normalize-space($select/name[@db=$db])"/>
-	    </xsl:when>
-	    <!-- No override, use the standard name -->
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <!-- No override, use the standard name -->
+	  <xsl:otherwise>
 		<xsl:value-of select="normalize-space($select/name)"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="type-error">
+  <xsl:template name="type-error">
 	<xsl:message terminate="yes">
-	    <xsl:text>ERROR: Table: </xsl:text>
-	    <xsl:value-of select="normalize-space(parent::table/name)"/>
-	    <xsl:text>, column: </xsl:text>
-	    <xsl:value-of select="normalize-space(name)"/>
-	    <xsl:text> - unsupported column type: </xsl:text>
-	    <xsl:value-of select="normalize-space(type)"/>
-	    <xsl:text>.</xsl:text>
+	  <xsl:text>ERROR: Table: </xsl:text>
+	  <xsl:value-of select="normalize-space(parent::table/name)"/>
+	  <xsl:text>, column: </xsl:text>
+	  <xsl:value-of select="normalize-space(name)"/>
+	  <xsl:text> - unsupported column type: </xsl:text>
+	  <xsl:value-of select="normalize-space(type)"/>
+	  <xsl:text>.</xsl:text>
 	</xsl:message>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- Process the root database element -->
-    <xsl:template match="/">
+  <!-- Process the root database element -->
+  <xsl:template match="/">
 	<!-- Process only the first database element, this is supposed to be
 	     the root database element and having multiple database elements is
 	     a bug
-	-->
+	  -->
 	<xsl:apply-templates select="database[1]"/>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- ################ DATABASE ################# -->
+  <!-- ################ DATABASE ################# -->
 
-    <xsl:template match="database">
+  <xsl:template match="database">
 
 	<!-- Create all tables -->
 	<xsl:apply-templates select="table"/>
 	<xsl:apply-templates select="user"/>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="database" mode="data">
+  <xsl:template match="database" mode="data">
 
 	<!-- Insert initial data -->
 	<xsl:apply-templates select="table" mode="data"/>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- ################ /DATABASE ################# -->
+  <!-- ################ /DATABASE ################# -->
 
-    <!-- ################ TABLE ################# -->
+  <!-- ################ TABLE ################# -->
 
-    <xsl:template match="table">
+  <xsl:template match="table">
 	<!-- Process all columns -->
 	<xsl:apply-templates select="column"/>
 
@@ -81,153 +81,153 @@
 
 	<!-- Process initial data --> 
 	<xsl:apply-templates select="row"/>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- ################ /TABLE ################# -->
+  <!-- ################ /TABLE ################# -->
 
-    <!-- ################ COLUMN ################# -->
-    
-    <xsl:template match="column"/>
+  <!-- ################ COLUMN ################# -->
+  
+  <xsl:template match="column"/>
 
-    <xsl:template name="get-type-string">
+  <xsl:template name="get-type-string">
 	<xsl:param name="select" select="."/>
 	<xsl:choose>
-	    <xsl:when test="count($select/type[@db=$db])='1'">
+	  <xsl:when test="count($select/type[@db=$db])='1'">
 		<xsl:value-of select="translate(normalize-space($select/type[@db=$db]),
-		  'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
-	    </xsl:when>
-	    <xsl:otherwise>
+							  'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:value-of select="translate(normalize-space($select/type),
-		  'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
-	    </xsl:otherwise>
+							  'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="get-type">
+  <xsl:template name="get-type">
 	<xsl:param name="select" select="."/>
 	<xsl:variable name="type">
-	    <xsl:call-template name="get-type-string">
+	  <xsl:call-template name="get-type-string">
 		<xsl:with-param name="select" select="$select"/>
-	    </xsl:call-template>
+	  </xsl:call-template>
 	</xsl:variable>
 	<xsl:choose>
-	    <xsl:when test="starts-with($type, $sign-prefix)">
+	  <xsl:when test="starts-with($type, $sign-prefix)">
 		<xsl:value-of select="substring-after($type, $sign-prefix)"/>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:value-of select="$type"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
-    
-    <xsl:template name="get-sign">
+  </xsl:template>
+  
+  <xsl:template name="get-sign">
 	<xsl:param name="select" select="."/>
 	<xsl:variable name="type">
-	    <xsl:call-template name="get-type-string">
+	  <xsl:call-template name="get-type-string">
 		<xsl:with-param name="select" select="$select"/>
-	    </xsl:call-template>
+	  </xsl:call-template>
 	</xsl:variable>
 	<xsl:choose>
-	    <xsl:when test="starts-with($type, $sign-prefix)">0</xsl:when>
-	    <xsl:otherwise>1</xsl:otherwise>
+	  <xsl:when test="starts-with($type, $sign-prefix)">0</xsl:when>
+	  <xsl:otherwise>1</xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="get-null">
+  <xsl:template name="get-null">
 	<xsl:param name="select" select="."/>
 	<xsl:choose>
-	    <xsl:when test="count($select/null[@db=$db])='1'">1</xsl:when>
-	    <xsl:when test="count($select/null)='1'">1</xsl:when>
-	    <xsl:otherwise>0</xsl:otherwise>
+	  <xsl:when test="count($select/null[@db=$db])='1'">1</xsl:when>
+	  <xsl:when test="count($select/null)='1'">1</xsl:when>
+	  <xsl:otherwise>0</xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="get-size">
+  <xsl:template name="get-size">
 	<xsl:param name="select" select="."/>
 	<xsl:choose>
-	    <xsl:when test="count($select/size[@db=$db])='1'">
+	  <xsl:when test="count($select/size[@db=$db])='1'">
 		<xsl:value-of select="normalize-space($select/size[@db=$db])"/>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:value-of select="normalize-space($select/size)"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
 
-    <!-- column ID to column name -->
-    <xsl:template name="get-column-name">
+  <!-- column ID to column name -->
+  <xsl:template name="get-column-name">
 	<xsl:param name="select" select="."/>
 
 	<xsl:variable name="columns" select="key('column_id', $select)"/>
 	<xsl:variable name="column" select="$columns[1]"/>
 	<xsl:choose>
-	    <xsl:when test="count($column) = 0">
+	  <xsl:when test="count($column) = 0">
 		<xsl:message terminate="yes">
-		    <xsl:text>ERROR: Column with id '</xsl:text>
-		    <xsl:value-of select="$select"/>
-		    <xsl:text>' does not exist.</xsl:text>
+		  <xsl:text>ERROR: Column with id '</xsl:text>
+		  <xsl:value-of select="$select"/>
+		  <xsl:text>' does not exist.</xsl:text>
 		</xsl:message>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:call-template name="get-name">
-		    <xsl:with-param name="select" select="$column"/>
+		  <xsl:with-param name="select" select="$column"/>
 		</xsl:call-template>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
-    <!-- ################ /COLUMN ################# -->
+  </xsl:template>
+  <!-- ################ /COLUMN ################# -->
 
-    <!-- ################ INDEX ################# -->
+  <!-- ################ INDEX ################# -->
 
-    <xsl:template match="index">
+  <xsl:template match="index">
 	<xsl:apply-templates match="colref"/>
-    </xsl:template>
-    
-    <!-- ################ /INDEX ################# -->
+  </xsl:template>
+  
+  <!-- ################ /INDEX ################# -->
 
-    <!-- ################ COLREF ################# -->
+  <!-- ################ COLREF ################# -->
 
-    <xsl:template match="colref"/>
+  <xsl:template match="colref"/>
 
-    <xsl:template name="get-column">
+  <xsl:template name="get-column">
 	<xsl:param name="id" select="/.."/>	
 	<xsl:variable name="columns" select="key('column_id', $id)"/>
 	<xsl:variable name="column" select="$columns[1]"/>
 
 	<xsl:choose>
-	    <xsl:when test="count($column) = 0">
+	  <xsl:when test="count($column) = 0">
 		<xsl:message terminate="yes">
-		    <xsl:text>ERROR: Column with id '</xsl:text>
-		    <xsl:value-of select="$id"/>
-		    <xsl:text>' does not exist.</xsl:text>
+		  <xsl:text>ERROR: Column with id '</xsl:text>
+		  <xsl:value-of select="$id"/>
+		  <xsl:text>' does not exist.</xsl:text>
 		</xsl:message>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:copy-of select="$column"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- ################ /COLREF ################# -->
+  <!-- ################ /COLREF ################# -->
 
-    <!-- ################ ROW ################# -->
+  <!-- ################ ROW ################# -->
 
-    <xsl:template match="row">
+  <xsl:template match="row">
 	<xsl:apply-templates select="value"/>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- ################ /ROW ################# -->
+  <!-- ################ /ROW ################# -->
 
-    <!-- ################ VALUE ################# -->
+  <!-- ################ VALUE ################# -->
 
-    <xsl:template match="value"/>
+  <xsl:template match="value"/>
 
-    <!-- ################ /VALUE ################# -->
+  <!-- ################ /VALUE ################# -->
 
-    <!-- ################ USER ################# -->
+  <!-- ################ USER ################# -->
 
-    <xsl:template match="user"/>
+  <xsl:template match="user"/>
 
-    <!-- ################ /USER ################# -->
+  <!-- ################ /USER ################# -->
 </xsl:stylesheet>

+ 68 - 68
doc/stylesheets/dbschema/xsl/dbtext.xsl

@@ -3,149 +3,149 @@
                 version='1.0'
                 xmlns:xi="http://www.w3.org/2001/XInclude">
 
-    <xsl:import href="common.xsl"/>
-    <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
+  <xsl:import href="common.xsl"/>
+  <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
 
-    <!-- Create the file for the table in dbtext subdirectory -->
-    <xsl:template match="table">
+  <!-- Create the file for the table in dbtext subdirectory -->
+  <xsl:template match="table">
 	<xsl:variable name="name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 	
 	<xsl:variable name="path" select="concat($dir, concat('/', concat($prefix, $name)))"/>
 	<xsl:document 
-	    href="{$path}"
-	    method="text"
-	    indent="no"
-	    omit-xml-declaration="yes">
-		<xsl:apply-imports/>
+	   href="{$path}"
+	   method="text"
+	   indent="no"
+	   omit-xml-declaration="yes">
+	  <xsl:apply-imports/>
 	</xsl:document>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- Create column definitions -->
-    <xsl:template match="column">
+  <!-- Create column definitions -->
+  <xsl:template match="column">
 	<xsl:variable name="type">
-	    <xsl:call-template name="get-type"/>
+	  <xsl:call-template name="get-type"/>
 	</xsl:variable>
 
 	<xsl:variable name="null">
-	    <xsl:call-template name="get-null"/>
+	  <xsl:call-template name="get-null"/>
 	</xsl:variable>
 
 	<xsl:call-template name="get-name"/>
 	<xsl:text>(</xsl:text>
 	<xsl:choose>
-	    <xsl:when test="type[@db=$db]">
+	  <xsl:when test="type[@db=$db]">
 		<xsl:value-of select="normalize-space(type[@db=$db])"/>
-	    </xsl:when>
-	    <xsl:when test="$type='char' or 
-		            $type='short' or 
-                            $type='int' or
-	                    $type='long' or 
-                            $type='datetime'">
+	  </xsl:when>
+	  <xsl:when test="$type='char' or 
+		              $type='short' or 
+                      $type='int' or
+	                  $type='long' or 
+                      $type='datetime'">
 		<xsl:text>int</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="$type='float' or 
-		            $type='double'">
+	  </xsl:when>
+	  <xsl:when test="$type='float' or 
+		              $type='double'">
 		<xsl:text>double</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="$type='string' or 
-                            $type='binary'">
+	  </xsl:when>
+	  <xsl:when test="$type='string' or 
+                      $type='binary'">
 		<xsl:text>str</xsl:text>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:call-template name="type-error"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
 
 	<xsl:if test="$null=1">
-	    <xsl:text>,null</xsl:text>
+	  <xsl:text>,null</xsl:text>
 	</xsl:if>
 	<xsl:text>) </xsl:text>
 	<xsl:if test="position()=last()">
-	    <xsl:text>&#x0A;</xsl:text>
+	  <xsl:text>&#x0A;</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- Escape all : occurrences -->
-    <xsl:template name="escape">
+  <!-- Escape all : occurrences -->
+  <xsl:template name="escape">
 	<xsl:param name="value"/>
 	<xsl:choose>
-	    <xsl:when test="contains($value, ':')">
+	  <xsl:when test="contains($value, ':')">
 		<xsl:value-of select="concat(substring-before($value, ':'), '\:')"/>
 		<xsl:call-template name="escape">
-		    <xsl:with-param name="value" select="substring-after($value, ':')"/>
+		  <xsl:with-param name="value" select="substring-after($value, ':')"/>
 		</xsl:call-template>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:value-of select="$value"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- Process initial data -->
-    <xsl:template match="row">
+  <!-- Process initial data -->
+  <xsl:template match="row">
 	<!-- store the actual row so that it can be used later 
 	     with another context node 
-	-->
+	  -->
 	<xsl:variable name="row" select="."/>
 
 	<!-- Walk through all the columns of the table and lookup
 	     corresponding values based on id-col match from the
-             current row, use the default value of the column if
+         current row, use the default value of the column if
 	     there is no value with matching col attribute in the
-             current row
-	-->
+         current row
+	  -->
 	<xsl:for-each select="parent::table/column">
-	    <xsl:variable name="id" select="@id"/>
-	    <xsl:call-template name="escape">
+	  <xsl:variable name="id" select="@id"/>
+	  <xsl:call-template name="escape">
 		<xsl:with-param name="value">
-		    <xsl:choose>
+		  <xsl:choose>
 			<!-- If we have db-specific value, use it -->
 			<xsl:when test="$row/value[@col=$id and @db=$db]">
-			    <xsl:value-of select="normalize-space($row/value[@col=$id and @db=$db])"/>
+			  <xsl:value-of select="normalize-space($row/value[@col=$id and @db=$db])"/>
 			</xsl:when>
 			<!-- No db-specific value, try generic -->
 			<xsl:when test="$row/value[@col=$id]">
-			    <xsl:value-of select="normalize-space($row/value[@col=$id])"/>
+			  <xsl:value-of select="normalize-space($row/value[@col=$id])"/>
 			</xsl:when>
 			<!-- No value at all, try db-specific default value for the column -->
 			<xsl:when test="default[@db=$db]">
-			    <xsl:value-of select="normalize-space(default[@db=$db])"/>
+			  <xsl:value-of select="normalize-space(default[@db=$db])"/>
 			</xsl:when>
 			<!-- Try generic default value for the column -->
 			<xsl:when test="default">
-			    <xsl:value-of select="normalize-space(default)"/>
+			  <xsl:value-of select="normalize-space(default)"/>
 			</xsl:when>
 			<!-- No value and no default value for the column - ouch -->
 			<xsl:otherwise>
-			    <xsl:message terminate="yes">
+			  <xsl:message terminate="yes">
 				<xsl:text>ERROR: Value for column </xsl:text>
 				<xsl:value-of select="normalize-space(name)"/>
 				<xsl:text> in table </xsl:text>
 				<xsl:value-of select="normalize-space(parent::table/name)"/>
 				<xsl:text> was not provided and the column has no default value.</xsl:text>
-			    </xsl:message>
+			  </xsl:message>
 			</xsl:otherwise>
-		    </xsl:choose>
+		  </xsl:choose>
 		</xsl:with-param>
-	    </xsl:call-template>
-		
-	    <xsl:if test="not(position()=last())">
+	  </xsl:call-template>
+	  
+	  <xsl:if test="not(position()=last())">
 		<xsl:text>:</xsl:text>
-	    </xsl:if>
+	  </xsl:if>
 	</xsl:for-each>
 
 	<xsl:apply-imports/>
 	<xsl:text>&#x0A;</xsl:text>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- Make sure all values reference existing columns -->
-    <xsl:template match="value">
+  <!-- Make sure all values reference existing columns -->
+  <xsl:template match="value">
 	<xsl:variable name="column">
-	    <xsl:call-template name="get-column">
+	  <xsl:call-template name="get-column">
 		<xsl:with-param name="id" select="@col"/>
-	    </xsl:call-template>
+	  </xsl:call-template>
 	</xsl:variable>
-    </xsl:template>
+  </xsl:template>
 </xsl:stylesheet>

+ 77 - 77
doc/stylesheets/dbschema/xsl/mysql.xsl

@@ -1,171 +1,171 @@
 <?xml version='1.0'?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version='1.0'
->
+				>
 
-    <xsl:import href="sql.xsl"/>
+  <xsl:import href="sql.xsl"/>
 
-    <xsl:template match="database" mode="drop">
+  <xsl:template match="database" mode="drop">
 	<xsl:apply-templates mode="drop"/>
-    </xsl:template>
-    
-    <xsl:template name="table.close">
+  </xsl:template>
+  
+  <xsl:template name="table.close">
 	<xsl:text>)</xsl:text>
 	<xsl:if test="type[@db=$db]">
-	    <xsl:text> Type=</xsl:text>
-	    <xsl:value-of select="normalize-space(type[@db=$db])"/>
+	  <xsl:text> Type=</xsl:text>
+	  <xsl:value-of select="normalize-space(type[@db=$db])"/>
 	</xsl:if>
 	<xsl:text>;&#x0A;&#x0A;</xsl:text>	
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.type">
+  <xsl:template name="column.type">
 	<xsl:variable name="type">
-	    <xsl:call-template name="get-type"/>
+	  <xsl:call-template name="get-type"/>
 	</xsl:variable>
 
 	<xsl:choose>
-	    <xsl:when test="type[@db=$db]">
+	  <xsl:when test="type[@db=$db]">
 		<xsl:value-of select="normalize-space(type[@db=$db])"/>
-	    </xsl:when>
-	    <xsl:when test="$type='char'">
+	  </xsl:when>
+	  <xsl:when test="$type='char'">
 		<xsl:text>TINYINT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='short'">
+	  </xsl:when>
+	  <xsl:when test="$type='short'">
 		<xsl:text>SMALLINT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='int'">
+	  </xsl:when>
+	  <xsl:when test="$type='int'">
 		<xsl:text>INT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='long'">
+	  </xsl:when>
+	  <xsl:when test="$type='long'">
 		<xsl:text>BIGINT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='datetime'">
+	  </xsl:when>
+	  <xsl:when test="$type='datetime'">
 		<xsl:text>DATETIME</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='double'">
+	  </xsl:when>
+	  <xsl:when test="$type='double'">
 		<xsl:text>DOUBLE</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='float'">
+	  </xsl:when>
+	  <xsl:when test="$type='float'">
 		<xsl:text>FLOAT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='string'">
+	  </xsl:when>
+	  <xsl:when test="$type='string'">
 		<xsl:text>VARCHAR</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='binary'">
+	  </xsl:when>
+	  <xsl:when test="$type='binary'">
 		<xsl:text>BLOB</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:call-template name="type-error"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.trailing">
+  <xsl:template name="column.trailing">
 	<xsl:variable name="signed">
-	    <xsl:call-template name="get-sign"/>
+	  <xsl:call-template name="get-sign"/>
 	</xsl:variable>
 	
 	<xsl:if test="$signed = 0">
-	    <xsl:text> UNSIGNED</xsl:text>
+	  <xsl:text> UNSIGNED</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="index">
+  <xsl:template match="index">
 	<xsl:variable name="index.name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 
 	<xsl:if test="position()=1">
-	    <xsl:text>,&#x0A;</xsl:text>
+	  <xsl:text>,&#x0A;</xsl:text>
 	</xsl:if>
 	<xsl:text>    </xsl:text>
 	<xsl:if test="unique">
-	    <xsl:text>UNIQUE </xsl:text>
+	  <xsl:text>UNIQUE </xsl:text>
 	</xsl:if>
 	<xsl:text>KEY </xsl:text>
 	<xsl:if test="not($index.name='')">
-	    <xsl:value-of select="concat($index.name, ' ')"/>
+	  <xsl:value-of select="concat($index.name, ' ')"/>
 	</xsl:if>
 	<xsl:text>(</xsl:text>
 	<xsl:apply-templates select="colref"/>
 	<xsl:text>)</xsl:text>
 	<xsl:if test="not(position()=last())">
-	    <xsl:text>,</xsl:text>
-	    <xsl:text>&#x0A;</xsl:text>
+	  <xsl:text>,</xsl:text>
+	  <xsl:text>&#x0A;</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="get-userid">
+  <xsl:template name="get-userid">
 	<xsl:param name="select" select="."/>
 	<xsl:param name="host" select="/.."/>
 	<xsl:text>'</xsl:text>
 	<xsl:choose>
-	    <!-- override test -->
-	    <xsl:when test="count($select/username[@db=$db])='1'">
+	  <!-- override test -->
+	  <xsl:when test="count($select/username[@db=$db])='1'">
 		<xsl:value-of select="normalize-space($select/username[@db=$db])"/>
-	    </xsl:when>
-	    <!-- No override, use the standard name -->
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <!-- No override, use the standard name -->
+	  <xsl:otherwise>
 		<xsl:value-of select="normalize-space($select/username)"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
 	<xsl:text>'</xsl:text>
 
 	<xsl:text>@'</xsl:text>
 	<xsl:choose>
-	    <xsl:when test="count($host)='1'">
+	  <xsl:when test="count($host)='1'">
 		<xsl:value-of select="normalize-space($host)"/>
-	    </xsl:when>
-	    <xsl:when test="count(host[@db=$db])='1'">
+	  </xsl:when>
+	  <xsl:when test="count(host[@db=$db])='1'">
 		<xsl:value-of select="normalize-space(host[@db=$db])"/>
-	    </xsl:when>
-	    <xsl:when test="count(host)='1'">
+	  </xsl:when>
+	  <xsl:when test="count(host)='1'">
 		<xsl:value-of select="normalize-space(host)"/>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:text>%</xsl:text>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
 	<xsl:text>'</xsl:text>
-    </xsl:template>
+  </xsl:template>
 
-<!-- ################ ROW ################  -->
+  <!-- ################ ROW ################  -->
 
-    <!-- override common template for ROW. Create INSERT statements 
-         with IGNORE keyword
-      -->
-    <xsl:template match="row">
+  <!-- override common template for ROW. Create INSERT statements 
+       with IGNORE keyword
+    -->
+  <xsl:template match="row">
 	<xsl:if test="@vendor-controlled[1]">
-	    <xsl:text>DELETE FROM </xsl:text>	    
-	    <xsl:call-template name="get-name">
+	  <xsl:text>DELETE FROM </xsl:text>	    
+	  <xsl:call-template name="get-name">
 		<xsl:with-param name="select" select="parent::table"/>
-	    </xsl:call-template>
-	    <xsl:text> WHERE </xsl:text>	    
-	    <xsl:call-template name="row-identification"/>
-	    <xsl:text>;&#x0A;</xsl:text>	    
+	  </xsl:call-template>
+	  <xsl:text> WHERE </xsl:text>	    
+	  <xsl:call-template name="row-identification"/>
+	  <xsl:text>;&#x0A;</xsl:text>	    
 	</xsl:if>
 
 	<xsl:text>INSERT IGNORE INTO </xsl:text>
 	<xsl:call-template name="get-name">
-	    <xsl:with-param name="select" select="parent::table"/>
+	  <xsl:with-param name="select" select="parent::table"/>
 	</xsl:call-template>
 	<xsl:text> (</xsl:text>
 	<xsl:apply-templates select="value" mode="colname"/>
@@ -173,10 +173,10 @@
 	<xsl:apply-templates select="value"/>
 	<xsl:text>);&#x0A;</xsl:text>
 	<xsl:if test="position()=last()">
-	    <xsl:text>&#x0A;</xsl:text>	    
+	  <xsl:text>&#x0A;</xsl:text>	    
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-<!-- ################ /ROW ################  -->
+  <!-- ################ /ROW ################  -->
 
 </xsl:stylesheet>

+ 75 - 75
doc/stylesheets/dbschema/xsl/oracle.xsl

@@ -2,167 +2,167 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version='1.0'
                 xmlns:db="http://iptel.org/dbschema/oracle"
->
+				>
 
-    <xsl:import href="sql.xsl"/>
+  <xsl:import href="sql.xsl"/>
 
-    <xsl:template match="database" mode="drop">
+  <xsl:template match="database" mode="drop">
 	<xsl:apply-templates mode="drop"/>
-    </xsl:template>
-    
-    <xsl:template name="table.close">
+  </xsl:template>
+  
+  <xsl:template name="table.close">
 	<xsl:text>)</xsl:text>
 	<xsl:text>;&#x0A;&#x0A;</xsl:text>	
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.type">
+  <xsl:template name="column.type">
 	<xsl:variable name="type">
-	    <xsl:call-template name="get-type"/>
+	  <xsl:call-template name="get-type"/>
 	</xsl:variable>
 
 	<xsl:choose>
-	    <xsl:when test="db:type">
+	  <xsl:when test="db:type">
 		<xsl:value-of select="normalize-space(db:type)"/>
-	    </xsl:when>
-	    <xsl:when test="$type='char'">
+	  </xsl:when>
+	  <xsl:when test="$type='char'">
 		<xsl:text>TINYINT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='short'">
+	  </xsl:when>
+	  <xsl:when test="$type='short'">
 		<xsl:text>SMALLINT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='int'">
+	  </xsl:when>
+	  <xsl:when test="$type='int'">
 		<xsl:text>INT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='long'">
+	  </xsl:when>
+	  <xsl:when test="$type='long'">
 		<xsl:text>BIGINT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='datetime'">
+	  </xsl:when>
+	  <xsl:when test="$type='datetime'">
 		<xsl:text>DATETIME</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='double'">
+	  </xsl:when>
+	  <xsl:when test="$type='double'">
 		<xsl:text>DOUBLE</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='float'">
+	  </xsl:when>
+	  <xsl:when test="$type='float'">
 		<xsl:text>FLOAT</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='string'">
+	  </xsl:when>
+	  <xsl:when test="$type='string'">
 		<xsl:text>VARCHAR</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='binary'">
+	  </xsl:when>
+	  <xsl:when test="$type='binary'">
 		<xsl:text>BLOB</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:call-template name="type-error"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.trailing">
+  <xsl:template name="column.trailing">
 	<xsl:variable name="signed">
-	    <xsl:call-template name="get-sign"/>
+	  <xsl:call-template name="get-sign"/>
 	</xsl:variable>
 	
 	<xsl:if test="$signed = 0">
-	    <xsl:text> UNSIGNED</xsl:text>
+	  <xsl:text> UNSIGNED</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="index">
+  <xsl:template match="index">
 	<xsl:variable name="index.name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 
 	<xsl:if test="position()=1">
-	    <xsl:text>,&#x0A;</xsl:text>
+	  <xsl:text>,&#x0A;</xsl:text>
 	</xsl:if>
 	<xsl:text>    </xsl:text>
 	<xsl:if test="unique">
-	    <xsl:text>UNIQUE </xsl:text>
+	  <xsl:text>UNIQUE </xsl:text>
 	</xsl:if>
 	<xsl:text>KEY </xsl:text>
 	<xsl:if test="not($index.name='')">
-	    <xsl:value-of select="concat($index.name, ' ')"/>
+	  <xsl:value-of select="concat($index.name, ' ')"/>
 	</xsl:if>
 	<xsl:text>(</xsl:text>
 	<xsl:apply-templates select="colref"/>
 	<xsl:text>)</xsl:text>
 	<xsl:if test="not(position()=last())">
-	    <xsl:text>,</xsl:text>
-	    <xsl:text>&#x0A;</xsl:text>
+	  <xsl:text>,</xsl:text>
+	  <xsl:text>&#x0A;</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="get-userid">
+  <xsl:template name="get-userid">
 	<xsl:param name="select" select="."/>
 	<xsl:param name="host" select="/.."/>
 	<xsl:text>'</xsl:text>
 	<xsl:choose>
-	    <!-- override test -->
-	    <xsl:when test="count($select/db:username)='1'">
+	  <!-- override test -->
+	  <xsl:when test="count($select/db:username)='1'">
 		<xsl:value-of select="normalize-space($select/db:username)"/>
-	    </xsl:when>
-	    <!-- No override, use the standard name -->
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <!-- No override, use the standard name -->
+	  <xsl:otherwise>
 		<xsl:value-of select="normalize-space($select/username)"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
 	<xsl:text>'</xsl:text>
 
 	<xsl:text>@'</xsl:text>
 	<xsl:choose>
-	    <xsl:when test="count($host)='1'">
+	  <xsl:when test="count($host)='1'">
 		<xsl:value-of select="normalize-space($host)"/>
-	    </xsl:when>
-	    <xsl:when test="count(db:host)='1'">
+	  </xsl:when>
+	  <xsl:when test="count(db:host)='1'">
 		<xsl:value-of select="normalize-space(db:host)"/>
-	    </xsl:when>
-	    <xsl:when test="count(host)='1'">
+	  </xsl:when>
+	  <xsl:when test="count(host)='1'">
 		<xsl:value-of select="normalize-space(host)"/>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:text>%</xsl:text>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
 	<xsl:text>'</xsl:text>
-    </xsl:template>
+  </xsl:template>
 
-<!-- ################ ROW ################  -->
+  <!-- ################ ROW ################  -->
 
-    <!-- override common template for ROW. Create INSERT statements 
-         with IGNORE keyword
-      -->
-    <xsl:template match="row">
+  <!-- override common template for ROW. Create INSERT statements 
+       with IGNORE keyword
+    -->
+  <xsl:template match="row">
 	<xsl:if test="@vendor-controlled[1]">
-	    <xsl:text>DELETE FROM </xsl:text>	    
-	    <xsl:call-template name="get-name">
+	  <xsl:text>DELETE FROM </xsl:text>	    
+	  <xsl:call-template name="get-name">
 		<xsl:with-param name="select" select="parent::table"/>
-	    </xsl:call-template>
-	    <xsl:text> WHERE </xsl:text>	    
-	    <xsl:call-template name="row-identification"/>
-	    <xsl:text>;&#x0A;</xsl:text>	    
+	  </xsl:call-template>
+	  <xsl:text> WHERE </xsl:text>	    
+	  <xsl:call-template name="row-identification"/>
+	  <xsl:text>;&#x0A;</xsl:text>	    
 	</xsl:if>
 
 	<xsl:text>INSERT IGNORE INTO </xsl:text>
 	<xsl:call-template name="get-name">
-	    <xsl:with-param name="select" select="parent::table"/>
+	  <xsl:with-param name="select" select="parent::table"/>
 	</xsl:call-template>
 	<xsl:text> (</xsl:text>
 	<xsl:apply-templates select="value" mode="colname"/>
@@ -170,10 +170,10 @@
 	<xsl:apply-templates select="value"/>
 	<xsl:text>);&#x0A;</xsl:text>
 	<xsl:if test="position()=last()">
-	    <xsl:text>&#x0A;</xsl:text>	    
+	  <xsl:text>&#x0A;</xsl:text>	    
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-<!-- ################ /ROW ################  -->
+  <!-- ################ /ROW ################  -->
 
 </xsl:stylesheet>

+ 90 - 90
doc/stylesheets/dbschema/xsl/postgres.xsl

@@ -2,13 +2,13 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version='1.0'
                 xmlns:xi="http://www.w3.org/2001/XInclude"
->
+				>
 
-    <xsl:import href="sql.xsl"/>
+  <xsl:import href="sql.xsl"/>
 
-    <xsl:template match="database">
+  <xsl:template match="database">
 	<xsl:variable name="database.name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 	<!-- Create all tables -->
 	<xsl:apply-templates select="user"/>
@@ -16,76 +16,76 @@
 	<xsl:apply-templates select="table"/>
 	<xsl:text>&#x0A;</xsl:text>
 	<xsl:apply-templates select="user" mode="grant"/>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="database" mode="drop">
+  <xsl:template match="database" mode="drop">
 	<xsl:variable name="database.name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 	<xsl:apply-templates mode="drop"/>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.type">
+  <xsl:template name="column.type">
 	<xsl:variable name="type">
-	    <xsl:call-template name="get-type"/>
+	  <xsl:call-template name="get-type"/>
 	</xsl:variable>
 
 	<xsl:choose>
-	    <xsl:when test="type[@db=$db]">
+	  <xsl:when test="type[@db=$db]">
 		<xsl:value-of select="normalize-space(type[@db=$db])"/>
-	    </xsl:when>
-	    <xsl:when test="$type='char'">
+	  </xsl:when>
+	  <xsl:when test="$type='char'">
 		<xsl:text>SMALLINT</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="$type='short'">
+	  </xsl:when>
+	  <xsl:when test="$type='short'">
 		<xsl:text>SMALLINT</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="$type='int'">
+	  </xsl:when>
+	  <xsl:when test="$type='int'">
 		<xsl:text>INTEGER</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="$type='long'">
+	  </xsl:when>
+	  <xsl:when test="$type='long'">
 		<xsl:text>BIGINT</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="$type='datetime'">
+	  </xsl:when>
+	  <xsl:when test="$type='datetime'">
 		<xsl:text>TIMESTAMP</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="$type='double'">
+	  </xsl:when>
+	  <xsl:when test="$type='double'">
 		<xsl:text>DOUBLE PRECISION</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="$type='float'">
+	  </xsl:when>
+	  <xsl:when test="$type='float'">
 		<xsl:text>REAL</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='string'">
+	  </xsl:when>
+	  <xsl:when test="$type='string'">
 		<xsl:text>VARCHAR</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:when test="$type='binary'">
+	  </xsl:when>
+	  <xsl:when test="$type='binary'">
 		<xsl:text>BYTEA</xsl:text>
 		<xsl:call-template name="column.size"/>
 		<xsl:call-template name="column.trailing"/>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:call-template name="type-error"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.trailing">
+  <xsl:template name="column.trailing">
 	<xsl:variable name="column.type">
-	    <xsl:call-template name="get-type"/>
+	  <xsl:call-template name="get-type"/>
 	</xsl:variable>
 
 	<xsl:if test="$column.type='datetime'">
-	    <xsl:text> WITHOUT TIME ZONE</xsl:text>
+	  <xsl:text> WITHOUT TIME ZONE</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="table">
+  <xsl:template match="table">
 	<xsl:variable name="table.name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 
 	<!-- Create row in version table -->
@@ -106,46 +106,46 @@
 	<xsl:call-template name="table.close"/>
 
 	<xsl:for-each select="index[count(child::unique)=0]">
-	    <xsl:call-template name="create_index"/>
+	  <xsl:call-template name="create_index"/>
 	</xsl:for-each>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="index">
+  <xsl:template match="index">
 	<xsl:variable name="index.name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 
 	<xsl:if test="position()=1">
-	    <xsl:text>,&#x0A;</xsl:text>
+	  <xsl:text>,&#x0A;</xsl:text>
 	</xsl:if>
 	<xsl:text>    </xsl:text>
 	<xsl:if test="not($index.name='')">
-	    <xsl:text>CONSTRAINT </xsl:text>
-	    <xsl:value-of select="concat($index.name, ' ')"/>
+	  <xsl:text>CONSTRAINT </xsl:text>
+	  <xsl:value-of select="concat($index.name, ' ')"/>
 	</xsl:if>
 	<xsl:text>UNIQUE (</xsl:text>
 	<xsl:apply-templates select="colref"/>
 	<xsl:text>)</xsl:text>
 	
 	<xsl:if test="not(position()=last())">
-	    <xsl:text>,</xsl:text>
-	    <xsl:text>&#x0A;</xsl:text>
+	  <xsl:text>,</xsl:text>
+	  <xsl:text>&#x0A;</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="create_index">
+  <xsl:template name="create_index">
 	<xsl:variable name="index.name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 	<xsl:variable name="table.name">
-	    <xsl:call-template name="get-name">
+	  <xsl:call-template name="get-name">
 		<xsl:with-param name="select" select="parent::table"/>
-	    </xsl:call-template>
+	  </xsl:call-template>
 	</xsl:variable>
 
 	<xsl:text>CREATE </xsl:text>
 	<xsl:if test="unique">
-	    <xsl:text>UNIQUE </xsl:text>
+	  <xsl:text>UNIQUE </xsl:text>
 	</xsl:if>
 	<xsl:text>INDEX </xsl:text>
 	<xsl:value-of select="$index.name"/>
@@ -156,89 +156,89 @@
 	<xsl:text>);&#x0A;</xsl:text>
 
 	<xsl:if test="position()=last()">
-	    <xsl:text>&#x0A;</xsl:text>
+	  <xsl:text>&#x0A;</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="get-userid">
+  <xsl:template name="get-userid">
 	<xsl:param name="select" select="."/>
 	<xsl:choose>
-	    <!-- override test -->
-	    <xsl:when test="count($select/username[@db=$db])='1'">
+	  <!-- override test -->
+	  <xsl:when test="count($select/username[@db=$db])='1'">
 		<xsl:value-of select="normalize-space($select/username[@db=$db])"/>
-	    </xsl:when>
-	    <!-- No override, use the standard name -->
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <!-- No override, use the standard name -->
+	  <xsl:otherwise>
 		<xsl:value-of select="normalize-space($select/username)"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="get-privileges">
+  <xsl:template name="get-privileges">
 	<xsl:param name="select" select="."/>
 	<xsl:choose>
-	    <!-- override test -->
-	    <xsl:when test="count($select/privileges[@db=$db])='1'">
+	  <!-- override test -->
+	  <xsl:when test="count($select/privileges[@db=$db])='1'">
 		<xsl:value-of select="normalize-space($select/privileges[@db=$db])"/>
-	    </xsl:when>
-	    <!-- No override, use the standard name -->
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <!-- No override, use the standard name -->
+	  <xsl:otherwise>
 		<xsl:value-of select="normalize-space($select/privileges)"/>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
-    </xsl:template>
+  </xsl:template>
 
-    <!-- User management -->
+  <!-- User management -->
 
-    <xsl:template match="user">
+  <xsl:template match="user">
 	<xsl:variable name="database.name">
-	    <xsl:call-template name="get-name">
+	  <xsl:call-template name="get-name">
 		<xsl:with-param name="select" select="parent::database"/>
-	    </xsl:call-template>
+	  </xsl:call-template>
 	</xsl:variable>
 	
 	<xsl:text>CREATE USER </xsl:text>
 	<xsl:call-template name="get-userid"/>
 	<xsl:choose>
-	    <xsl:when test="count(password[@db=$db])='1'">
+	  <xsl:when test="count(password[@db=$db])='1'">
 		<xsl:text> PASSWORD '</xsl:text>
 		<xsl:value-of select="normalize-space(password[@db=$db])"/>
 		<xsl:text>'</xsl:text>
-	    </xsl:when>
-	    <xsl:when test="count(password)='1'">
+	  </xsl:when>
+	  <xsl:when test="count(password)='1'">
 		<xsl:text> PASSWORD '</xsl:text>
 		<xsl:value-of select="normalize-space(password)"/>
 		<xsl:text>'</xsl:text>
-	    </xsl:when>
+	  </xsl:when>
 	</xsl:choose>
 	<xsl:text>;&#x0A;</xsl:text>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="user" mode="drop">
+  <xsl:template match="user" mode="drop">
 	<xsl:variable name="database.name">
-	    <xsl:call-template name="get-name">
+	  <xsl:call-template name="get-name">
 		<xsl:with-param name="select" select="parent::database"/>
-	    </xsl:call-template>
+	  </xsl:call-template>
 	</xsl:variable>
 	
 	<xsl:text>DROP USER </xsl:text>
 	<xsl:call-template name="get-userid"/>
 	<xsl:text>;&#x0A;</xsl:text>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="user" mode="grant">
+  <xsl:template match="user" mode="grant">
 	<xsl:text>GRANT </xsl:text>
 	<xsl:call-template name="get-privileges"/>
 	<xsl:text> ON </xsl:text>
 	<xsl:for-each select="parent::database/table">
-	    <xsl:call-template name="get-name"/>
-	    <xsl:if test="not(position()=last())">
+	  <xsl:call-template name="get-name"/>
+	  <xsl:if test="not(position()=last())">
 		<xsl:text>,</xsl:text>
-	    </xsl:if>
+	  </xsl:if>
 	</xsl:for-each>
 	<xsl:text> TO </xsl:text>
 	<xsl:call-template name="get-userid"/>
 	<xsl:text>;&#x0A;</xsl:text>
-    </xsl:template>
+  </xsl:template>
 
 </xsl:stylesheet>

+ 154 - 154
doc/stylesheets/dbschema/xsl/sql.xsl

@@ -1,49 +1,49 @@
 <?xml version='1.0'?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version='1.0'
->
+				>
 
-    <xsl:import href="common.xsl"/>
+  <xsl:import href="common.xsl"/>
 
-    <xsl:template match="/">
+  <xsl:template match="/">
 	<xsl:variable name="createfile" select="concat($dir, concat('/', concat($prefix, 'create.sql')))"/>
 	<xsl:document href="{$createfile}" method="text" indent="no" omit-xml-declaration="yes">
-	    <xsl:apply-templates select="/database[1]"/>
-	    <!-- This is a hack to ensure that the file gets created when
-	    nothing is written
+	  <xsl:apply-templates select="/database[1]"/>
+	  <!-- This is a hack to ensure that the file gets created when
+	       nothing is written
 	    -->
-	    <xsl:text> </xsl:text>
+	  <xsl:text> </xsl:text>
 	</xsl:document>
 
 	<xsl:variable name="datafile" select="concat($dir, concat('/', concat($prefix, 'data.sql')))"/>
 	<xsl:document href="{$datafile}" method="text" indent="no" omit-xml-declaration="yes">
-	    <xsl:apply-templates mode="data" select="/database[1]"/>
-	    <!-- This is a hack to ensure that the file gets created when
-	    nothing is written
+	  <xsl:apply-templates mode="data" select="/database[1]"/>
+	  <!-- This is a hack to ensure that the file gets created when
+	       nothing is written
 	    -->
-	    <xsl:text> </xsl:text>
+	  <xsl:text> </xsl:text>
 	</xsl:document>
 
 	<xsl:variable name="dropfile" select="concat($dir, concat('/', concat($prefix, 'drop.sql')))"/>
 	<xsl:document href="{$dropfile}" method="text" indent="no" omit-xml-declaration="yes">
-	    <xsl:apply-templates mode="drop" select="/database[1]"/>
-	    <!-- This is a hack to ensure that the file gets created when
-	    nothing is written
+	  <xsl:apply-templates mode="drop" select="/database[1]"/>
+	  <!-- This is a hack to ensure that the file gets created when
+	       nothing is written
 	    -->
-	    <xsl:text> </xsl:text>
+	  <xsl:text> </xsl:text>
 	</xsl:document>
-    </xsl:template>
-    
-<!-- ################ DATABASE ################# -->
+  </xsl:template>
+  
+  <!-- ################ DATABASE ################# -->
 
-<!-- ################ /DATABASE ################# -->
+  <!-- ################ /DATABASE ################# -->
 
-    
-<!-- ################ TABLE  ################# -->
-    
-    <xsl:template match="table">
+  
+  <!-- ################ TABLE  ################# -->
+  
+  <xsl:template match="table">
 	<xsl:variable name="table.name">
-	    <xsl:call-template name="get-name"/>
+	  <xsl:call-template name="get-name"/>
 	</xsl:variable>
 
 	<!-- Create row in version table -->
@@ -62,33 +62,33 @@
 	<xsl:text>&#x0A;</xsl:text>
 
 	<xsl:call-template name="table.close"/>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="table" mode="data">
+  <xsl:template match="table" mode="data">
 	<!-- Process initial data --> 
 	<xsl:apply-templates select="row"/>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="table.close">
+  <xsl:template name="table.close">
 	<xsl:text>);&#x0A;&#x0A;</xsl:text>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="version">
+  <xsl:template match="version">
 	<xsl:text>INSERT INTO version (table_name, table_version) values ('</xsl:text>
 	<xsl:call-template name="get-name">
-	    <xsl:with-param name="select" select="parent::table"/>
+	  <xsl:with-param name="select" select="parent::table"/>
 	</xsl:call-template>
 	<xsl:text>','</xsl:text>
 	<xsl:value-of select="text()"/>
 	<xsl:text>');&#x0A;</xsl:text>
-    </xsl:template>
-    
-<!-- ################ /TABLE ################  -->
+  </xsl:template>
+  
+  <!-- ################ /TABLE ################  -->
 
 
-<!-- ################ COLUMN ################  -->
+  <!-- ################ COLUMN ################  -->
 
-    <xsl:template match="column">
+  <xsl:template match="column">
 	<xsl:text>    </xsl:text>
 	<xsl:call-template name="get-name"/>
 	<xsl:text> </xsl:text>
@@ -96,125 +96,125 @@
 	<xsl:call-template name="column.type"/>
 
 	<xsl:variable name="null">
-	    <xsl:call-template name="get-null"/>
+	  <xsl:call-template name="get-null"/>
 	</xsl:variable>
 	<xsl:if test="$null=0">
-	    <xsl:text> NOT NULL</xsl:text>
+	  <xsl:text> NOT NULL</xsl:text>
 	</xsl:if>
 
 	<xsl:choose>
-	    <xsl:when test="default[@db=$db]">
+	  <xsl:when test="default[@db=$db]">
 		<xsl:text> DEFAULT </xsl:text>
 		<xsl:choose>
-		    <xsl:when test="default[@db=$db]/null">
+		  <xsl:when test="default[@db=$db]/null">
 			<xsl:text>NULL</xsl:text>
-		    </xsl:when>
-		    <xsl:otherwise>
+		  </xsl:when>
+		  <xsl:otherwise>
 			<xsl:text>'</xsl:text>
 			<xsl:value-of select="default[@db=$db]"/>
 			<xsl:text>'</xsl:text>
-		    </xsl:otherwise>
+		  </xsl:otherwise>
 		</xsl:choose>
-	    </xsl:when>
-	    <xsl:when test="default">
+	  </xsl:when>
+	  <xsl:when test="default">
 		<xsl:text> DEFAULT </xsl:text>
 		<xsl:choose>
-		    <xsl:when test="default/null">
+		  <xsl:when test="default/null">
 			<xsl:text>NULL</xsl:text>
-		    </xsl:when>
-		    <xsl:otherwise>
+		  </xsl:when>
+		  <xsl:otherwise>
 			<xsl:text>'</xsl:text>
 			<xsl:value-of select="default"/>
 			<xsl:text>'</xsl:text>
-		    </xsl:otherwise>
+		  </xsl:otherwise>
 		</xsl:choose>
-	    </xsl:when>
+	  </xsl:when>
 	</xsl:choose>
 
 	<xsl:if test="not(position()=last())">
-	    <xsl:text>,</xsl:text>
-	    <xsl:text>&#x0A;</xsl:text>
+	  <xsl:text>,</xsl:text>
+	  <xsl:text>&#x0A;</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.type">
+  <xsl:template name="column.type">
 	<!-- FIXME -->
 	<xsl:call-template name="get-type"/>
 	<xsl:call-template name="column.size"/>
 	<xsl:call-template name="column.trailing"/>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.size">
+  <xsl:template name="column.size">
 	<xsl:variable name="size">
-	    <xsl:call-template name="get-size"/>
+	  <xsl:call-template name="get-size"/>
 	</xsl:variable>
 
 	<xsl:if test="not($size='')">
-	    <xsl:text>(</xsl:text>
-	    <xsl:value-of select="$size"/>
-	    <xsl:text>)</xsl:text>
+	  <xsl:text>(</xsl:text>
+	  <xsl:value-of select="$size"/>
+	  <xsl:text>)</xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="column.trailing"/>
+  <xsl:template name="column.trailing"/>
 
-<!-- ################ /COLUMN ################  -->
+  <!-- ################ /COLUMN ################  -->
 
-<!-- ################ INDEX ################  -->
+  <!-- ################ INDEX ################  -->
 
-    <xsl:template match="index">
+  <xsl:template match="index">
 	<!-- Translate unique indexes into SQL92 unique constraints -->
 	<xsl:if test="unique">
-	    <xsl:if test="position()=1">
+	  <xsl:if test="position()=1">
 		<xsl:text>,&#x0A;</xsl:text>
-	    </xsl:if>
-	    <xsl:text>    </xsl:text>
+	  </xsl:if>
+	  <xsl:text>    </xsl:text>
 
-	    <xsl:call-template name="get-name"/>
-	    <xsl:text> UNIQUE (</xsl:text>
+	  <xsl:call-template name="get-name"/>
+	  <xsl:text> UNIQUE (</xsl:text>
 
-	    <xsl:apply-templates match="colref"/>
+	  <xsl:apply-templates match="colref"/>
 
-	    <xsl:text>)</xsl:text>
+	  <xsl:text>)</xsl:text>
 
-	    <xsl:if test="not(position()=last())">
+	  <xsl:if test="not(position()=last())">
 		<xsl:text>,</xsl:text>
 		<xsl:text>&#x0A;</xsl:text>
-	    </xsl:if>
+	  </xsl:if>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-<!-- ################ /INDEX ################  -->
+  <!-- ################ /INDEX ################  -->
 
-<!-- ################ COLREF ################  -->
+  <!-- ################ COLREF ################  -->
 
-    <xsl:template match="colref">
+  <xsl:template match="colref">
 	<xsl:call-template name="get-column-name">
-	    <xsl:with-param name="select" select="@linkend"/>
+	  <xsl:with-param name="select" select="@linkend"/>
 	</xsl:call-template>
 	<xsl:if test="not(position()=last())">
-	    <xsl:text>, </xsl:text>
+	  <xsl:text>, </xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-<!-- ################ /COLREF ################  -->
+  <!-- ################ /COLREF ################  -->
 
-<!-- ################ ROW ################  -->
+  <!-- ################ ROW ################  -->
 
-    <xsl:template match="row">
+  <xsl:template match="row">
 	<xsl:if test="@vendor-controlled[1]">
-	    <xsl:text>DELETE FROM </xsl:text>	    
-	    <xsl:call-template name="get-name">
+	  <xsl:text>DELETE FROM </xsl:text>	    
+	  <xsl:call-template name="get-name">
 		<xsl:with-param name="select" select="parent::table"/>
-	    </xsl:call-template>
-	    <xsl:text> WHERE </xsl:text>	    
-	    <xsl:call-template name="row-identification"/>
-	    <xsl:text>;&#x0A;</xsl:text>	    
+	  </xsl:call-template>
+	  <xsl:text> WHERE </xsl:text>	    
+	  <xsl:call-template name="row-identification"/>
+	  <xsl:text>;&#x0A;</xsl:text>	    
 	</xsl:if>
 
 	<xsl:text>INSERT INTO </xsl:text>
 	<xsl:call-template name="get-name">
-	    <xsl:with-param name="select" select="parent::table"/>
+	  <xsl:with-param name="select" select="parent::table"/>
 	</xsl:call-template>
 	<xsl:text> (</xsl:text>
 	<xsl:apply-templates select="value" mode="colname"/>
@@ -222,98 +222,98 @@
 	<xsl:apply-imports/>
 	<xsl:text>);&#x0A;</xsl:text>
 	<xsl:if test="position()=last()">
-	    <xsl:text>&#x0A;</xsl:text>	    
+	  <xsl:text>&#x0A;</xsl:text>	    
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template name="row-identification">
+  <xsl:template name="row-identification">
 	<xsl:variable name="row-ident" select="parent::table/row-identificator"/>
 	<xsl:variable name="row" select="."/>
 	<xsl:variable name="columns" select="$row-ident/colref"/>
 
 
 	<xsl:choose>
-	    <xsl:when test="count($row-ident) = 0">
+	  <xsl:when test="count($row-ident) = 0">
 		<xsl:message terminate="yes">
-		    <xsl:text>ERROR: row-identificator does not exists.</xsl:text>
+		  <xsl:text>ERROR: row-identificator does not exists.</xsl:text>
 		</xsl:message>
-	    </xsl:when>
-	    <xsl:when test="count($columns) = 0">
+	  </xsl:when>
+	  <xsl:when test="count($columns) = 0">
 		<xsl:message terminate="yes">
-		    <xsl:text>ERROR: row-identificator does not have any column.</xsl:text>
+		  <xsl:text>ERROR: row-identificator does not have any column.</xsl:text>
 		</xsl:message>
-	    </xsl:when>
-	    <xsl:otherwise>
-
-
-	<xsl:for-each select="$columns">
-	    <xsl:variable name="col-id" select="@linkend"/>
-	    
-	    <!-- column name -->
-	    <xsl:call-template name="get-column-name">
-		<xsl:with-param name="select" select="$col-id"/>
-	    </xsl:call-template>
-
-	    <xsl:text>=</xsl:text>	    
-
-	    <!-- value of column -->
-	    <xsl:variable name="value" select="$row/value[@col=$col-id]"/>
-	    <xsl:choose>
-		<xsl:when test="count($value) = 0">
-		    <xsl:message terminate="yes">
-			<xsl:text>ERROR: Value of column with id '</xsl:text>
-			<xsl:value-of select="$col-id"/>
-			<xsl:text>' does not exist.</xsl:text>
-		    </xsl:message>
-		</xsl:when>
-		<xsl:otherwise>
-		    <xsl:text>'</xsl:text>
-		    <xsl:value-of select="$value"/>
-		    <xsl:text>'</xsl:text>
-		</xsl:otherwise>
-	    </xsl:choose>
-
-
-	    <xsl:if test="not(position()=last())">
-		<xsl:text> AND </xsl:text>
-	    </xsl:if>
-	</xsl:for-each>
-
-
-	    </xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
+
+
+		<xsl:for-each select="$columns">
+	      <xsl:variable name="col-id" select="@linkend"/>
+	      
+	      <!-- column name -->
+	      <xsl:call-template name="get-column-name">
+			<xsl:with-param name="select" select="$col-id"/>
+	      </xsl:call-template>
+
+	      <xsl:text>=</xsl:text>	    
+
+	      <!-- value of column -->
+	      <xsl:variable name="value" select="$row/value[@col=$col-id]"/>
+	      <xsl:choose>
+			<xsl:when test="count($value) = 0">
+		      <xsl:message terminate="yes">
+				<xsl:text>ERROR: Value of column with id '</xsl:text>
+				<xsl:value-of select="$col-id"/>
+				<xsl:text>' does not exist.</xsl:text>
+		      </xsl:message>
+			</xsl:when>
+			<xsl:otherwise>
+		      <xsl:text>'</xsl:text>
+		      <xsl:value-of select="$value"/>
+		      <xsl:text>'</xsl:text>
+			</xsl:otherwise>
+	      </xsl:choose>
+
+
+	      <xsl:if test="not(position()=last())">
+			<xsl:text> AND </xsl:text>
+	      </xsl:if>
+		</xsl:for-each>
+
+
+	  </xsl:otherwise>
 	</xsl:choose>
-    	
-    </xsl:template>
+    
+  </xsl:template>
 
-<!-- ################ /ROW ################  -->
+  <!-- ################ /ROW ################  -->
 
-<!-- ################ VALUE ################  -->
+  <!-- ################ VALUE ################  -->
 
-    <xsl:template match="value">
+  <xsl:template match="value">
 	<xsl:choose>
-	    <xsl:when test="null">
+	  <xsl:when test="null">
 		<xsl:text>NULL</xsl:text>
-	    </xsl:when>
-	    <xsl:otherwise>
+	  </xsl:when>
+	  <xsl:otherwise>
 		<xsl:text>'</xsl:text>
 		<xsl:value-of select="text()"/>
 		<xsl:text>'</xsl:text>
-	    </xsl:otherwise>
+	  </xsl:otherwise>
 	</xsl:choose>
 	<xsl:if test="not(position()=last())">
-	    <xsl:text>, </xsl:text>
+	  <xsl:text>, </xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-    <xsl:template match="value" mode="colname">
+  <xsl:template match="value" mode="colname">
 	<xsl:call-template name="get-column-name">
-	    <xsl:with-param name="select" select="@col"/>
+	  <xsl:with-param name="select" select="@col"/>
 	</xsl:call-template>
 	<xsl:if test="not(position()=last())">
-	    <xsl:text>, </xsl:text>
+	  <xsl:text>, </xsl:text>
 	</xsl:if>
-    </xsl:template>
+  </xsl:template>
 
-<!-- ################ /VALUE ################  -->
+  <!-- ################ /VALUE ################  -->
 
 </xsl:stylesheet>