Selaa lähdekoodia

+ fix teryt segfault

a.binder 8 vuotta sitten
vanhempi
commit
dadcf22cee

+ 349 - 59
SE/schema/default_db_xml_cache.public/build_object_install_se_ant_object.xsl

@@ -48,8 +48,8 @@
    
     
    
-    <xsl:template match="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd[xs:schema/@targetNamespace='https://biuro.biall-net.pl/wfs/default_db/table/ADMIN_USERS.xsd']" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external">
-        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external">
+    <xsl:template match="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external">
+<!-- FILTERING [xs:schema/@targetNamespace='https://biuro.biall-net.pl/wfs/default_db/table/ADMIN_USERS.xsd'] -->                        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external">
             <xsl:with-param name="system_cache__appinfo:document-uri-orig" select="@system_cache__appinfo:document-uri-orig"/>
         </xsl:apply-templates>
     </xsl:template>
@@ -83,7 +83,8 @@
             </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external>
         </xsl:variable>
         
-        <xsl:copy-of select="$system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external"/>
+<xsl:if test="$debug_level &gt; 3">                                <xsl:copy-of select="$system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external"/>
+        </xsl:if>
         <!--<xsl:for-each select="$system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external//system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables">
             
         </xsl:for-each>-->
@@ -95,17 +96,20 @@
              </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables>
         </xsl:variable>
         
+<xsl:if test="$debug_level &gt; 3">        
+        <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables___DEB>
+                <xsl:copy-of select="$system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables"/>
+<!-- /system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables[xs:complexType[@name='ADMIN_USERS' or @name='user']] -->        
         
-        <xsl:copy-of select="$system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables"/>
-        
-        
+</system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables___DEB>        
+        </xsl:if>
         
         <xsl:for-each-group select="$system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables/system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables/*"  group-by="@targetNamespace">
             <xsl:variable name="schema.prefix" select="@prefix"/>
             <xsl:variable name="schema.targetNamespace" select="@targetNamespace"/>
             <xsl:variable name="schema">
                 <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema">
-                    <!--<xsl:attribute name="namespace" select="system_cache__appinfo:object_install_se_ant_object.create_prefix($prefix,@generate_tables_from_external_root.path.last_token)"/>-->
+                                                            <!--<xsl:attribute name="namespace" select="system_cache__appinfo:object_install_se_ant_object.create_prefix($prefix,@generate_tables_from_external_root.path.last_token)"/>-->
                     <!--<xsl:attribute name="namespace_val" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace(@system_cache__appinfo:namespace_uri,@generate_tables_from_external_root.path.last_token)"/>-->
                     <!--<xsl:namespace name="{$schema.prefix}" select="$schema.targetNamespace"/>-->
                     
@@ -114,7 +118,9 @@
                         <xsl:namespace name="{@prefix}" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace_final(@targetNamespace)"/>
                     </xsl:for-each-group>
                     
-                    <xsl:namespace name="xs" select="'http://www.w3.org/2001/XMLSchema'"/><xsl:namespace name="{$schema.prefix}" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace_final($schema.targetNamespace)"/>
+                    <xsl:namespace name="xs" select="'http://www.w3.org/2001/XMLSchema'"/> <!-- todo to be generated automatically -->
+                    
+                    <xsl:namespace name="{$schema.prefix}" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace_final($schema.targetNamespace)"/>
                     
                     <xsl:namespace name="system_cache__appinfo" select="'http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd'"/>
                     <xsl:namespace name="p5Type" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
@@ -122,19 +128,28 @@
                         <!--<xsl:copy-of select="@*"/>-->
                         <xsl:apply-templates select="@*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables_schema"/>
                     <xsl:attribute name="system_cache__appinfo:document-uri-orig" select="$system_cache__appinfo:document-uri-orig"/>
-                    <xsl:attribute name="debig.106.count" select="count(current-group())"/><xsl:comment>#92 including</xsl:comment>
+                                                            <xsl:attribute name="debug.106.count" select="count(current-group())"/>
+                    <xsl:comment>#92 including</xsl:comment>
                     <!--<generate_tables_from_external_root.required_by.path_init>
                         <xsl:copy-of select=" current-group()/generate_tables_from_external_root.required_by.path_init/*" xpath-default-namespace=""/>
-                    </generate_tables_from_external_root.required_by.path_init>-->
+                    </generate_tables_from_external_root.required_by.path_init>-->-->-->
                     <xsl:for-each-group select="current-group()/generate_tables_from_external_root.required_by.path_init/*[@prefix and not(@prefix = current()/@prefix) ]" group-by="@targetNamespace" xpath-default-namespace="">
                         <xsl:element name="import" namespace="http://www.w3.org/2001/XMLSchema">
                             <xsl:attribute name="namespace" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace_final(@targetNamespace)"/>
                             <xsl:attribute name="schemaLocation" select="concat(@prefix,'.xsd')"/>
                         </xsl:element>
                     </xsl:for-each-group>
-                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external.import" select="$current.schema/*"/><xsl:comment>#81 now groping by type and @lat_token</xsl:comment>
-                    <xsl:for-each-group select="current-group()" group-by="concat(@targetNamespace,name())">
-                        <xsl:comment>#136 grouping schema elements count=<xsl:value-of select="count(current-group())"/></xsl:comment><xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_schema" select=".">
+                                                            <!--<xsl:for-each select="$current.schema//import[ contains(@namespace,$default_db_targetNamespace_detect_string)]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                        <xsl:copy-of select="."/>
+                    </xsl:for-each>-->
+                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external.import" select="$current.schema/*"/>
+                        
+                    
+                    
+                    <xsl:comment>#81 now groping by type and @lat_token</xsl:comment>
+                    <xsl:for-each-group select="current-group()" group-by="concat(@targetNamespace,name(),@name)">
+                        <xsl:comment>#136 grouping schema elements count=<xsl:value-of select="count(current-group())"/></xsl:comment>
+                        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_schema" select=".">
                             <xsl:with-param name="prefix" select="$prefix"/>
                             <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
                             <xsl:with-param name="prefix_root" select="$prefix"/>
@@ -146,17 +161,19 @@
             <xsl:copy-of select="$schema"/>
             <xsl:comment>#123 saving to <xsl:value-of select="concat($external_schema_table.path,'/',$system_cache__appinfo:document-uri-orig,'/',$schema.prefix,'.xsd')"/></xsl:comment>
             
-            
-            <xsl:message>#135 ant-object install - todo dependency, than install </xsl:message>
+<!--<xsl:result-document href="{ concat($external_schema_table.path,'/',$system_cache__appinfo:document-uri-orig,'/',$schema.prefix,'.xsd')}">
+                <xsl:copy-of select="$schema"/>
+            </xsl:result-document>-->            
+                                    <xsl:message>#135 ant-object install - todo dependency, than install </xsl:message>
             <xsl:for-each select="$schema/schema/element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                 <xsl:variable name="ant-obj-save-path" select="system_cache__appinfo:object_install_se_ant_object.save_to_ant-object-path($system_cache__appinfo:document-uri-orig,$schema.prefix,@name)"/>
-                <xsl:message >#138 $ant-obj-save-path element/@name=<xsl:value-of select="@name"/> <xsl:value-of select="$ant-obj-save-path"/></xsl:message>
+                <xsl:message >#138 $ant-obj-save-path element/@name=<xsl:value-of select="@name"/> <xsl:value-of select="$ant-obj-save-path"/> from $schema.prefix= <xsl:value-of select="$schema.prefix"/>; </xsl:message>
                 
                 <xsl:result-document href="{$ant-obj-save-path}">
                     <xsl:apply-templates select="../../."  mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.schema">
                         <xsl:with-param name="name" select="@name"/>
                     </xsl:apply-templates>
-                </xsl:result-document>
+                                                </xsl:result-document>
                 <xsl:result-document href="{system_cache__appinfo:object_install_se_ant_object.save_to_ant-object-path.build_xml( $system_cache__appinfo:document-uri-orig,$schema.prefix,@name)}">
                     <empty/>
                 </xsl:result-document>
@@ -172,47 +189,83 @@
         <xsl:element name="{name()}"  namespace="http://www.w3.org/2001/XMLSchema">
             <xsl:copy-of select="namespace::node()"/>
             <xsl:copy-of select="@*"/>
-            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element">
+            <!--<DEBUG_193_roots>
+                <xsl:copy-of select="."/>
+            </DEBUG_193_roots>-->
+            <xsl:for-each-group select="." group-by="concat(name(),@name,@namespace)">
+                <xsl:apply-templates  mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root" >
                 <xsl:with-param name="name" select="$name"/>
             </xsl:apply-templates>
-        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" select="*//system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root">
-                <xsl:with-param name="name" select="$name"/>
-            </xsl:apply-templates></xsl:element>
+        </xsl:for-each-group>
+            <!--<DEBUG_197_elems><xsl:copy-of select="*//system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root"/></DEBUG_197_elems>-->
+            <xsl:comment>#196 rest elements </xsl:comment>
+            <xsl:for-each-group select="*//system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root/*" group-by="concat(name(),@name)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+                <!--<DEBUG_200_elems><xsl:copy-of select="."/></DEBUG_200_elems>-->
+                <!--<DEB30>
+                    <xsl:attribute name="name" select="name()"/>
+                    <xsl:attribute name="namename" select="@name"/>
+                </DEB30>-->
+                <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" select="." >
+<!-- select="*//system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" -->                                                        <xsl:with-param name="name" select="$name"/>
+            </xsl:apply-templates>
+            </xsl:for-each-group>
+        </xsl:element>
     </xsl:template>
     
-    <xsl:template match="element[@name]" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
-        <xsl:param name="name" required="yes"/>
+    <xsl:template match="*|comment()|text()" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" />
+    
+    <xsl:template match="import" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="element[@name]" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+        <xsl:param name="name" required="yes" />
+        <!--<xsl:comment>#226 TODO for <xsl:value-of select="name()"/> / <xsl:value-of select="@name"/></xsl:comment>-->
         <xsl:choose>
             <xsl:when test="@name=$name">
+                <!--<xsl:copy-of select="."/>-->
                 <xsl:element name="{name()}">
                     <xsl:copy-of select="@*"/>
-            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child"/>
-                </xsl:element></xsl:when>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root.child"/>
+                </xsl:element>
+            </xsl:when>
         <xsl:otherwise>
                 <xsl:comment>#198 uwanted root name <xsl:value-of select="name()"/>;</xsl:comment>
                 <xsl:element name="{name()}">
                     <xsl:copy-of select="@*"/>
-                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child"/>
+                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root.child"/>
                 </xsl:element>
-            </xsl:otherwise></xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
     </xsl:template>
     
-    <xsl:template match="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" /><xsl:template match="complexType|simpleType|import" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+    <xsl:template match="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" />
+    <xsl:template match="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" />
+    <xsl:template match="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" />
+    
+    <xsl:template match="complexType|simpleType|import" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
         <xsl:element name="{name()}">
             <xsl:copy-of select="@*"/>
     <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child"/>
-        </xsl:element></xsl:template>
+        </xsl:element>
+    </xsl:template>
     
-    <!--<xsl:template match="schema[ not(@targetNamespace = 'external_schema__ksiegi_wieczyste__zsin_1013.xsd')]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
-        <xsl:comment>#67 temporary bypased : <xsl:value-of select="@targetNamespace"/> ;  to analyze one schema scenario!</xsl:comment>
-    </xsl:template>-->
+    <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
             
+<xsl:comment>    
+<xsl:value-of select="name()"/>    <xsl:value-of select="@name"/></xsl:comment>
     
-    <!-- EOF XXXXXX MAIN XXXX MAIN XXXX -->
+</xsl:template>    
     
+    <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >                         <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.root.child"/>
+        </xsl:element>
+    </xsl:template>
     
-    <!-- (((( SCHEMA PARSERS PREFIX NAMESPACES ))) -->
-         <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+    <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
                 <xsl:element name="{name()}">
                     <xsl:copy-of select="@*"/>
                     <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child"/>
@@ -221,7 +274,21 @@
     
     <xsl:template match="simpleSchema" mode="system_cache__appinfo:object_install_se_ant_object.ant-object.unique_element.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
         <xsl:message terminate="yes"> #232 unanteded - todo upgrade for element <xsl:value-of select="name()"/> / @name <xsl:value-of select="@name"/> ; @id = <xsl:value-of select="@id"/></xsl:message>
-    </xsl:template><xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_schema">
+    </xsl:template>
+    
+    
+        
+    
+    <!--<xsl:template match="schema[ not(@targetNamespace = 'external_schema__ksiegi_wieczyste__zsin_1013.xsd')]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:comment>#67 temporary bypased : <xsl:value-of select="@targetNamespace"/> ;  to analyze one schema scenario!</xsl:comment>
+    </xsl:template>-->
+            
+    
+    <!-- EOF XXXXXX MAIN XXXX MAIN XXXX -->
+    
+    
+    <!-- (((( SCHEMA PARSERS PREFIX NAMESPACES ))) -->
+         <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_schema">
              <xsl:param name="targetNamespace" required="yes"/>
              <xsl:param name="prefix" required="yes"/>
              <xsl:param name="prefix_root"  required="yes"/>
@@ -283,7 +350,7 @@
         <xsl:param name="targetNamespace" required="yes"/>
         <xsl:param name="prefix_root"  required="yes"/>
         <xsl:param name="targetNamespace_root" required="yes"/>
-        <xsl:variable name="element" select="@name"/>
+                        <xsl:variable name="element" select="@name"/>
         <xsl:variable name="element-filename" >
             <xsl:choose>
                 <xsl:when test="$prefix">
@@ -323,7 +390,7 @@
             <xsl:element name="{name()}">
                 <xsl:copy-of select="@*"/>
                      <xsl:variable name="build_element_cache">
-                         <xsl:call-template name="system_cache__appinfo:build_element">
+                         <xsl:call-template name="system_cache__appinfo:build_element_cache">
                              <xsl:with-param name="element" select="@name"/>
                              <xsl:with-param name="prefix" select="$prefix"/>
                              <xsl:with-param name="namespace_uri_param" select="$targetNamespace"/>
@@ -334,6 +401,7 @@
                      </cache>
                      <xsl:variable name="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root">
                          <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+                             <!--<xsl:attribute name="debug.317" select="'come from there'"/>-->
                              <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" select="$build_element_cache">
                                  <xsl:with-param name="prefix" select="$prefix"/>
                                  <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
@@ -359,7 +427,7 @@
         <xsl:param name="targetNamespace" required="yes"/>
         <xsl:param name="prefix_root"  required="yes"/>
         <xsl:param name="targetNamespace_root" required="yes"/>
-        <xsl:variable name="element" select="@name"/>
+                        <xsl:variable name="element" select="@name"/>
         <xsl:variable name="element-filename" >
             <xsl:choose>
                 <xsl:when test="$prefix">
@@ -397,7 +465,7 @@
             </prefixed_object_info>
             </xsl:if>
             <xsl:variable name="build_element_cache">
-                <xsl:call-template name="system_cache__appinfo:build_complexType">
+                <xsl:call-template name="system_cache__appinfo:build_complexType_cache">
                     <xsl:with-param name="complexType" select="@name"/>
                     <xsl:with-param name="prefix" select="$prefix"/>
                     <xsl:with-param name="namespace_uri_param" select="$targetNamespace"/>
@@ -432,10 +500,62 @@
         
     
     
+<!--<xsl:template match="element|complexType[ not(complexType) and contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+            <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
+            <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+            <xsl:attribute name="prefix" select="$prefix"/>
+            <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+            <xsl:attribute name="debug.427">#427 root element/complexType of $default_db_targetNamespace_detect_string(<xsl:value-of select="$default_db_targetNamespace_detect_string"/>) - we just copying without testing models in this @targetNamespace - To Be modified @2017-10-23</xsl:attribute>
+            <xsl:comment>#427 root element/complexType of $default_db_targetNamespace_detect_string(<xsl:value-of select="$default_db_targetNamespace_detect_string"/>) - we just copying without testing models in this @targetNamespace - To Be modified @2017-10-23</xsl:comment>
+            <xsl:copy-of select="."/>
+        </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+    </xsl:template>-->    
     
     
+<!-- raczej todo - ze jeszcze pochodza z katalogu table -->            <xsl:template match="complexType[ complexType and contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="system_cache__appinfo:object_install_se_ant_object.root_complextype( current(),@name)"/>
+<!-- sciezka powinna byc w child od default_db.ADMIN_USERS.user -->                        <xsl:param name="generate_tables_from_external_root.path" select="system_cache__appinfo:object_install_se_ant_object.root_complextype( current(),@name)"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        
+<system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+            <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
+            <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+            <xsl:attribute name="prefix" select="$prefix"/>
+            <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.427B">#427B root element/complexType of $default_db_targetNamespace_detect_string(<xsl:value-of select="$default_db_targetNamespace_detect_string"/>) - this is not root complexType but some @type - example @name=user is complexContent/extension/@base= default_db__x3A__ADMIN_USERS:ADMIN_USERS</xsl:attribute></xsl:if>
+            <xsl:comment>#427 root element/complexType of $default_db_targetNamespace_detect_string(<xsl:value-of select="$default_db_targetNamespace_detect_string"/>) - we just copying without testing models in this @targetNamespace - To Be modified @2017-10-23</xsl:comment>
+            <!--<xsl:copy-of select="."/>-->
+            <xsl:element name="complexType" namespace="http://www.w3.org/2001/XMLSchema">
+                <xs:complexType name="{@name}">
+                    <xs:complexContent>
+                        <xs:extension >
+                            <xsl:attribute name="base" select="concat(@system_cache__appinfo:prefix,':',complexType/@name)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                        </xs:extension>
+                    </xs:complexContent>
+                </xs:complexType>
+            </xsl:element>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" >
+                <xsl:with-param name="prefix" select="$prefix"/>
+                <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+                <xsl:with-param name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/> <!-- sciezka powinna byc w child od default_db.ADMIN_USERS.user -->
+                <xsl:with-param name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+            </xsl:apply-templates>
+        </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+    </xsl:template>
     
-    <xsl:template match="element|complexType[contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    <xsl:template match="element[not(@type) and contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
         <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
         <xsl:param name="targetNamespace" required="yes"/>
@@ -443,16 +563,31 @@
         <xsl:param name="prefix_root"  required="yes"/>
         <xsl:param name="targetNamespace_root" required="yes"/>
         
-        
+        <xsl:variable name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace($targetNamespace,@name)"/>
+        <xsl:variable name="prefix" select="system_cache__appinfo:object_install_se_ant_object.create_prefix($prefix,@name)"/>
         <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
             <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
             <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
             <xsl:attribute name="prefix" select="$prefix"/>
             <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
-            <xsl:comment>#427 root element/complexType of $default_db_targetNamespace_detect_string(<xsl:value-of select="$default_db_targetNamespace_detect_string"/>) - we just copying without testing models in this @targetNamespace - To Be modified @2017-10-23</xsl:comment>
-            <xsl:copy-of select="."/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.135">#135BB root element without @type - ...force_refered_complexType (add path) </xsl:attribute></xsl:if>
+            <xsl:comment>#135BB root element without @type - ...force_refered_complexType (add path) </xsl:comment>
+            <xsl:element name="{name()}">
+                <xsl:copy-of select="@*"/>
+        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root">
+                    <xsl:with-param name="name" select="@name"/>
+                    <xsl:with-param name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+                    <xsl:with-param name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
+                    <xsl:with-param name="prefix" select="$prefix"/>
+                    <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                    <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                    <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+                </xsl:apply-templates>
+            </xsl:element>
         </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
-    </xsl:template><xsl:template match="element" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    </xsl:template>
+    
+    <xsl:template match="element" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
         <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
         <xsl:param name="targetNamespace" required="yes"/>
@@ -467,6 +602,7 @@
             <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
             <xsl:attribute name="prefix" select="$prefix"/>
             <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.135">#135 root element without @type - ...force_refered_complexType (add path) </xsl:attribute></xsl:if>
             <xsl:comment>#135 root element without @type - ...force_refered_complexType (add path) </xsl:comment>
             <xsl:element name="{name()}">
                 <xsl:apply-templates select="@*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root_element_force_type">
@@ -503,6 +639,7 @@
             <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
             <xsl:attribute name="prefix" select="$prefix"/>
             <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.374">#374 root CT without @type - ? maybe force element? or should be forced from another leafes? </xsl:attribute></xsl:if>
             <xsl:comment>#374 root CT without @type - ? maybe force element? or should be forced from another leafes? </xsl:comment>
             <xsl:element name="{name()}">
                 <xsl:copy-of select="@*"/>
@@ -518,7 +655,44 @@
     </xsl:template>
     
     
+<xsl:template match="complexType [ not(complexType) and contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">    
     
+<xsl:param name="generate_tables_from_external_root.name" select="@name"/>                    <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        
+        <!--<xsl:variable name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace($targetNamespace,@name)"/>-->
+        <!--<xsl:variable name="prefix" select="system_cache__appinfo:object_install_se_ant_object.create_prefix($prefix,@name)"/>-->
+        <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+            <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
+            <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+            <xsl:attribute name="prefix" select="$prefix"/>
+            <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.374BB">#374BB root CT without @type - ? maybe force element? or should be forced from another leafes? </xsl:attribute></xsl:if>
+            <xsl:comment>#374BB root CT without @type - ? maybe force element? or should be forced from another leafes? </xsl:comment>
+            <xsl:element name="{name()}">
+                <xsl:copy-of select="@*"/>
+                <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child">
+                    <xsl:with-param name="generate_tables_from_external_root.path" select="concat($generate_tables_from_external_root.path,'/',$generate_tables_from_external_root.name)"/>
+                    <xsl:with-param name="prefix" select="$prefix"/>
+                    <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                    <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                    <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+                </xsl:apply-templates>
+            </xsl:element>
+        </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+    </xsl:template>
+    
+    <xsl:template match="restriction" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.enumerations" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+    
+    <xsl:template match="*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.enumerations" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <!--<xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.enumerations"/>-->
+        </xsl:element>
+    </xsl:template>
     
     <xsl:template match="element" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
@@ -534,7 +708,7 @@
             <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
             <xsl:attribute name="prefix" select="$prefix"/>
             <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
-            <xsl:attribute name="debug_372_root_CT" select="system_cache__appinfo:object_install_se_ant_object.root_complextype( complexType,@name)"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug_372_root_CT" select="system_cache__appinfo:object_install_se_ant_object.root_complextype( complexType,@name)"/></xsl:if>
             <xsl:comment>#344A  TODO  fi create ? root_child element without @type - ...force_refered_complexType (not add path) </xsl:comment>
             <xsl:element name="{name()}">
                 <xsl:apply-templates select="@*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root_element_force_type">
@@ -612,6 +786,7 @@
             
             <xsl:attribute name="prefix" select="$prefix"/>
             <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.259">#259 root complexType with complexContent/extension/@base = complexType/@name - native element - to be detected last derivation</xsl:attribute></xsl:if>
             <xsl:comment>#259 root complexType with complexContent/extension/@base = complexType/@name - native element - to be detected last derivation</xsl:comment>
             <xsl:element name="{name()}">
                 <xsl:copy-of select="@*"/>
@@ -677,7 +852,7 @@
         
     </xsl:template>
     
-    <xsl:template match="element[@type]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    <xsl:template match="element[@type and not(contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string))]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="generate_tables_from_external_root.name" select="@type"/>
         <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
         <xsl:param name="targetNamespace" required="yes"/>
@@ -690,7 +865,45 @@
             <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
             <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
             <xsl:attribute name="prefix" select="$prefix"/>
-            <xsl:attribute name="targetNamespace" select="$targetNamespace"/><xsl:element name="{name()}">
+            <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.749">#749 element[@type]</xsl:attribute></xsl:if>
+            <xsl:element name="{name()}">
+                <!--<xsl:copy-of select="@*"/>-->
+                <xsl:apply-templates select="@*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root_element_force_type_element">
+                    <xsl:with-param name="generate_tables_from_external_root.path" select="concat($generate_tables_from_external_root.path,'/',$generate_tables_from_external_root.name)"/>
+                    <xsl:with-param name="prefix" select="$prefix"/>
+                    <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                    <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                    <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+                </xsl:apply-templates>
+                <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+                <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child">
+                    <xsl:with-param name="generate_tables_from_external_root.path" select="concat($generate_tables_from_external_root.path,'/',$generate_tables_from_external_root.name)"/>
+                    <xsl:with-param name="prefix" select="$prefix"/>
+                    <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                    <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                    <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+                </xsl:apply-templates>
+            </xsl:element>
+        </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+    </xsl:template>
+    
+            <xsl:template match="element[@type and contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@type"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <!--<xsl:variable name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace($targetNamespace,@name)"/>-->
+        <!--<xsl:variable name="prefix" select="system_cache__appinfo:object_install_se_ant_object.create_prefix($prefix,@name)"/>-->
+        <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+            <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
+            <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+            <xsl:attribute name="prefix" select="$prefix"/>
+            <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.749B">#749B element[@type] for ADMIN_USERS/user - in table flat prepared schema not to derive</xsl:attribute></xsl:if>
+            <xsl:element name="{name()}">
                 <!--<xsl:copy-of select="@*"/>-->
                 <xsl:apply-templates select="@*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root_element_force_type_element">
                     <xsl:with-param name="generate_tables_from_external_root.path" select="concat($generate_tables_from_external_root.path,'/',$generate_tables_from_external_root.name)"/>
@@ -744,6 +957,7 @@
         <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
             <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
             <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.319">#319 complextype std from child</xsl:attribute></xsl:if>
             <xsl:comment>#319 complextype std from child</xsl:comment>
             <xsl:element name="{name()}">
                 <xsl:copy-of select="@*"/>
@@ -758,6 +972,37 @@
         </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
     </xsl:template>
     
+    <xsl:template match="complexType[ complexType and contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@type"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@type"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+            <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
+            <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug.319C">#319C complextype std from child for defaultdb pref</xsl:attribute></xsl:if>
+            <xsl:comment>#319C complextype std from child for defaultdb pref</xsl:comment>
+            <xsl:element name="{name()}">
+                <xsl:copy-of select="@*"/>
+                        <xs:complexContent>
+                            <xs:extension >
+                                <xsl:attribute name="base" select="concat(@system_cache__appinfo:prefix,':',complexType/@name)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                            </xs:extension>
+                        </xs:complexContent>
+            </xsl:element>
+            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child">
+                <xsl:with-param name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/> <!-- $generate_tables_from_external_root.name -->
+                <xsl:with-param name="prefix" select="$prefix"/>
+                <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+            </xsl:apply-templates>
+        </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+    </xsl:template>
+    
+    
     <xsl:template match="sequence" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="generate_tables_from_external_root.path" required="yes"/>
         <xsl:param name="targetNamespace" required="yes"/>
@@ -787,7 +1032,7 @@
             <xsl:element name="{name()}">
                 <xsl:choose>
                     <xsl:when test="system_cache__appinfo:object_install_se_ant_object.root_complextype( current(),@ref)"><!-- jest ref do czegos co ma CT -->
-                        <xsl:attribute name="debug_587_root_complextype" select="system_cache__appinfo:object_install_se_ant_object.root_complextype( current(),@ref)"/>
+                        <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug_587_root_complextype" select="system_cache__appinfo:object_install_se_ant_object.root_complextype( current(),@ref)"/></xsl:if>
                         <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_ref_to_root" select="@*">
                             <xsl:with-param name="prefix" select="system_cache__appinfo:object_install_se_ant_object.create_prefix($prefix_root, system_cache__appinfo:object_install_se_ant_object.root_complextype(element,@ref))"/>
                             <xsl:with-param name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace($targetNamespace, system_cache__appinfo:object_install_se_ant_object.root_complextype(element,@ref))"/>
@@ -829,7 +1074,9 @@
     
     <xsl:template match="documentation" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:copy-of select="."/>
-    </xsl:template><xsl:template match="annotation|appinfo" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    </xsl:template>
+    
+    <xsl:template match="annotation|appinfo" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="targetNamespace" required="yes"/>
         <xsl:param name="prefix" required="yes"/>
         <xsl:param name="prefix_root"  required="yes"/>
@@ -912,7 +1159,7 @@
                 <xsl:attribute name="debug" select="'#320A  element[@name and complexType and not(@type)] system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child'"/>
             </generate_tables_from_external_root.required_by.path_init>
             <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
-                <xsl:attribute name="debug_579_root_complextype" select="system_cache__appinfo:object_install_se_ant_object.root_complextype( complexType,@name)"/>
+                <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="debug_579_root_complextype" select="system_cache__appinfo:object_install_se_ant_object.root_complextype( complexType,@name)"/></xsl:if>
                 <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
                 <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path_new"/>
                 <xsl:attribute name="generate_tables_from_external_root.required_by.path" select="$generate_tables_from_external_root.path"/>
@@ -988,7 +1235,8 @@
         </xsl:element>
     </xsl:template>
     
-    <xsl:template match="element[@type and not(complexType) ]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        
+        <xsl:template match="element[@type and not(complexType) ]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="generate_tables_from_external_root.name" select="@type"/>
         <xsl:param name="generate_tables_from_external_root.path" select="@type"/>
         <xsl:param name="targetNamespace" required="yes"/>
@@ -1024,7 +1272,8 @@
                                 <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
                             </xsl:apply-templates>
                         </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
-                    </xsl:when><xsl:otherwise>
+                    </xsl:when>
+                    <xsl:otherwise>
                         <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type" select="@*">
                             <xsl:with-param name="prefix" select="$prefix"/>
                             <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
@@ -1071,7 +1320,40 @@
         <xsl:attribute name="type" select="concat($prefix,':',system_cache__appinfo:clean_object_prefix(current()))"/>
     </xsl:template>
     
-    <xsl:template match="simpleType" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    <xsl:template match="simpleType[ restriction and restriction[not(@base='xs:anyAtomicType')] and contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string)]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
+        <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
+        <xsl:param name="targetNamespace" required="yes"/>
+        <xsl:param name="prefix" required="yes"/>
+        <xsl:param name="prefix_root"  required="yes"/>
+        <xsl:param name="targetNamespace_root" required="yes"/>
+        <xsl:variable name="generate_tables_from_external_root.path_new" select="@name"/>
+        <xsl:element name="{name()}" namespace="http://www.w3.org/2001/XMLSchema">
+            <xsl:copy-of select="@*"/>
+            <xsl:element name="xs:restriction" namespace="http://www.w3.org/2001/XMLSchema">
+                <!--<xsl:copy-of select="@*"/>-->
+                <xsl:attribute name="base" select="restriction/@base" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                <xsl:if test="$debug_level = 0"><xsl:attribute name="system_cache__appinfo:debug1318A">#1318A from simpleType</xsl:attribute></xsl:if>
+                <xsl:apply-templates select="restriction/*" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child.enumerations" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+            </xsl:element>
+            <xsl:if test="$debug_level = 0"><xsl:attribute name="system_cache__appinfo:debug1318">#1318 from simpleType</xsl:attribute></xsl:if>
+            
+            <system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+                <xsl:attribute name="generate_tables_from_external_root.name" select="$generate_tables_from_external_root.name"/>
+                <xsl:attribute name="generate_tables_from_external_root.path" select="$generate_tables_from_external_root.path"/>
+                <xsl:attribute name="prefix" select="$prefix"/>
+                <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
+                <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child">
+                    <xsl:with-param name="prefix" select="$prefix"/>
+                    <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
+                    <xsl:with-param name="prefix_root" select="$prefix_root"/>
+                    <xsl:with-param name="targetNamespace_root" select="$targetNamespace_root"/>
+                </xsl:apply-templates>
+            </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="simpleType[not(contains(@system_cache__appinfo:namespace_uri,$default_db_targetNamespace_detect_string))]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="generate_tables_from_external_root.name" select="@name"/>
         <xsl:param name="generate_tables_from_external_root.path" select="@name"/>
         <xsl:param name="targetNamespace" required="yes"/>
@@ -1081,8 +1363,8 @@
         <xsl:variable name="generate_tables_from_external_root.path_new" select="@name"/>
         <xsl:element name="{name()}">
             <xsl:copy-of select="@*"/>
-            <xsl:attribute name="system_cache__appinfo:debug">#1069 from simpleType</xsl:attribute>
-            <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child">
+            <xsl:if test="$debug_level &gt; 4"><xsl:attribute name="system_cache__appinfo:debug">#1069 from simpleType</xsl:attribute></xsl:if>
+                                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child">
                 <xsl:with-param name="prefix" select="$prefix"/>
                 <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
                 <xsl:with-param name="prefix_root" select="$prefix_root"/>
@@ -1173,7 +1455,9 @@
             <xsl:attribute name="system_cache__appinfo:debug">#1069 from simpleType</xsl:attribute>
             <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_type.simpleType.child"/>
         </xsl:element>-->
-    </xsl:template><xsl:template match="annotation" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_force_refered_complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    </xsl:template>
+    
+    <xsl:template match="annotation" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_force_refered_complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:comment>suppressed annotation <xsl:copy-of select=".//text()"/></xsl:comment>
     </xsl:template>
     
@@ -1405,6 +1689,9 @@
                     <!--<xsl:attribute name="generate_tables_from_external_root.path.last" select="tokenize(.././@generate_tables_from_external_root.path,'/')[ count(tokenize(../@generate_tables_from_external_root.path,'/'))]"/>-->
                 </xsl:when>
             </xsl:choose>
+            <!--<debug1233>
+                <xsl:copy-of select="."/>
+            </debug1233>-->
             <xsl:choose>
                 <xsl:when test="$generate_tables_from_external_root.required_by.path_init">
                     <generate_tables_from_external_root.required_by.path_init>
@@ -1423,7 +1710,8 @@
                             ------
                                 <xsl:copy-of select="@*"/>
                                             </xsl:comment>
-                </xsl:otherwise></xsl:choose>
+                </xsl:otherwise>
+            </xsl:choose>
             <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_mktables"/>
         </xsl:element>
     </xsl:template>
@@ -1597,7 +1885,9 @@
     <xsl:template match="import[ not(contains(@namespace,$default_db_targetNamespace_detect_string))]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external.import" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:message>#1646 ignored <xsl:copy-of select="@namespace"/>; not matched = <xsl:value-of select="$default_db_targetNamespace_detect_string"/></xsl:message>
         <xsl:comment>#1646 ignored <xsl:copy-of select="@namespace"/>; not matched = <xsl:value-of select="$default_db_targetNamespace_detect_string"/></xsl:comment>
-    </xsl:template><xsl:template match="*|text()|comment()" mode="system_cache__appinfo:object_install_se_ant_object.root_complextype" />
+    </xsl:template>
+    
+    <xsl:template match="*|text()|comment()" mode="system_cache__appinfo:object_install_se_ant_object.root_complextype" />
         
     
     

+ 3 - 1
SE/schema/default_db_xml_cache.public/system_cache__appinfo/external_schema_targetNamespace.xsl

@@ -66,13 +66,15 @@
     <xsl:function name="system_cache__appinfo:object_install_se_ant_object.save_to_ant-object-path">
         <xsl:param name="system_cache__appinfo:document-uri-orig"/> <!-- for use in schema -->
         <xsl:param name="schema.prefix"/>
-        <xsl:param name="name" /><!-- element name  -->
+        <!--<xsl:param name="root_complextype" />--><!-- element name  -->
+        <xsl:param name="name" />
         <xsl:value-of select="concat($external_schema_table.path,'/',$system_cache__appinfo:document-uri-orig,'/','ant-object','/',replace($schema.prefix,'__x3A__','.'),'/',$name,'/',$name,'.xsd')"/>
     </xsl:function>
     
     <xsl:function name="system_cache__appinfo:object_install_se_ant_object.save_to_ant-object-path.build_xml">
         <xsl:param name="system_cache__appinfo:document-uri-orig"/> <!-- for use in schema -->
         <xsl:param name="schema.prefix"/>
+        <!--<xsl:param name="root_complextype" />-->
         <xsl:param name="name" /><!-- element name  -->
         <xsl:value-of select="concat($external_schema_table.path,'/',$system_cache__appinfo:document-uri-orig,'/','ant-object','/',replace($schema.prefix,'__x3A__','.'),'/',$name,'/build.xml')"/>
     </xsl:function>

+ 4 - 3
SE/se-lib/Teryt.php

@@ -11,9 +11,10 @@ class Teryt {
 		if ($args == null) throw new Exception("Missing argument");
 		if (!is_array($args)) throw new Exception("Armument must be an array");
 		if (!count($args)) throw new Exception("Argument list cannot be empty");
-		foreach ($args as $arg => $value) {
-			if (!in_array($arg, $argsAvailable)) throw new Exception("Unknown argument {$arg}");
-		}
+		if(isset($args))
+			foreach ($args as $arg => $value) {
+				if (!in_array($arg, $argsAvailable)) throw new Exception("Unknown argument {$arg}");
+			}
 	}
 
 	private static function throwException($msg, $sql) {