Преглед на файлове

merged options from schema

a.binder преди 8 години
родител
ревизия
8b1bcd6208
променени са 23 файла, в които са добавени 1683 реда и са изтрити 208 реда
  1. 12 3
      SE/schema/WPS_Functions/build_WPS_Functions.xml
  2. 25 3
      SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/build_CRM_PROCES_tree.xml
  3. 85 0
      SE/schema/WPS_Functions/get_wfs/build_get_wfs.xml
  4. 70 4
      SE/schema/WPS_Functions/get_wfs_recurse_xsl/build_get_wfs_recurse_xsl.xml
  5. 1 0
      SE/schema/WPS_Functions/object_install_se_ant_object/build_object_install_se_ant_object.xml
  6. 69 7
      SE/schema/WPS_Functions/object_install_se_ant_object/build_object_install_se_ant_object.xsl
  7. 19 7
      SE/schema/WPS_Functions/object_modeling/build_object_modeling.xml
  8. 90 10
      SE/schema/WPS_Functions/object_modeling_build_infrastructure/build_object_modeling_build_infrastructure.xml
  9. 37 7
      SE/schema/WPS_Functions/object_modeling_build_infrastructure/object_modeling_build_infrastructure.xsl
  10. 1 0
      SE/schema/WPS_Functions/object_modeling_by_default_db_xml_schema/build_object_modeling_by_default_db_xml_schema.xml
  11. 179 0
      SE/schema/WPS_Functions/object_modeling_new/build_object_modeling_new.child.xsl
  12. 301 16
      SE/schema/WPS_Functions/object_modeling_new/build_object_modeling_new.xml
  13. 4 9
      SE/schema/WPS_Functions/stock_optimize_calculations_raszczyk/build_stock_optimize_calculations_raszczyk.xml
  14. 350 74
      SE/schema/WPS_Functions/stock_optimize_calculations_raszczyk/stock_optimize_calculations_raszczyk.xsl
  15. 45 6
      SE/schema/default_db_xml_cache.public/build_ant_universal_by_xsl_match.xsl
  16. 1 1
      SE/schema/default_db_xml_cache.public/build_object_install_se_ant_object.xsl
  17. 73 14
      SE/schema/default_db_xml_cache.public/get_all_xsd.xsl
  18. 1 0
      SE/schema/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl
  19. 38 12
      SE/schema/default_db_xml_cache.public/main_build_recurse_ant.dita_with_id.xsl
  20. 222 22
      SE/schema/default_db_xml_cache.public/object_modeling.xsl
  21. 27 6
      SE/schema/default_db_xml_cache.public/object_modeling_new.xsl
  22. 26 5
      SE/schema/default_db_xml_cache.public/object_modeling_new_by_xml_schema.xsl
  23. 7 2
      SE/schema/default_db_xml_cache.public/system_cache__appinfo/TargetNamespaceBindings.xsl

+ 12 - 3
SE/schema/WPS_Functions/build_WPS_Functions.xml

@@ -22,10 +22,13 @@
     <property name="build_WPS_Functions.xsl" location="${WPS_Functions}/build_WPS_Functions.xsl"/>
     <property name="build_WPS_Functions.xml.properties" location="${WPS_Functions}/.build_WPS_Functions.xml.properties"/>
     
+    
+    
+    
     <!-- eof modules WPS_Functions  -->
   
     
-  
+    
   
   
     <!-- TODO combinated object combinate_objects_for_instance_prototypes.xsl  -->
@@ -80,12 +83,18 @@
     <property name="build_object_modeling_by_default_db_xml_schema.xml" value="${WPS_Functions}/object_modeling_by_default_db_xml_schema/build_object_modeling_by_default_db_xml_schema.xml"/>
     
     <property name="get_wfs_recurse_xsl.xsl" location="${basedir}/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl"/>
-    
+    <property name="build_get_wfs_recurse_xsl" value="${WPS_Functions}/get_wfs_recurse_xsl/build_get_wfs_recurse_xsl.xml"/>
     
     <property name="build_csv2xml.local_path" value="WPS_Functions/csv2xml"/> <!-- To be implemented in other modules to install xsl stylesheets correctly -->
     <property name="build_csv2xml" location="${basedir}/${build_csv2xml.local_path}/build_csv2xml.xml"/>
     
     <property name="csv2xml" location="/opt/local/bin/csv2xml"/>
+    
+    <property name="build_qgis_make_user_style.xml" location="${WPS_Functions}/default_db/qgis_make_user_style/build_qgis_make_user_style.xml"/>
+    <property name="build_qgis_make_user_style.xsl" location="${WPS_Functions}/default_db/qgis_make_user_style/build_qgis_make_user_style.xsl"/>
+    
+    <property name="build_username_and_pass_from_passwordBase64Basic.xml" location="${WPS_Functions}/username_and_pass_from_passwordBase64Basic/build_username_and_pass_from_passwordBase64Basic.xml"/>
+    
     <!-- EOF modules properties copied / controlled references -->
     
     
@@ -158,5 +167,5 @@
         <ant antfile="${object_modeling_new}" target="clean"/>
       
     </target>
-  
+    
 </project>

+ 25 - 3
SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/build_CRM_PROCES_tree.xml

@@ -157,14 +157,14 @@
         </echoxml>-->
         <delete file="${default_db:PROCES_INIT:tree.raport_for_dita.xml}"/>
         
-        <xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${build_ant_universal_by_xsl_match.xsl}" in="${wfs_output.xml}"  destdir="${CRM_PROCES_tree_basedir.temp}" out="${default_db:PROCES_INIT:tree.raport_for_dita.xml}" >
+        <!--<xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${build_ant_universal_by_xsl_match.xsl}" in="${wfs_output.xml}"  destdir="${CRM_PROCES_tree_basedir.temp}" out="${default_db:PROCES_INIT:tree.raport_for_dita.xml}" >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
-                <!--<attribute name="http://saxon.sf.net/feature/initialMode" value="RelatedFeatureRoot"/>-->
+                <!-\-<attribute name="http://saxon.sf.net/feature/initialMode" value="RelatedFeatureRoot"/>-\->
             </factory>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <param name="match_root_element" expression="wfs:FeatureCollection"/>
-            <param name="match_element" expression="default_db:CRM_PROCES"/> <!-- To be set universally to another type of object tree -->
+            <param name="match_element" expression="default_db:CRM_PROCES"/> <!-\- To be set universally to another type of object tree -\->
             <param name="antfile_prefix" expression="PROCES_INIT_tree_child_dita"/>
             <param name="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
             <param name="basedir" expression="${CRM_PROCES_tree_basedir}"/>
@@ -177,6 +177,28 @@
             <param name="parallel" expression="1"/>
             <param name="threadCount" expression="3"/>
             <param name="ant-launcher.jar" expression="${ant-launcher.jar}"/>
+        </xslt>-->
+        <echo>@2017-12-10 trying to use WPS_Functions/get_wfs_recurse_xsl/build_get_wfs_recurse_xsl.xml</echo>  
+        <xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${build_ant_universal_by_xsl_match.xsl}" in="${wfs_output.xml}"  destdir="${CRM_PROCES_tree_basedir.temp}" out="${default_db:PROCES_INIT:tree.raport_for_dita.xml}" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <!--<attribute name="http://saxon.sf.net/feature/initialMode" value="RelatedFeatureRoot"/>-->
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="match_root_element" expression="wfs:FeatureCollection"/>
+            <param name="match_element" expression="default_db:CRM_PROCES"/> <!-- To be set universally to another type of object tree -->
+            <param name="antfile_prefix" expression="PROCES_INIT_tree_child_dita"/>
+            <param name="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
+            <param name="basedir" expression="${CRM_PROCES_tree_basedir}"/>
+            <param name="antfile" expression="${build_get_wfs_recurse_xsl.xml}"/>
+            <param name="target" expression="xml_recursed_from_tr_map"/>
+            <param name="match_child_element" expression="default_db:ID"/>
+            <param name="match_child_element_property_name" expression="xpath_value"/>
+            <param name="properties.xml" expression="${properties.xml}"/>
+            <param name="properties_override.xml" expression="${properties_override.xml}"/>
+            <param name="parallel" expression="1"/>
+            <param name="threadCount" expression="1"/>
+            <param name="ant-launcher.jar" expression="${ant-launcher.jar}"/>
         </xslt>
     </target>
     

+ 85 - 0
SE/schema/WPS_Functions/get_wfs/build_get_wfs.xml

@@ -69,6 +69,10 @@
         <delete dir="${get_wfs_basedir.temp}" failonerror="false"/>
     </target>
 
+<target name="create_tempdir">            <mkdir dir="${get_wfs_basedir.temp}"/>
+    </target>
+
+
     <target name="http_first_input">
         <echo message="FETCHING '${url}' ..."/>
         <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result">
@@ -247,4 +251,85 @@
     </target>
     
     
+<target name="GetFeature.WithVerifyUnauthorized" depends="GetFeature"> <!-- GetFeature.VerifyUnauthorized.failed -->
+        <loadfile property="GetFeature.WithVerifyUnauthorized.srcfile" srcfile="${wfs_output.xml}" />
+        <condition property="GetFeature.VerifyUnauthorized.condition" taskname="GetFeature.VerifyUnauthorized.failed">
+            <contains  string="${GetFeature.WithVerifyUnauthorized.srcfile}" substring="Unauthorized" />
+        </condition>
+    </target>
+    
+    <target name="GetFeature.VerifyUnauthorized.failed" if="${GetFeature.VerifyUnauthorized.condition}">
+        <fail>
+            #258 Cannot properly download ${get_url}
+            Propably unset -DpasswordBase64Basic parameter!
+                generate it with :
+                    echo "username:password" |base64
+        </fail>
+    </target>
+    
+    
+    
+    <!-- @2017-12-14 copied from recurse_ant to be there only! -->
+    <target name="php_session_id_cond">
+        <condition property="php_session_id_fail" taskname="php_session_id_check">
+            <or>
+                <equals arg1="${php_session_id}" arg2=""/>
+                <equals arg1="${php_session_id}" arg2="$${php_session_id}"/>
+            </or>
+        </condition>
+    </target>
+    <target name="php_session_id_check" depends="php_session_id_cond,php_session_id_ok,php_session_id_fail" description="To create property php_session_id_tested for use in api calls"/>
+    <target name="php_session_id_ok" unless="${php_session_id_fail}" description="use php_session_id from parameter ">
+        <property name="php_session_id_tested" value="--cookie 'PHPSESSID=${php_session_id}'"/>
+    </target>
+    <target name="php_session_id_fail" if="${php_session_id_fail}"   description="retrieve php_session_id from API to use it after for fasten api requests" depends="read_build_properties,create_tempdir">
+        <tempfile  destdir="${get_wfs_basedir.temp}" prefix="usernameandpass" deleteonexit="yes" property="username_and_pass_from_passwordBase64Basic.properties" />
+        <ant antfile="${build_username_and_pass_from_passwordBase64Basic.xml}" target="username_and_pass_from_passwordBase64Basic.properties"/>
+            
+        <loadproperties srcfile="${username_and_pass_from_passwordBase64Basic.properties}"/>
+            
+        <echo> retrieved $username=${username}
+                php_session_id_check.properties=${php_session_id_check.properties}
+                $api_url = ${api_url}
+        </echo>    
+            <!-- retrieve new properties -username , username.pass -->
+        <property name="cookie_file" value="${get_wfs_basedir.temp}/${username}.cookie"/>
+        <!--<property name="cookie_file" value="${get_wfs_basedir.temp}/${username}.cookie"/>-->
+        <delete file="${cookie_file}" failonerror="no"/>
+        <exec executable="curl"> <!--  errorproperty="wfs_error" resultproperty="wfs_result" -->
+            <arg line=" -c ${cookie_file} -H 'Authorization: Basic ${passwordBase64Basic_tested}' &#34;${api_url}&#34;"/> <!-- /default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetCapabilities&#34; -->
+        </exec>
+        <echo> runned:  curl -c ${cookie_file} -H 'Authorization: Basic ${passwordBase64Basic_tested}' &#34;${api_url}&#34;</echo>
+        <property name="php_session_id_tested" value=" -b ${cookie_file}"/>
+        
+        
+        <!-- detecting from cookie  file just phpsesssid string 
+        # Netscape HTTP Cookie File
+        # https://curl.haxx.se/docs/http-cookies.html
+        # This file was generated by libcurl! Edit at your own risk.
+        
+        biuro.biall-net.pl	FALSE	/	FALSE	0	PHPSESSID	ndosk8faaskrfvdcbge8ki571l0oukdqtg7bmjht43b0cslohpbua2g5ouoi3b2vm6l14avvgna8bq6j6ufranhu77mtjplc1dthat2
+        -->
+        <loadfile property="php_session_id_tested.loadfile"  srcfile="${cookie_file}" />
+        <exec executable="bash"   outputproperty="php_session_id_ok.string" >
+            <arg  value="-c" />
+            <arg value="echo '${php_session_id_tested.loadfile}'|grep PHPSESSID |sed 's/.*PHPSESSID[ |\t]*//'"/>            
+        </exec>
+        
+        <property name="php_session_id_ok.string.test" value="test"/>
+        
+        <echo> #289 we set php_session_id_tested=(${php_session_id_tested}) 
+            $php_session_id_ok.string = ${php_session_id_ok.string}; 
+            $cookie_file = ${cookie_file}
+            $username = ${username}
+        </echo>
+        
+    </target>
+    
+    <target name="php_session_id_check.properties" depends="php_session_id_check">
+        <echo>#329 saving properties to ${php_session_id_check.properties}</echo>
+        <echoproperties destfile="${php_session_id_check.properties}" regex="(php_session_id_ok*)|(username*)"/>
+    </target>
+    
+    
 </project>

+ 70 - 4
SE/schema/WPS_Functions/get_wfs_recurse_xsl/build_get_wfs_recurse_xsl.xml

@@ -1,13 +1,74 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project basedir="." name="get_wgs_recurse_xsl" default="main">
+<project basedir="../../." name="get_wfs_recurse_xsl"  default="xml_recursed_from_tr_map">
     <description> To test file:/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl</description>
     
+    <property name="WPS_Functions" location="${basedir}/WPS_Functions"/>
+    <property name="build_WPS_Functions.xml" location="${WPS_Functions}/build_WPS_Functions.xml"/> <!-- call it to get properties -->
+    <property name="build_WPS_Functions.xml.properties" location="${build_WPS_Functions.xml}.properties"/>
     
-    <target name="main">
+    <property name="build_get_wfs_recurse_xsl" value="${WPS_Functions}/get_wfs_recurse_xsl/build_get_wfs_recurse_xsl.xml"/>
+    <property name="build_get_wfs_recurse_xsl_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />
+    <property name="build_get_wfs_recurse_xsl_basedir.temp" location="${build_get_wfs_recurse_xsl_basedir}/temp"  />
+    <property name="build_get_wfs_recurse_xsl.childproperties" location="${WPS_Functions.childproperties}/get_wfs_recurse_xsl_basedir.properties"/>
+    
+    
+    <!--<property name="build_get_wfs_recurse_xsl.xsl" location="${default_db_xml_cache.public}/get_wfs_recurse_xsl.xsl"/>-->
+    <property name="build_get_wfs_recurse_xsl.out.xml" location="${build_get_wfs_recurse_xsl_basedir.temp}/${uuid}.get_wfs_recurse_xsl.out.xml"/>
+    
+    <!-- -Duuid=KORESP61617_19_1506 -DtypeName=default_db:IN7_DZIENNIK_KORESP -Dxpath=ID -Dxpath_value=61617 -DpasswordBase64Basic="xxx="   -->
+    <property name="uuid" value="${uuid}"/>
+    <property name="typeName" value="${typeName}" />
+    <property name="xpath" value="${xpath}"/>
+    <property name="xpath_value" value="${xpath_value}" />
+    
+    
+    <target name="clean" description="Clean all output and temp files">
+        <delete dir="${build_get_wfs_recurse_xsl_basedir.temp}" failonerror="false"/>
+    </target>
+    
+    <target name="build_get_wfs_recurse_xsl.create_tempdir">       
+        <mkdir dir="${build_get_wfs_recurse_xsl_basedir.temp}"/>
+    </target>
+    
+    <target name="read_build_properties">
+        <!--<ant antfile="${root_build.xml}" target="save_build_properties.xml"/>-->
+        <!--<ant antfile="${root_build.xml}" target="read_build_properties.xml"/>-->
+        <!--<loadproperties srcfile="${build_properties.xml}"  />-->
+        <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
+        <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
+        <echo>We try to refresh ${default_db.xml} or ${detect_objects_parent_relations.xsl}</echo>
+    </target>
+    
+    <target name="write_child_props_to_config_dir" depends="read_build_properties">
+        <echoproperties destfile="${build_get_wfs_recurse_xsl.childproperties}"/>
+    </target>
+    
+    
+    
+    
+    
+    <target name="xml_recursed_from_tr_map" depends="read_build_properties,build_get_wfs_recurse_xsl.create_tempdir">
         
+        <!--<ant antfile="${build_usnername_and_pass_from_passwordBase64Basic.xml}" target="usnername_and_pass_from_passwordBase64Basic"/>-->
+        <tempfile property="php_session_id_check.properties" destdir="${build_get_wfs_recurse_xsl_basedir.temp}" prefix="php_session_id_check.properties"/>
+        <ant antfile="${get_wfs}" target="php_session_id_check.properties" inheritall="yes">
+           <!--<property name="php_session_id_ok.string" value="${php_session_id_ok.string}"/>
+            <property name="username.pass" value="${username.pass}"/>
+            <property name="username" value="${username}"/>-->
+        </ant>
         
+        <loadproperties srcfile="${php_session_id_check.properties}"/>
         
-        <xslt basedir="${default_db:recurse_ant_basedir}" style="/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl" in="empty.xml"  destdir="./" out="out.xml" > <!-- out_task.dita.final -->
+        <echo>#91 xml_recursed_from_tr_map
+            $uuid=${uuid};
+            $typeName=${typeName};
+            $xpath_value=${xpath_value}
+            $xpath=${xpath}
+            $username = ${username}
+            $username.pass = ${username.pass}
+            php_session_id_ok.string = ${php_session_id_ok.string} 
+        </echo>
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${get_wfs_recurse_xsl.xsl}" in="${empty.xml}"  destdir="${build_get_wfs_recurse_xsl_basedir.temp}" out="${build_get_wfs_recurse_xsl.out.xml}" force="yes" > <!-- out_task.dita.final -->
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <!--<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>-->
                 <attribute name="http://saxon.sf.net/feature/initialTemplate" value="main"/>
@@ -16,7 +77,12 @@
             <!--<param name="webRootUrl" expression="${webRootUrl}" />--> 
             <!--<param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita}"/>-->
             <param name="uuid" expression="${uuid_tested}"/>
-            <param name="username.pass" expression="Vis11on69CZ"/>
+            <param name="username.pass" expression="${username.pass}"/>
+            <param name="username" expression="${username}"/>
+            <param name="typeName" expression="${typeName}"/>
+            <param name="xpath_value" expression="${xpath_value}"/>
+            <param name="xpath" expression="${xpath}"/>
+            <param name="php_session_id_ok.string" expression="${php_session_id_ok.string}"/>
             <!--<param name="basedir" expression="${basedir}"/>-->
             <param name="temp" expression="${temp}"/>
             <param name="simpleSchema_dir" expression="/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/default_db.instance.xml/simpleSchema/"/>

+ 1 - 0
SE/schema/WPS_Functions/object_install_se_ant_object/build_object_install_se_ant_object.xml

@@ -90,6 +90,7 @@
     
     <target name="system_cache__appinfo:object_install_se_ant_object.list_external_schemas" depends="read_build_properties" description="To list to import aviable schemas">
         <!-- procesy5_system_schema_file -->
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema"/>
         <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml_if_not_exists"/>
         
         <xslt basedir="./" style="${build_object_install_se_ant_object.xsl}"  in="${procesy5_system_schema.xml}"  destdir="${build_object_install_se_ant_object_basedir.temp}" out="${build_object_install_se_ant_object.list_schema_elements.xml}"  force="yes">

+ 69 - 7
SE/schema/WPS_Functions/object_install_se_ant_object/build_object_install_se_ant_object.xsl

@@ -15,13 +15,13 @@
     
     
     <xsl:param name="NamespaceBinding.xml" required="yes"/> <!-- to set propery install prefix -->
-    <xsl:param name="vrtfNamespaces.xml" required="yes"/>
+    <!--<xsl:param name="vrtfNamespaces.xml" required="yes"/>-->
     <!--<xsl:param name="external_schema_table.path" required="yes"/>-->
     
     
     <xsl:variable name="NamespaceBinding" select="doc($NamespaceBinding.xml)"/>
     
-    <xsl:variable name="system_cache__appinfo:vrtfNamespaces" select="doc($vrtfNamespaces.xml)"/>
+    <!--<xsl:variable name="system_cache__appinfo:vrtfNamespaces" select="doc($vrtfNamespaces.xml)"/>-->
     
     
    
@@ -49,13 +49,13 @@
    
     
    
-    <xsl:template match="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" 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:template match="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix[xs:schema/@targetNamespace='https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.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>
     
-    <xsl:template match="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"> <!-- FILTERING [xs:schema/@targetNamespace='https://biuro.biall-net.pl/wfs/default_db/table/ADMIN_USERS.xsd'] -->
+    <xsl:template match="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"/>
         </xsl:apply-templates>
@@ -435,6 +435,7 @@
             <xsl:element name="{name()}">
                 <xsl:copy-of select="@*"/>
                      <xsl:variable name="build_element_cache">
+                         <xsl:message>#458 calling system_cache__appinfo:build_element_cache for $targetNamespace=<xsl:value-of select="$targetNamespace"/>; </xsl:message>
                          <xsl:call-template name="system_cache__appinfo:build_element_cache">
                              <xsl:with-param name="element" select="@name"/>
                              <xsl:with-param name="prefix" select="$prefix"/>
@@ -469,12 +470,16 @@
     
     <!--<xsl:template match="complexType[ not(@name='sys_users') and not(@name='crm_families') and not(@name='crm_coordinators') and not(@name='crm_addressesfamilieslinks') and  ../.././name()='system_cache__appinfo:get_all_xsd_default_db']" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external"/>--> <!-- not(@name='sys_users') and not(@name='crm_families') and not(@name='crm_coordinators') and not(@name='crm_addressesfamilieslinks') and -->
     
+    <xsl:template match="element[  ../.././name()='system_cache__appinfo:get_all_xsd_default_db']" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external"> <!-- (@name='crm_families' or @name='crm_addressesfamilieslinks' or @name='crm_coordinators' or @name='sys_users') and -->
+        <xsl:message>#474 bypassed ROOT element/@name=<xsl:value-of select="@name"/></xsl:message>
+    </xsl:template>
+    
     <xsl:template match="complexType[  ../.././name()='system_cache__appinfo:get_all_xsd_default_db']" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external"> <!-- (@name='crm_families' or @name='crm_addressesfamilieslinks' or @name='crm_coordinators' or @name='sys_users') and -->
         <xsl:param name="prefix" required="yes"/>
         <xsl:param name="targetNamespace" required="yes"/>
         <xsl:param name="prefix_root"  required="yes"/>
         <xsl:param name="targetNamespace_root" required="yes"/>
-        
+        <!-- TODO testing @2017-12-13 if has run element -->
         <xsl:variable name="element" select="@name"/>
         <xsl:variable name="element-filename" >
             <xsl:choose>
@@ -512,6 +517,7 @@
                     <xsl:copy-of select="$prefixed_object_info"/>
                 </prefixed_object_info>
             </xsl:if>
+            <xsl:message>#516 NOT calling system_cache__appinfo:build_element_cache</xsl:message>
             <xsl:variable name="build_element_cache">
                 <xsl:copy-of select="."/>
             </xsl:variable>
@@ -577,7 +583,9 @@
                         </generate_tables_from_external_root.required_by.path_init>
                     </xsl:element>
                 </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+                <xsl:message>#586 will element=<xsl:value-of select="$element"/>; (foreach) call system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath) = <xsl:value-of select="@system_cache__appinfo:xpath"/> in $targetNamespace=<xsl:value-of select="$targetNamespace"/>;</xsl:message>
                 <xsl:for-each-group select="../xs:complexType//system_cache__appinfo:flat_relation_cache[ system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath) = current()/@name ]" group-by="@system_cache__appinfo:name" >
+                    <xsl:message>#583 will ( IN foreach) call system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath) = <xsl:value-of select="@system_cache__appinfo:xpath"/></xsl:message>
                     <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"/>
@@ -591,6 +599,7 @@
                             <xsl:attribute name="id" select="concat($id,'ct',@system_cache__appinfo:name)"/>
                             <xs:complexContent>
                                 <xs:extension>
+                                    <xsl:message>#600 calling concat($prefix,':',system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath)) with @system_cache__appinfo:xpath=(<xsl:value-of select="@system_cache__appinfo:xpath"/>)</xsl:message>
                                     <xsl:attribute name="base" select="concat($prefix,':',system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath))"/>
                                     <generate_tables_from_external_root.required_by.path_init>
                                         <xsl:attribute name="prefix" select="$prefix"/>
@@ -610,6 +619,7 @@
                         <xsl:element name="xs:element">
                             <xsl:attribute name="name" select="@system_cache__appinfo:name"/>
                             <xsl:attribute name="id" select="concat($id,'el',@system_cache__appinfo:name)"/>
+                            <xsl:message>#5621 will call system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath) = <xsl:value-of select="@system_cache__appinfo:xpath"/></xsl:message>
                             <xsl:attribute name="type" select="concat($prefix,':',system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath))"/>
                                     <generate_tables_from_external_root.required_by.path_init>
                                         <xsl:attribute name="prefix" select="$prefix"/>
@@ -650,7 +660,7 @@
         </xsl:variable>
         <xsl:variable name="prefix_token" select="tokenize(system_cache__appinfo:translate_object_escaped_prefix_from_string($element-filename),':')"/>
         <xsl:variable name="translate_object_escaped_prefix_from_string" select="system_cache__appinfo:translate_object_escaped_prefix_from_string($element-filename)"/>
-        <xsl:message>#186 parsing CT: <xsl:value-of select="@name"/>  ; </xsl:message>
+        <!--<xsl:message>#186 parsing CT: <xsl:value-of select="@name"/>  ; </xsl:message>-->
         
         <system_cache__appinfo:build_complexType>
             <xsl:copy-of select="@*"/>
@@ -667,6 +677,7 @@
             </prefixed_object_info>
             </xsl:if>
             <xsl:variable name="build_element_cache">
+                <xsl:message>#671 calling system_cache__appinfo:build_complexType_cache</xsl:message>
                 <xsl:call-template name="system_cache__appinfo:build_complexType_cache">
                     <xsl:with-param name="complexType" select="@name"/>
                     <xsl:with-param name="prefix" select="$prefix"/>
@@ -1594,6 +1605,40 @@
             </xsl:element>
     </xsl:template>
     
+    <xsl:template match="simpleType" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child.get_all_xsd_default_db" 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="prefix_root" select="$prefix_root"/>
+            <xsl:if test="number($debug_level) &gt; 3"><xsl:attribute name="debug" select="'#1644'"/></xsl:if>
+            <xsl:element name="{name()}">
+                <xsl:copy-of select="@*"/>
+                <xsl:copy-of select="*"/>
+                <xsl:choose>
+                    <xsl:when test="@base">
+                        <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child.get_all_xsd_default_db" select=" root()//system_cache__appinfo:get_all_xsd_default_db/schema[@targetNamespace=$targetNamespace_root]/simpleType[@name= system_cache__appinfo:clean_object_prefix(current()/@base)]">
+                            <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:when>
+                </xsl:choose>
+            </xsl:element>
+        </system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_root>
+        
+    </xsl:template>
+    
+    
     <xsl:template match="element[@type ]" mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child.get_all_xsd_default_db" 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"/>
@@ -1610,15 +1655,32 @@
                     <xsl:comment>#203aB - type typu xs:</xsl:comment>
                     <!--<xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_force_refered_element" select="."/>-->
                 </xsl:when>
+                <xsl:when test=" root()//system_cache__appinfo:get_all_xsd_default_db/schema[@targetNamespace=$targetNamespace_root]/simpleType[@name= system_cache__appinfo:clean_object_prefix(current()/@type)]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                    <xsl:copy-of select="@*"/>
+                    <xsl:if test="number($debug_level) &gt; 3"><xsl:attribute name="debug.203aB">#203aB - type typu xs: v</xsl:attribute></xsl:if>
+                    
+                    <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)"/>
+                    <xsl:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child.get_all_xsd_default_db" select=" root()//system_cache__appinfo:get_all_xsd_default_db/schema[@targetNamespace=$targetNamespace_root]/simpleType[@name= system_cache__appinfo:clean_object_prefix(current()/@type)]">
+                            <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:apply-templates mode="system_cache__appinfo:object_install_se_ant_object.generate_tables_from_external_child_force_refered_element" select="."/>-->
+                </xsl:when>
                 <xsl:otherwise>
+                    <xsl:message>#test 1641 child <xsl:value-of select=" root()//system_cache__appinfo:get_all_xsd_default_db/schema[@targetNamespace=$targetNamespace_root]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:message>
                     <xsl:if test="not(xs:annotation/xs:appinfo/system_cache__appinfo:flat_relation_cache/@system_cache__appinfo:xpath)">
-                        <xsl:message terminate="yes">#1475 Unset xs:annotation/xs:appinfo/system_cache__appinfo:flat_relation_cache/@system_cache__appinfo:xpath in @id:<xsl:value-of select="@id"/> element.</xsl:message>
+                        <xsl:message terminate="yes">FATAL ERROR ? #1475 not set xs:annotation/xs:appinfo/system_cache__appinfo:flat_relation_cache/@system_cache__appinfo:xpath in @id:<xsl:value-of select="@id"/> element name=(<xsl:value-of select="@name"/>) @type=(<xsl:value-of select="@type"/>) generate_tables_from_external_root.path=(<xsl:value-of select="$generate_tables_from_external_root.path"/>) $targetNamespace=(<xsl:value-of select="$targetNamespace"/>)</xsl:message>
                     </xsl:if>
+                    <xsl:message>#1652 will call system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath) = <xsl:value-of select="xs:annotation/xs:appinfo/system_cache__appinfo:flat_relation_cache/@system_cache__appinfo:xpath"/></xsl:message>
                     <xsl:variable name="prefix" select="system_cache__appinfo:object_install_se_ant_object.create_prefix($prefix_root,system_cache__appinfo:xpath.to.root_table(xs:annotation/xs:appinfo/system_cache__appinfo:flat_relation_cache/@system_cache__appinfo:xpath))"/>
                     <xsl:attribute name="ref" select="concat($prefix,':',@name)"/>
                     <xsl:comment>#203bB - ref wymagac bedzie odtworzenia root/elenent dotyczacy tego refa. na bazie wszystkich uzytych system_cache__appinfo:flat_relation_cache[system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath) = current()/@name ]</xsl:comment>
                     <generate_tables_from_external_root.required_by.path_init>
                         <xsl:attribute name="prefix" select="$prefix"/>
+                        <xsl:message>#1658 will call system_cache__appinfo:xpath.to.root_table(@system_cache__appinfo:xpath) = <xsl:value-of select="xs:annotation/xs:appinfo/system_cache__appinfo:flat_relation_cache/@system_cache__appinfo:xpath"/></xsl:message>
                         <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace($targetNamespace_root,system_cache__appinfo:xpath.to.root_table(xs:annotation/xs:appinfo/system_cache__appinfo:flat_relation_cache/@system_cache__appinfo:xpath))"/>
                     </generate_tables_from_external_root.required_by.path_init>
                 </xsl:otherwise>

+ 19 - 7
SE/schema/WPS_Functions/object_modeling/build_object_modeling.xml

@@ -13,16 +13,16 @@
     
     <property name="object_modeling_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />
     <property name="build_object_modeling.childproperties" location="${WPS_Functions.childproperties}/build_object_modeling.properties"/>
-    
+    <!--<property name="object_modeling_build" location="${object_modeling_basedir}/build_object_modeling.xml"  />-->
     
     <property name="public_html" location="${basedir}" />
     <property name="root_build.xml" location="${public_html}/build.xml"/>
     <!--<property name="build_properties.xml" location="${public_html}/build_properties.xml" />-->
     
-    <property  name="object_modeling.xsl" location="${public_html}/default_db_xml_cache.public/object_modeling.xsl"/>
+    <property name="object_modeling.xsl" location="${public_html}/default_db_xml_cache.public/object_modeling.xsl"/>
     <property name="build_properties" location="${public_html}/build_properties" />
     
-    
+    <property name="targetNamespace.base" value="${targetNamespace.base}"/> <!-- to be set by WPS_Functions/object_modeling_build_infrastructure/temp/build_object_modeling_build_infrastructure_child.xml -->
    <!-- <property name="table.local" location="${public_html}/table"/>
     
     <property name="transformed.local" location="${default_db.instance.xml}/transformed"/>
@@ -47,14 +47,19 @@
         <input addproperty="prototype_object_namespace" /> <!-- https://biuro.biall-net.pl/wfs/default_db/Types/Infrastructure.xsd -->
         <input addproperty="new_object_namespace" /> <!-- https://biuro.biall-net.pl/wfs/default_db/table/Rozdzielcza_struktura_wewnetrzna_wsg84.xsd -->
         <ant antfile="${root_build.xml}" target="procesy5_system_schema.xml_if_not_exists" />
-        <echo> object_modeling_basedir= ${object_modeling_basedir}
+        <echo> #50
+            object_modeling_basedir= ${object_modeling_basedir}
             procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
             generating from ${prototype_object_namespace}
             generating to ${new_object_namespace}
+            generating grom base
+            targetNamespace.base ${targetNamespace.base}
+            object_modeling.Error.Handling = ${object_modeling.Error.Handling}
+            NamespaceObjectInstanceTable = ${NamespaceObjectInstanceTable}
         </echo>
         
         <delete file="${new_object_by_prototype.xml}"/>
-        <xslt basedir="./" style="${object_modeling.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${new_object_by_prototype.xml}" >
+        <xslt basedir="./" style="${object_modeling.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${new_object_by_prototype.xml}" force="yes" >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
                 <attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}new_object_by_prototype"/>
@@ -62,10 +67,17 @@
             <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
             <param name="new_object_namespace" expression="${new_object_namespace}"/>
             <param name="procesy5_system_schema_collection_dir" expression="${public_html}"/>
+            <param name="external_schema_table.path" expression="${external_schema_table.path}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
+            <param name="object_modeling_build" expression="${object_modeling_build}"/>
+            <param name="default_db.instance.xml" expression="${default_db.instance.xml}"/>
+            <param name="object_modeling.Error.Handling" expression="${object_modeling.Error.Handling}"/>
+            <param name="NamespaceObjectInstanceTable" expression="${NamespaceObjectInstanceTable}"/>
+            <param name="vrtfNamespaces.xml" expression="${vrtfNamespaces.xml}"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
         </xslt>
-        <loadfile property="new_object_by_prototype.xml_result" srcfile="${new_object_by_prototype.xml}"/>
-        <echo message="${new_object_by_prototype.xml_result}"/>
+        <!--<loadfile property="new_object_by_prototype.xml_result" srcfile="${new_object_by_prototype.xml}"/>
+        <echo message="${new_object_by_prototype.xml_result}"/>-->
     </target>
     
     

+ 90 - 10
SE/schema/WPS_Functions/object_modeling_build_infrastructure/build_object_modeling_build_infrastructure.xml

@@ -2,7 +2,8 @@
 <project basedir="../../." name="object_modeling_build_infrastructure" default="system_cache__appinfo:object_modeling_build_infrastructure"
     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
     <description>
-        TO model objects capabilities
+        TO model objects capabilities by prototypes - or Infrastructure or another existient model 
+        @2017-12-19 to nie dziala - tylko robi puste modele bez prototypes - mozna uzywac, ale bez liczenia na to, ze zmerguje!!! tylko object_modeling.xsl wyzwalane z WPS_Functions/object_modeling_new/build_object_modeling_new.xml z target system_cache__appinfo:object_modeling_new.build_Infrastructure
     </description>
     
     
@@ -49,17 +50,16 @@
         <delete dir="${object_modeling_build_infrastructure_basedir.temp}" failonerror="false"/>
     </target>
     
-    <target name="system_cache__appinfo:object_modeling_build_infrastructure" depends="read_build_properties" description="ANT_TARGET new object by using prototype from Types" >
+    <target name="system_cache__appinfo:object_modeling_build_infrastructure" depends="read_build_properties" description="ANT_TARGET @2017-12-19 TO NIE MERGUJE! new object by using prototype from Types" >
         <ant antfile="${root_build.xml}" target="procesy5_system_schema.xml_if_not_exists" /> 
         <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>
-        
-        
-        <property name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Infrastructure.xsd"/>
+
+        <property name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/infrastructure.xsd"/>
         <property name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
         <property name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
         <property name="NamespaceObjectInstanceType" value="table"/>
-        <property name="NamespaceObjectInstanceTable_RegexString" value="ozdzielcza_"/>
-        
+        <property name="NamespaceObjectInstanceTable_RegexString" value="ozdzielcza_"/> <!-- ozdzielcza_ -->
+        <property name="targetNamespace.base" value="${targetNamespace_DEFAULTS}"/> <!-- which source schema to use (currently force to ${default_db.xml} )-->
         <property name="build_object_modeling_build_infrastructure_child.xml" value="${object_modeling_build_infrastructure_basedir.temp}/build_object_modeling_build_infrastructure_child.xml"/>
         <mkdir dir="${object_modeling_build_infrastructure_basedir.temp}"/>
         
@@ -69,7 +69,7 @@
         </echo>
         
         
-        <xslt basedir="./" style="${object_modeling_build_infrastructure.xsl}"  in="${default_db.xml}"  destdir="./" out="${build_object_modeling_build_infrastructure_child.xml}" >
+        <xslt basedir="./" style="${object_modeling_build_infrastructure.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${build_object_modeling_build_infrastructure_child.xml}" force="yes" >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
                 <!--<attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}new_object_by_prototype"/>-->
@@ -77,6 +77,9 @@
             <param name="NamespaceObjectInstanceTable_RegexString" expression="${NamespaceObjectInstanceTable_RegexString}"/>
             <param name="TargetNamespace" expression="${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}"/>
             <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
+            <param name="object_modeling_build" expression="${object_modeling_build}"/>
+            <param name="basedir" expression="${basedir}"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
         </xslt>
         <!--<loadfile property="new_object_by_prototype.xml_result" srcfile="${new_object_by_prototype.xml}"/>
@@ -84,8 +87,85 @@
         <ant antfile="${build_object_modeling_build_infrastructure_child.xml}"/>
     </target>
     
+    <target name="system_cache__appinfo:object_modeling_build_default" depends="read_build_properties" description="ANT_TARGET @2017-12-19 to nie dziala - do likwidacji  new object by using prototype from Types - to nie merguje" >
+        <!--<ant antfile="${root_build.xml}" target="procesy5_system_schema.xml_if_not_exists" />-->
+        <ant antfile="${root_build.xml}" target="procesy5_system_schema.xml" />
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>
+        
+        <property name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"/>
+        <property name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
+        <property name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
+        <property name="NamespaceObjectInstanceType" value="table"/>
+        <property name="NamespaceObjectInstanceTable_RegexString.ignore" value="(bravecare__sys_users)|(^_.*)|(ITEM_LINK_TYPES)|(F_ID)|(F_GID.*)|(D_P)|(COLUMNS)|(BI_audit_KW_requested_person_copy)|(.*.copy_energa.*)|(BI_audit_ENERGA_RUM_KONTRAHENCI_copy)|(.*energa_copy.*)|(BI_audit_ALL.*)|(BILLING_USERS_OLD)|(BILLING_USERS_ADD_OLD)|(AUTOSHAPE.*)|(ATTACHMENTS)|(ADMIN_USERS__REF__LOCAL_EMAIL)|(.*to_delete.*)|(.*temp.*)|(tmp.*)|(.*test.*)|(.*otomin.*)|(.*kasacja.*)|(.*default_default_objects.*)|(.*arskom.*)|(.*aneksy.*)|(ams.*)|(.*zasob_path_idx.*)|($_.*)|(s2sua)|(seq)|(stats_BILLS_FVAT_POS)|(phone)|(_remote_L1_BILLS_KP)|(_project_path_idx)|(__RAPORT_Rozdzielcza_Raport)|(.*TEMP.*)|(.*_SYNC_.*)|(.*_backup_.*)|(.*__INSTANCE_CLOSURE.*)|(CRM_LISTA_ZASOBOW_tree)|(.*_idx.*)|(.*_prim.*)|(CRM_REF_CONFIG)|(F_AREA.*)|($F_.*)|(ID_OFFERS)|(IN7_CECHY)|(.*_TEST_.*)|(IN7_PRODUKTY_CECHY)|(INDEKS24)|(INVENTORY)|(ITEM_LINKS.*)|(LDAP_GROUPS)|(.*_old.*)|(stats_BILLS_FVAT_POS)|(ozdzielcz.*)"/>
+        <property name="NamespaceObjectInstanceTable_RegexString" value=".*"/> <!-- ozdzielcza_ -->
+        <property name="targetNamespace.base" value="${targetNamespace_DEFAULTS}"/> <!-- which source schema to use (currently force to ${default_db.xml} )-->
+        <property name="build_object_modeling_build_infrastructure_child.xml" value="${object_modeling_build_infrastructure_basedir.temp}/build_object_modeling_build_infrastructure_child.xml"/>
+        <mkdir dir="${object_modeling_build_infrastructure_basedir.temp}"/>
+        
+        <echo> object_modeling_basedir= ${object_modeling_basedir};
+            procesy5_system_schema.xml= ${procesy5_system_schema.xml}; 
+            default_db.xml= ${default_db.xml};
+            NamespaceObjectInstanceTable_RegexString = ${NamespaceObjectInstanceTable_RegexString}
+        </echo>
+        
+        
+        <xslt basedir="./" style="${object_modeling_build_infrastructure.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${build_object_modeling_build_infrastructure_child.xml}" force="yes" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <!--<attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}new_object_by_prototype"/>-->
+            </factory>
+            <param name="NamespaceObjectInstanceTable_RegexString" expression="${NamespaceObjectInstanceTable_RegexString}"/>
+            <param name="NamespaceObjectInstanceTable_RegexString.ignore" expression="${NamespaceObjectInstanceTable_RegexString.ignore}"/>
+            <param name="TargetNamespace" expression="${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}"/>
+            <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
+            <param name="object_modeling_build" expression="${object_modeling_build}"/>
+            <param name="basedir" expression="${basedir}"/> <!-- one level deeper -->
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+        </xslt>
+        <!--<loadfile property="new_object_by_prototype.xml_result" srcfile="${new_object_by_prototype.xml}"/>
+        <echo message="${new_object_by_prototype.xml_result}"/>-->
+        <!--<ant antfile="${build_object_modeling_build_infrastructure_child.xml}"/>-->
+    </target>
     
-    
-    
+    <!--<target name="system_cache__appinfo:object_modeling_build_Empty" depends="read_build_properties" description="ANT_TARGET new object by using prototype from Empty.xsd - simple tables" >
+        <ant antfile="${root_build.xml}" target="procesy5_system_schema.xml_if_not_exists" /> 
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>
+        
+        <property name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Empty.xsd"/>
+        <property name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
+        <property name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
+        <property name="NamespaceObjectInstanceType" value="table"/>
+        <!-\-<property name="NamespaceObjectInstanceTable_RegexString.ignore" value=""/>-\->
+        <property name="NamespaceObjectInstanceTable_RegexString" value="(JPK)|(stats_BILLS_FVAT_POS)"/> <!-\- ozdzielcza_ -\->
+        <property name="targetNamespace.base" value="${targetNamespace_DEFAULTS}"/> <!-\- which source schema to use (currently force to ${default_db.xml} )-\->
+        <property name="build_object_modeling_build_infrastructure_child.xml" value="${object_modeling_build_infrastructure_basedir.temp}/build_object_modeling_build_infrastructure_child.xml"/>
+        <mkdir dir="${object_modeling_build_infrastructure_basedir.temp}"/>
+        
+        <echo> object_modeling_basedir= ${object_modeling_basedir};
+            procesy5_system_schema.xml= ${procesy5_system_schema.xml}; 
+            default_db.xml= ${default_db.xml};
+            NamespaceObjectInstanceTable_RegexString = ${NamespaceObjectInstanceTable_RegexString}
+        </echo>
+        
+        
+        <xslt basedir="./" style="${object_modeling_build_infrastructure.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${build_object_modeling_build_infrastructure_child.xml}" force="yes" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <!-\-<attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}new_object_by_prototype"/>-\->
+            </factory>
+            <param name="NamespaceObjectInstanceTable_RegexString" expression="${NamespaceObjectInstanceTable_RegexString}"/>
+            <param name="NamespaceObjectInstanceTable_RegexString.ignore" expression="${NamespaceObjectInstanceTable_RegexString.ignore}"/>
+            <param name="TargetNamespace" expression="${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}"/>
+            <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
+            <param name="object_modeling_build" expression="${object_modeling_build}"/>
+            <param name="basedir" expression="${basedir}"/> <!-\- one level deeper -\->
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+        </xslt>
+        <!-\-<loadfile property="new_object_by_prototype.xml_result" srcfile="${new_object_by_prototype.xml}"/>
+        <echo message="${new_object_by_prototype.xml_result}"/>-\->
+        <!-\-<ant antfile="${build_object_modeling_build_infrastructure_child.xml}"/>-\->
+    </target>-->
   
 </project>

+ 37 - 7
SE/schema/WPS_Functions/object_modeling_build_infrastructure/object_modeling_build_infrastructure.xsl

@@ -1,31 +1,51 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
     exclude-result-prefixes="xs"
     version="2.0">
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     
     <xsl:param name="NamespaceObjectInstanceTable_RegexString" required="yes"/> <!-- like Rozdzielcza_ -->
+    <xsl:param name="NamespaceObjectInstanceTable_RegexString.ignore"/>
     <xsl:param name="TargetNamespace" required="yes"/>
     <xsl:param name="prototype_object_namespace" required="yes"/>
+    <xsl:param name="targetNamespace.base" required="yes"/> <!-- defived from ${targetNamespace_DEFAULTS} sounds like http://biuro.biall-net.pl/xmlschema_procesy5/default_db -->
+    <xsl:param name="object_modeling_build" required="yes"/>
+    <xsl:param name="basedir" required="yes"/>
     
+    <xsl:include href="../../default_db_xml_cache.public/system_cache__appinfo/TargetNamespaceBindings.xsl"/>
     
-    <xsl:template match="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
-        <project basedir="../../." name="object_modeling_build_infrastructure_child" default="system_cache__appinfo:object_modeling_build_infrastructure_child"
+    <xsl:template match="system_cache__appinfo:get_all_xsd_list" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+        <xsl:message>rurnning 16 for <xsl:value-of select="$targetNamespace.base"/></xsl:message>
+        <project basedir="{$basedir}" name="object_modeling_build_infrastructure_child" default="system_cache__appinfo:object_modeling_build_infrastructure_child"
             xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
+                <xsl:apply-templates/>
+        </project>
+    </xsl:template>
+    
+    <xsl:template match="system_cache__appinfo:get_all_xsd_default_db[substring-after(schema/@targetNamespace,'://') = substring-after($targetNamespace.base,'://')]"  xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:message>TNS<xsl:value-of select="schema/@targetNamespace"/> </xsl:message> <!-- [schema/@targetNamespace=$targetNamespace.base] -->
+                <xsl:apply-templates/>
+    </xsl:template>
+    
+    <xsl:template match="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
             <target name="system_cache__appinfo:object_modeling_build_infrastructure_child">
-            <xsl:apply-templates/>
+                <xsl:apply-templates/>
             </target>
-        </project>
     </xsl:template>
     
     <xsl:template match="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:choose>
             <xsl:when test="contains(@name,'_HIST')"/>
-            <xsl:when test=" contains(@name,$NamespaceObjectInstanceTable_RegexString)">
+            <xsl:when test="string-length($NamespaceObjectInstanceTable_RegexString.ignore) &gt; 0 and ( contains(@name,$NamespaceObjectInstanceTable_RegexString.ignore) or matches(@name,$NamespaceObjectInstanceTable_RegexString.ignore))">
+                <xsl:message>#41 igroned by $NamespaceObjectInstanceTable_RegexString.ignore : <xsl:value-of select="@name"/></xsl:message>
+            </xsl:when>
+            <xsl:when test="contains(@name,$NamespaceObjectInstanceTable_RegexString) or matches(@name,$NamespaceObjectInstanceTable_RegexString)">
+                <xsl:message>#44 creating ant to build <xsl:value-of select="@name"/> for prototype_object_namespace =<xsl:value-of select="$prototype_object_namespace"/> </xsl:message>
                 <ant>
-                    <xsl:attribute name="antfile" select="'${object_modeling_build}'"/>
+                    <xsl:attribute name="antfile" select="$object_modeling_build"/>
                     <xsl:attribute name="target" select="'system_cache__appinfo:new_object_by_prototype'"/>
                     <property>
                         <xsl:attribute name="name" select="'prototype_object_namespace'"/>
@@ -33,7 +53,17 @@
                     </property>
                     <property>
                         <xsl:attribute name="name" select="'new_object_namespace'"/>
-                        <xsl:attribute name="value" select=" concat($TargetNamespace,'/',@name,'.xsd')"/>
+                        <xsl:variable name="new_object_namespace">
+                            <xsl:call-template name="system_cache__appinfo:new_object_namespace">
+                                <xsl:with-param name="TargetNamespace" select="$TargetNamespace"/>
+                                <xsl:with-param name="name" select="@name"/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:attribute name="value" select="$new_object_namespace"/> <!--  concat($TargetNamespace,'/',@name,'.xsd') -->
+                    </property>
+                    <property>
+                        <xsl:attribute name="name" select="'targetNamespace.base'"/>
+                        <xsl:attribute name="value" select="$targetNamespace.base"/>
                     </property>
                 </ant>
             </xsl:when>

+ 1 - 0
SE/schema/WPS_Functions/object_modeling_by_default_db_xml_schema/build_object_modeling_by_default_db_xml_schema.xml

@@ -2,6 +2,7 @@
 <project basedir="../../." name="object_modeling_by_default_db_xml_schema" default="system_cache__appinfo:default_db_get_xml_schema">
     <description>This build is to retrieve old style api default_db.xml schema for modeling manually purposes
                  Also to import and make objects by imported schema
+                 aviable for other ant as $build_object_modeling_by_default_db_xml_schema.xml
     </description>
     
     <!-- modules WPS_Functions - to be copied to any module needed -->

+ 179 - 0
SE/schema/WPS_Functions/object_modeling_new/build_object_modeling_new.child.xsl

@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="NamespaceObjectInstanceTable_RegexString" required="yes"/> <!-- like Rozdzielcza_ -->
+    <xsl:param name="NamespaceObjectInstanceTable_RegexString.ignore"/>
+    <xsl:param name="TargetNamespace" required="yes"/>
+    <xsl:param name="prototype_object_namespace" required="yes"/>
+    <xsl:param name="targetNamespace.base" required="yes"/> <!-- defived from ${targetNamespace_DEFAULTS} sounds like http://biuro.biall-net.pl/xmlschema_procesy5/default_db -->
+    <!--<xsl:param name="object_modeling_new" required="yes"/>-->
+    <xsl:param name="basedir" required="yes"/>
+    <xsl:param name="TargetNamespaceBindingsApi" required="yes"/>
+    <xsl:param name="NamespaceDatabaseStorageDefinitionPrefix" required="yes"/>
+    <xsl:param name="NamespaceObjectInstanceType" required="yes"/>
+    <!--<xsl:param name="new_object_namespace" required="yes"/>-->
+    <xsl:param name="object_modeling.Error.Handling" required="yes"/>
+    <xsl:param name="object_modeling_new_basedir_repository" required="yes"/>
+    <xsl:param name="ant.build" required="yes"/>
+    <xsl:param name="ant.target" required="yes"/>
+    <xsl:include href="../../default_db_xml_cache.public/system_cache__appinfo/TargetNamespaceBindings.xsl"/>
+    
+    
+    <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:build_object_modeling_new.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
+        <xsl:message>rurnning 16 for <xsl:value-of select="$targetNamespace.base"/>
+            NamespaceObjectInstanceTable_RegexString = <xsl:value-of select="$NamespaceObjectInstanceTable_RegexString"/>
+            NamespaceObjectInstanceTable_RegexString.ignore = <xsl:value-of select="$NamespaceObjectInstanceTable_RegexString.ignore"/>
+            TargetNamespace = <xsl:value-of select="$TargetNamespace"/>
+            prototype_object_namespace = <xsl:value-of select="$prototype_object_namespace"/>
+            targetNamespace.base = <xsl:value-of select="$targetNamespace.base"/>
+            basedir = <xsl:value-of select="$basedir"/>
+            TargetNamespaceBindingsApi = <xsl:value-of select="$TargetNamespaceBindingsApi"/>
+            NamespaceDatabaseStorageDefinitionPrefix = <xsl:value-of select="$NamespaceDatabaseStorageDefinitionPrefix"/>
+            NamespaceObjectInstanceType = <xsl:value-of select="$NamespaceObjectInstanceType"/>
+            ant.build = <xsl:value-of select="$ant.build"/>
+            ant.target = <xsl:value-of select="$ant.target"/>
+            object_modeling.Error.Handling = <xsl:value-of select="$object_modeling.Error.Handling"/>
+        </xsl:message>
+        <project basedir="{$basedir}" name="build_object_modeling_new.child" default="build_object_modeling_new.child"
+            xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
+            <xsl:apply-templates mode="system_cache__appinfo:build_object_modeling_new.child"/>
+        </project>
+    </xsl:template>
+    
+    <xsl:template match="system_cache__appinfo:get_all_xsd_default_db[substring-after(schema/@targetNamespace,'://') = substring-after($targetNamespace.base,'://')]" mode="system_cache__appinfo:build_object_modeling_new.child"  xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:message>TNS<xsl:value-of select="schema/@targetNamespace"/> </xsl:message> <!-- [schema/@targetNamespace=$targetNamespace.base] -->
+        <xsl:apply-templates mode="system_cache__appinfo:build_object_modeling_new.child"/>
+    </xsl:template>
+    
+    <xsl:template match="schema" mode="system_cache__appinfo:build_object_modeling_new.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <target name="build_object_modeling_new.child">
+            <xsl:apply-templates mode="system_cache__appinfo:build_object_modeling_new.child"/>
+        </target>
+    </xsl:template>
+    
+    <xsl:template match="element" mode="system_cache__appinfo:build_object_modeling_new.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:choose>
+            <xsl:when test="contains(@name,'_HIST')"/>
+            <xsl:when test="string-length($NamespaceObjectInstanceTable_RegexString.ignore) &gt; 0 and ( contains(@name,$NamespaceObjectInstanceTable_RegexString.ignore) or matches(@name,$NamespaceObjectInstanceTable_RegexString.ignore))">
+                <xsl:message>#41 igroned by $NamespaceObjectInstanceTable_RegexString.ignore : <xsl:value-of select="@name"/></xsl:message>
+            </xsl:when>
+            <xsl:when test="contains(@name,$NamespaceObjectInstanceTable_RegexString) or matches(@name,$NamespaceObjectInstanceTable_RegexString)">
+                <xsl:message>#44 creating ant to build <xsl:value-of select="@name"/> for prototype_object_namespace =<xsl:value-of select="$prototype_object_namespace"/> </xsl:message>
+                <xsl:variable name="new_object_namespace">
+                    <xsl:call-template name="system_cache__appinfo:new_object_namespace">
+                        <xsl:with-param name="TargetNamespace" select="$TargetNamespace"/>
+                        <xsl:with-param name="name" select="@name"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:variable name="new_TargetNamespaceBindings_from_Namespace">
+                    <xsl:call-template name="system_cache__appinfo:TargetNamespaceBindings_from_Namespace">
+                        <xsl:with-param name="TargetNamespace" select="$new_object_namespace"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:message>#44...</xsl:message>
+                
+                
+                <xsl:variable name="sourceSchemaPath" select="concat($object_modeling_new_basedir_repository,'/',$NamespaceDatabaseStorageDefinitionPrefix,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xml')"/>
+                <xsl:variable name="targetSchemaPath" select="concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd')"/>
+                <xsl:message>#44.B..</xsl:message>
+                <!--  ERROR / IGNORE / OVERWRITE / MERGE (todo) -->
+                <xsl:variable name="COPY">
+                    <xsl:choose>
+                        <xsl:when test="  unparsed-text-available($targetSchemaPath)">
+                            <xsl:choose>
+                                <xsl:when test="$object_modeling.Error.Handling='OVERWRITE'">
+                                    <xsl:value-of select="'OVERWRITE'"/>
+                                </xsl:when>
+                                <xsl:when test="$object_modeling.Error.Handling='IGNORE'"/>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:value-of select="'COPY'"/>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:message>#44.C..</xsl:message>
+                <xsl:choose>
+                    <xsl:when test="$COPY='COPY' or $COPY='OVERWRITE'">
+                        <ant>
+                            <xsl:attribute name="antfile" select="$ant.build"/>
+                            <xsl:attribute name="target" select="$ant.target"/>
+                            <property>
+                                <xsl:attribute name="name" select="'NamespaceObjectInstanceTable'"/>
+                                <xsl:attribute name="value" select="@name"/>
+                            </property>
+                            <property>
+                                <xsl:attribute name="name" select="'prototype_object_namespace'"/>
+                                <xsl:attribute name="value" select="$prototype_object_namespace"/>
+                            </property>
+                            <property>
+                                <xsl:attribute name="name" select="'TargetNamespaceBindingsApi'"/>
+                                <xsl:attribute name="value" select="$TargetNamespaceBindingsApi"/>
+                            </property>
+                            <property>
+                                <xsl:attribute name="name" select="'NamespaceDatabaseStorageDefinitionPrefix'"/>
+                                <xsl:attribute name="value" select="$NamespaceDatabaseStorageDefinitionPrefix"/>
+                            </property>
+                            <property>
+                                <xsl:attribute name="name" select="'NamespaceObjectInstanceType'"/>
+                                <xsl:attribute name="value" select="$NamespaceObjectInstanceType"/>
+                            </property>
+                            <property>
+                                <xsl:attribute name="name" select="'targetNamespace.base'"/>
+                                <xsl:attribute name="value" select="$targetNamespace.base"/>
+                            </property>
+                            
+                            
+                            <property>
+                                <xsl:attribute name="name" select="'new_object_namespace'"/>
+                                <xsl:attribute name="value" select="$new_object_namespace"/> <!--  concat($TargetNamespace,'/',@name,'.xsd') -->
+                            </property>
+                            <property>
+                                <xsl:attribute name="name" select="'object_modeling.Error.Handling'"/>
+                                <xsl:attribute name="value" select="$object_modeling.Error.Handling"/> 
+                            </property>
+                            
+                        </ant>
+                        <echo>#135 todo copy - nie potrzebne - savuje object_modeling.xsl</echo>
+                        <!--<copy>
+                            <xsl:attribute name="file" select="$sourceSchemaPath"/>
+                            <xsl:attribute name="tofile" select="$targetSchemaPath"/>
+                        </copy>-->
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <echo>
+                            #153 not copied due to doc-available($targetSchemaPath) <xsl:value-of select="doc-available($targetSchemaPath)"/> in <xsl:value-of select="$targetSchemaPath"/>
+                        </echo>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
+                
+                <!--<ant>
+                   <echo>
+                       object_modeling_new_basedir_repository = ${object_modeling_new_basedir_repository}
+                       copy ($procesy5_system_schema_collection_dir)<xsl:value-of select="$procesy5_system_schema_collection_dir"/>/
+                       ($new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType) <xsl:value-of select="$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType"/>/
+                       ($new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable) <xsl:value-of select="$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable"/>.xsd
+                   </echo>
+                   
+                    
+                </ant>-->
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>#39 not match <xsl:value-of select="@name"/>;</xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template match="*|text()|comment()" mode="system_cache__appinfo:build_object_modeling_new.child"/>
+    
+    
+    
+</xsl:stylesheet>

+ 301 - 16
SE/schema/WPS_Functions/object_modeling_new/build_object_modeling_new.xml

@@ -17,6 +17,9 @@
     <property name="object_modeling_new_basedir_repository" location="${basedir}/WPS_Functions/${ant.project.name}/object_modeling_new_repository"  />
     <property name="object_modeling_new_basedir_temp" location="${object_modeling_new_basedir}/temp"  />
     
+    <property name="build_object_modeling_new.child" location="${object_modeling_new_basedir_temp}/build_object_modeling_new.child.xml"/>
+    <property name="build_object_modeling_new.child.xsl" location="${object_modeling_new_basedir}/build_object_modeling_new.child.xsl"/>
+    
     <property name="build_object_modeling_new.childproperties" location="${WPS_Functions.childproperties}/build_object_modeling_new.properties"/>
     
     <!--<property name="public_html" location="${basedir}" />-->
@@ -47,8 +50,7 @@
         <tempfile property="new_object_by_prototype_result.xml" prefix="new_object_by_prototype_result" suffix=".xml" destdir="${object_modeling_new_basedir_temp}"/>
         <tempfile property="object_modeling_new_in_schema_check.xml" prefix="object_modeling_new_in_schema_check" suffix=".xml" destdir="${object_modeling_new_basedir_temp}"/>
         
-        <property name="template_object.xml_location" value="${object_modeling_new_basedir_repository}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}/${NamespaceObjectInstanceTable}"/>
-        <property name="template_object.xml_location.xml" value="${template_object.xml_location}.xml"/>
+        
     </target>
     
     <target name="clean" description="Clean all output and temp files">
@@ -64,7 +66,7 @@
         <input addproperty="NamespaceObjectInstanceType" defaultvalue="table"/>
         <input addproperty="NamespaceObjectInstanceTable" /> <!-- example CRM_PROCES -->
         <!--<input addproperty="new_object_namespace" defaultvalue="${TargetNamespaceBindingsApi}/${$NamespaceDatabaseStorageDefinitionPrefix}/${$NamespaceObjectInstanceTable}.xsd" />--> <!-- https://biuro.biall-net.pl/wfs/default_db/table/Rozdzielcza_struktura_wewnetrzna_wsg84.xsd -->
-         
+        <antcall target="template_object.xml_location.xml"/>
         <condition taskname="system_cache__appinfo:object_modeling_new_check_ok" property="system_cache__appinfo:object_modeling_new_check">
             <available file="${template_object.xml_location.xml}"/>
         </condition>
@@ -74,16 +76,21 @@
     </target>
     
     
-        
+    <target name="template_object.xml_location.xml" >
+        <property name="template_object.xml_location" value="${object_modeling_new_basedir_repository}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}/${NamespaceObjectInstanceTable}"/>
+        <property name="template_object.xml_location.xml" value="${template_object.xml_location}.xml"/>
+        <echo> #82 $template_object.xml_location.xml = ${template_object.xml_location.xml}</echo>
+    </target>    
     
-    <target name="system_cache__appinfo:object_modeling_new_in_schema_check_condition" depends="read_build_properties" description="To check if such object exists in schema">
+    <target name="system_cache__appinfo:object_modeling_new_in_schema_check_condition" depends="read_build_properties,template_object.xml_location.xml" description="To check if such object exists in schema">
         <input addproperty="TargetNamespaceBindingsApi" defaultvalue="https://biuro.biall-net.pl/wfs"/> <!-- root namespace API -->
         <input addproperty="NamespaceDatabaseStorageDefinitionPrefix" defaultvalue="default_db"/>
         <input addproperty="NamespaceObjectInstanceType" defaultvalue="table"/>
         <input addproperty="NamespaceObjectInstanceTable" /> <!-- example CRM_PROCES -->
+        <!--<antcall target="template_object.xml_location.xml"/>-->
         <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml_if_not_exists" />
         
-        <echo> object_modeling_new_basedir_repository= ${object_modeling_new_basedir_repository}
+        <echo>#89 object_modeling_new_basedir_repository= ${object_modeling_new_basedir_repository}
             procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
             TargetNamespaceBindingsApi ${TargetNamespaceBindingsApi}
             NamespaceDatabaseStorageDefinitionPrefix ${NamespaceDatabaseStorageDefinitionPrefix}
@@ -108,6 +115,8 @@
             <param name="object_modeling_new_basedir_repository" expression="${object_modeling_new_basedir_repository}"/>
             <param name="procesy5_system_schema_collection_dir" expression="${basedir}"/>
             <param name="external_schema_table.path" expression="${external_schema_table.path}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
+            <param name="default_db.instance.xml" expression="${default_db.instance.xml}"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
         </xslt>
         <loadfile property="object_modeling_new_in_schema_check.xml.loadfile" srcfile="${object_modeling_new_in_schema_check.xml}"/>
@@ -135,12 +144,15 @@
     
     <target name="system_cache__appinfo:object_modeling_new" depends="read_build_properties,system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check" description="ANT_TARGET new object by using prototype from Types to local repository to model it further" >
         <input addproperty="prototype_object_namespace" defaultvalue="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd" />
-        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml_if_not_exists" />
-        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>
-        <echo> object_modeling_new_basedir_repository= ${object_modeling_new_basedir_repository}
+        
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema"/> <!-- or system_cache__appinfo:default_db_get_xml_schema_if_not_exists -->
+        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml" />
+        
+        
+        <echo>#148 object_modeling_new_basedir_repository= ${object_modeling_new_basedir_repository}
             procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
             generating from ${prototype_object_namespace}
-            generating to ${new_object_namespace}
+            <!--generating to ${new_object_namespace}-->
         </echo>
         
         <xslt basedir="./" style="${object_modeling_new.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${new_object_by_prototype_result.xml}" >
@@ -166,8 +178,218 @@
     
     
     
+    <target name="system_cache__appinfo:object_modeling_new.build_Infrastructure" depends="read_build_properties" description="ANT_TARGET @2017-12-19 dobrze zrobilo prototypy z infrastr + brakujace elementy + simpleTYpe z default.db. new object by using prototype from Types with merging using regex select and igronre" >
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>
+        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml" />
+        
+        <property name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/infrastructure.xsd"/>
+        <property name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
+        <property name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
+        <property name="NamespaceObjectInstanceType" value="table"/>
+        <property name="NamespaceObjectInstanceTable_RegexString.ignore" value="(.*temp.*)|(Rozdzielcza_test.*)|(__RAPORT_Rozdzielcza_)"/>
+        <property name="NamespaceObjectInstanceTable_RegexString" value="(.*ozdzielcza_.*)|(TELBOXES)"/> <!-- ozdzielcza_ (.*ozdzielcza_.*)|(TELBOXES) -->
+        <property name="targetNamespace.base" value="${targetNamespace_DEFAULTS}"/> <!-- which source schema to use (currently force to ${default_db.xml} )-->
+        <property name="build_object_modeling_build_infrastructure_child.xml" value="${object_modeling_build_infrastructure_basedir.temp}/build_object_modeling_build_infrastructure_child.xml"/>
+        
+        <property name="object_modeling.Error.Handling" value="OVERWRITE"/>
+        
+        <echo>#196
+            object_modeling_new_basedir= ${object_modeling_new_basedir};
+            procesy5_system_schema.xml = ${procesy5_system_schema.xml}; 
+            default_db.xml = ${default_db.xml};
+            NamespaceObjectInstanceTable_RegexString = ${NamespaceObjectInstanceTable_RegexString}
+            NamespaceObjectInstanceTable_RegexString.ignore = ${NamespaceObjectInstanceTable_RegexString.ignore}
+            TargetNamespace" ${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}
+            prototype_object_namespace = ${prototype_object_namespace}
+            targetNamespace.base = ${targetNamespace.base}
+            object_modeling_new = ${object_modeling_new} <!-- location="${basedir}/WPS_Functions/object_modeling_new/build_object_modeling_new.xml" -->
+            basedir = ${basedir} <!-- one level deeper -->
+            TargetNamespaceBindingsApi = ${TargetNamespaceBindingsApi}
+            NamespaceDatabaseStorageDefinitionPrefix = ${NamespaceDatabaseStorageDefinitionPrefix}
+            NamespaceObjectInstanceType = ${NamespaceObjectInstanceType}
+            ant.target = system_cache__appinfo:object_modeling_new_by_xml_schema
+            object_modeling.Error.Handling = ${object_modeling.Error.Handling}
+            external_schema_table.path = ${external_schema_table.path}
+            procesy5_system_schema_collection_dir = ${basedir}
+            object_modeling_new_basedir_repository = ${object_modeling_new_basedir_repository}
+            default_db.instance.xml = ${default_db.instance.xml}
+            
+        </echo>
+        
+        
+        <xslt basedir="./" style="${build_object_modeling_new.child.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${build_object_modeling_new.child}" force="yes" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}build_object_modeling_new.child"/>
+            </factory>
+            <param name="NamespaceObjectInstanceTable_RegexString" expression="${NamespaceObjectInstanceTable_RegexString}"/>
+            <param name="NamespaceObjectInstanceTable_RegexString.ignore" expression="${NamespaceObjectInstanceTable_RegexString.ignore}"/>
+            <param name="TargetNamespace" expression="${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}"/>
+            <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
+            
+            <param name="basedir" expression="${basedir}"/> <!-- one level deeper -->
+            <param name="TargetNamespaceBindingsApi" expression="${TargetNamespaceBindingsApi}"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" expression="${NamespaceDatabaseStorageDefinitionPrefix}"/>
+            <param name="NamespaceObjectInstanceType" expression="${NamespaceObjectInstanceType}"/>
+            <param name="ant.build" expression="${object_modeling_build}"/>
+            <param name="ant.target" expression="system_cache__appinfo:new_object_by_prototype"/>
+            <!--<param name="ant.build" expression="${object_modeling_new}"/>--> <!-- location="${basedir}/WPS_Functions/object_modeling_new/build_object_modeling_new.xml" -->
+            <!--<param name="ant.target" expression="system_cache__appinfo:object_modeling_new_by_xml_schema"/>-->
+            
+            <param name="object_modeling.Error.Handling" expression="${object_modeling.Error.Handling}"/>
+            <param name="external_schema_table.path" expression="${external_schema_table.path}"/>
+            <param name="procesy5_system_schema_collection_dir" expression="${basedir}"/>
+            <param name="object_modeling_new_basedir_repository" expression="${object_modeling_new_basedir_repository}"/>
+            <param name="default_db.instance.xml" expression="${default_db.instance.xml}"/>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+        </xslt>
+        <!--<loadfile property="new_object_by_prototype.xml_result" srcfile="${new_object_by_prototype.xml}"/>
+        <echo message="${new_object_by_prototype.xml_result}"/>-->
+        <ant antfile="${build_object_modeling_new.child}"/>
+    </target>
+    
+    
+    
+    
+    <target name="system_cache__appinfo:object_modeling_new.build_default" depends="read_build_properties" description="ANT_TARGET new object by using prototype from Types with merging using regex select and igronre" >
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>
+        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml" />
+        
+        <property name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"/>
+        <property name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
+        <property name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
+        <property name="NamespaceObjectInstanceType" value="table"/>
+        <property name="NamespaceObjectInstanceTable_RegexString.ignore" value="(bravecare__sys_users)|(^_.*)|(ITEM_LINK_TYPES)|(F_ID)|(F_GID.*)|(D_P)|(COLUMNS)|(BI_audit_KW_requested_person_copy)|(.*.copy_energa.*)|(BI_audit_ENERGA_RUM_KONTRAHENCI_copy)|(.*energa_copy.*)|(BI_audit_ALL.*)|(BILLING_USERS_OLD)|(BILLING_USERS_ADD_OLD)|(AUTOSHAPE.*)|(ATTACHMENTS)|(ADMIN_USERS__REF__LOCAL_EMAIL)|(.*to_delete.*)|(.*temp.*)|(tmp.*)|(.*test.*)|(.*otomin.*)|(.*kasacja.*)|(.*default_default_objects.*)|(.*arskom.*)|(.*aneksy.*)|(ams.*)|(.*zasob_path_idx.*)|($_.*)|(s2sua)|(seq)|(stats_BILLS_FVAT_POS)|(phone)|(_remote_L1_BILLS_KP)|(_project_path_idx)|(__RAPORT_Rozdzielcza_Raport)|(.*TEMP.*)|(.*_SYNC_.*)|(.*_backup_.*)|(.*__INSTANCE_CLOSURE.*)|(CRM_LISTA_ZASOBOW_tree)|(.*_idx.*)|(.*_prim.*)|(CRM_REF_CONFIG)|(F_AREA.*)|($F_.*)|(ID_OFFERS)|(IN7_CECHY)|(.*_TEST_.*)|(IN7_PRODUKTY_CECHY)|(INDEKS24)|(INVENTORY)|(ITEM_LINKS.*)|(LDAP_GROUPS)|(.*_old.*)|(stats_BILLS_FVAT_POS)|(ozdzielcz.*)"/>
+        <property name="NamespaceObjectInstanceTable_RegexString" value=".*"/> <!-- ozdzielcza_ -->
+        <property name="targetNamespace.base" value="${targetNamespace_DEFAULTS}"/> <!-- which source schema to use (currently force to ${default_db.xml} )-->
+        <property name="build_object_modeling_build_infrastructure_child.xml" value="${object_modeling_build_infrastructure_basedir.temp}/build_object_modeling_build_infrastructure_child.xml"/>
+        
+        <property name="object_modeling.Error.Handling" value="IGNORE"/>
+        
+        <echo> object_modeling_new_basedir= ${object_modeling_new_basedir};
+            procesy5_system_schema.xml= ${procesy5_system_schema.xml}; 
+            default_db.xml= ${default_db.xml};
+            NamespaceObjectInstanceTable_RegexString = ${NamespaceObjectInstanceTable_RegexString}
+        </echo>
+        
+        
+        <xslt basedir="./" style="${build_object_modeling_new.child.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${build_object_modeling_new.child}" force="yes" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}build_object_modeling_new.child"/>
+            </factory>
+            <param name="NamespaceObjectInstanceTable_RegexString" expression="${NamespaceObjectInstanceTable_RegexString}"/>
+            <param name="NamespaceObjectInstanceTable_RegexString.ignore" expression="${NamespaceObjectInstanceTable_RegexString.ignore}"/>
+            <param name="TargetNamespace" expression="${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}"/>
+            <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
+            
+            <param name="basedir" expression="${basedir}"/> <!-- one level deeper -->
+            <param name="TargetNamespaceBindingsApi" expression="${TargetNamespaceBindingsApi}"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" expression="${NamespaceDatabaseStorageDefinitionPrefix}"/>
+            <param name="NamespaceObjectInstanceType" expression="${NamespaceObjectInstanceType}"/>
+            <param name="ant.build" expression="${object_modeling_build}"/>
+            <param name="ant.target" expression="system_cache__appinfo:new_object_by_prototype"/>
+            <!--<param name="ant.build" expression="${object_modeling_new}"/>--> <!-- location="${basedir}/WPS_Functions/object_modeling_new/build_object_modeling_new.xml" -->
+            <!--<param name="ant.target" expression="system_cache__appinfo:object_modeling_new_by_xml_schema"/>-->
+            
+            <param name="object_modeling.Error.Handling" expression="${object_modeling.Error.Handling}"/>
+            <param name="external_schema_table.path" expression="${external_schema_table.path}"/>
+            <param name="procesy5_system_schema_collection_dir" expression="${basedir}"/>
+            <param name="object_modeling_new_basedir_repository" expression="${object_modeling_new_basedir_repository}"/>
+            <param name="default_db.instance.xml" expression="${default_db.instance.xml}"/>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+        </xslt>
+        <!--<loadfile property="new_object_by_prototype.xml_result" srcfile="${new_object_by_prototype.xml}"/>
+        <echo message="${new_object_by_prototype.xml_result}"/>-->
+        <ant antfile="${build_object_modeling_new.child}" inheritall="false"/>
+    </target>
+    
+    
+    
+    
+    
+    <target name="system_cache__appinfo:object_modeling_new.build_Empty" depends="read_build_properties" description="ANT_TARGET @2017-12-19 dobrze zrobilo prototypy z infrastr + brakujace elementy + simpleTYpe z default.db. new object by using prototype from Types with merging using regex select and igronre" >
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema_if_not_exists"/>
+        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml" />
+        
+        <property name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"/>
+        <property name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
+        <property name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
+        <property name="NamespaceObjectInstanceType" value="table"/>
+        <property name="NamespaceObjectInstanceTable_RegexString.ignore" value="(bravecare__sys_users)|(^_.*)|(ITEM_LINK_TYPES)|(F_ID)|(F_GID.*)|(D_P)|(COLUMNS)|(BI_audit_KW_requested_person_copy)|(.*.copy_energa.*)|(BI_audit_ENERGA_RUM_KONTRAHENCI_copy)|(.*energa_copy.*)|(BI_audit_ALL.*)|(BILLING_USERS_OLD)|(BILLING_USERS_ADD_OLD)|(AUTOSHAPE.*)|(ATTACHMENTS)|(ADMIN_USERS__REF__LOCAL_EMAIL)|(.*to_delete.*)|(.*temp.*)|(tmp.*)|(.*test.*)|(.*otomin.*)|(.*kasacja.*)|(.*default_default_objects.*)|(.*arskom.*)|(.*aneksy.*)|(ams.*)|(.*zasob_path_idx.*)|($_.*)|(s2sua)|(seq)|(stats_BILLS_FVAT_POS)|(phone)|(_remote_L1_BILLS_KP)|(_project_path_idx)|(__RAPORT_Rozdzielcza_Raport)|(.*TEMP.*)|(.*_SYNC_.*)|(.*_backup_.*)|(.*__INSTANCE_CLOSURE.*)|(CRM_LISTA_ZASOBOW_tree)|(.*_idx.*)|(.*_prim.*)|(CRM_REF_CONFIG)|(F_AREA.*)|($F_.*)|(ID_OFFERS)|(IN7_CECHY)|(.*_TEST_.*)|(IN7_PRODUKTY_CECHY)|(INDEKS24)|(INVENTORY)|(ITEM_LINKS.*)|(LDAP_GROUPS)|(.*_old.*)|(stats_BILLS_FVAT_POS)|(ozdzielcz.*)"/>
+        <property name="NamespaceObjectInstanceTable_RegexString" value=".*"/> <!-- ozdzielcza_ (ozdzielcza_)|(TELBOXES) -->
+        <property name="targetNamespace.base" value="${targetNamespace_DEFAULTS}"/> <!-- which source schema to use (currently force to ${default_db.xml} )-->
+        <property name="build_object_modeling_build_infrastructure_child.xml" value="${object_modeling_build_infrastructure_basedir.temp}/build_object_modeling_build_infrastructure_child.xml"/>
+        <property name="object_modeling.Error.Handling" value="IGNORE"/>
+        
+        <echo>#196
+            object_modeling_new_basedir= ${object_modeling_new_basedir};
+            procesy5_system_schema.xml = ${procesy5_system_schema.xml}; 
+            default_db.xml = ${default_db.xml};
+            NamespaceObjectInstanceTable_RegexString = ${NamespaceObjectInstanceTable_RegexString}
+            NamespaceObjectInstanceTable_RegexString.ignore = ${NamespaceObjectInstanceTable_RegexString.ignore}
+            TargetNamespace" ${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}
+            prototype_object_namespace = ${prototype_object_namespace}
+            targetNamespace.base = ${targetNamespace.base}
+            object_modeling_new = ${object_modeling_new} <!-- location="${basedir}/WPS_Functions/object_modeling_new/build_object_modeling_new.xml" -->
+            basedir = ${basedir} <!-- one level deeper -->
+            TargetNamespaceBindingsApi = ${TargetNamespaceBindingsApi}
+            NamespaceDatabaseStorageDefinitionPrefix = ${NamespaceDatabaseStorageDefinitionPrefix}
+            NamespaceObjectInstanceType = ${NamespaceObjectInstanceType}
+            ant.target = system_cache__appinfo:object_modeling_new_by_xml_schema
+            object_modeling.Error.Handling = ${object_modeling.Error.Handling}
+            external_schema_table.path = ${external_schema_table.path}
+            procesy5_system_schema_collection_dir = ${basedir}
+            object_modeling_new_basedir_repository = ${object_modeling_new_basedir_repository}
+            default_db.instance.xml = ${default_db.instance.xml}
+            
+        </echo>
+        
+        
+        <xslt basedir="./" style="${build_object_modeling_new.child.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${build_object_modeling_new.child}" force="yes" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}build_object_modeling_new.child"/>
+            </factory>
+            <param name="NamespaceObjectInstanceTable_RegexString" expression="${NamespaceObjectInstanceTable_RegexString}"/>
+            <param name="NamespaceObjectInstanceTable_RegexString.ignore" expression="${NamespaceObjectInstanceTable_RegexString.ignore}"/>
+            <param name="TargetNamespace" expression="${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}"/>
+            <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
+            
+            <param name="basedir" expression="${basedir}"/> <!-- one level deeper -->
+            <param name="TargetNamespaceBindingsApi" expression="${TargetNamespaceBindingsApi}"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" expression="${NamespaceDatabaseStorageDefinitionPrefix}"/>
+            <param name="NamespaceObjectInstanceType" expression="${NamespaceObjectInstanceType}"/>
+            <param name="ant.build" expression="${object_modeling_build}"/>
+            <param name="ant.target" expression="system_cache__appinfo:new_object_by_prototype"/>
+            <!--<param name="ant.build" expression="${object_modeling_new}"/>--> <!-- location="${basedir}/WPS_Functions/object_modeling_new/build_object_modeling_new.xml" -->
+            <!--<param name="ant.target" expression="system_cache__appinfo:object_modeling_new_by_xml_schema"/>-->
+            
+            <param name="object_modeling.Error.Handling" expression="${object_modeling.Error.Handling}"/>
+            <param name="external_schema_table.path" expression="${external_schema_table.path}"/>
+            <param name="procesy5_system_schema_collection_dir" expression="${basedir}"/>
+            <param name="object_modeling_new_basedir_repository" expression="${object_modeling_new_basedir_repository}"/>
+            <param name="default_db.instance.xml" expression="${default_db.instance.xml}"/>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+        </xslt>
+        <!--<loadfile property="new_object_by_prototype.xml_result" srcfile="${new_object_by_prototype.xml}"/>
+        <echo message="${new_object_by_prototype.xml_result}"/>-->
+        <ant antfile="${build_object_modeling_new.child}"/>
+    </target>
+    
     
-    <target name="test_hand_usage_modeling_new" description="To use it manually and edit to create object and development testing">
+    
+    
+    
+    <!-- cannot do depends="read_build_properties" -->
+    <target name="test_hand_usage_modeling_new"  depends="read_build_properties"   description="To use it manually and edit to create object and development testing">
+           
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema"/> <!-- or system_cache__appinfo:default_db_get_xml_schema_if_not_exists -->
+        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml" />
+        
         <!--<antcall target="system_cache__appinfo:object_modeling_new">
             <param name="NamespaceObjectInstanceTable" value="CRM_IMAGE"/>
             <param name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"/>
@@ -409,19 +631,53 @@
             <param name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
             <param name="NamespaceObjectInstanceType" value="table"/>
         </antcall>-->
-        <antcall target="system_cache__appinfo:object_modeling_new_by_xml_schema">
+        <!--<antcall target="system_cache__appinfo:object_modeling_new_by_xml_schema">
             <param name="NamespaceObjectInstanceTable" value="BI_audit_operational_raport_note"/>
             <param name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"/>
             <param name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
             <param name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
             <param name="NamespaceObjectInstanceType" value="table"/>
+        </antcall>-->
+        <!--<antcall target="system_cache__appinfo:object_modeling_new_by_xml_schema">
+            <param name="NamespaceObjectInstanceTable" value="USERS2_MARKETING"/>
+            <param name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"/>
+            <param name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
+            <param name="NamespaceObjectInstanceType" value="table"/>
+        </antcall>-->
+        
+        <!--<antcall target="system_cache__appinfo:object_modeling_new_by_xml_schema">
+            <param name="NamespaceObjectInstanceTable" value="ACCESS_REQUESTS"/>
+            <param name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd"/>
+            <param name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
+            <param name="NamespaceObjectInstanceType" value="table"/>
+            <param name="targetNamespace.base" value="https://biuro.biall-net.pl/xmlschema_procesy5/default_db"/>
+        </antcall>-->
+        
+        <echo>targetNamespace_DEFAULTS to ${targetNamespace_DEFAULTS}</echo>
+        <echo>targetNamespace.base to ${targetNamespace.base}</echo>
+       
+        
+        <antcall target="system_cache__appinfo:object_modeling_new_by_xml_schema">
+            <param name="NamespaceObjectInstanceTable" value="Rozdzielcza_Kabel_swiatl_obcy"/>
+            <param name="prototype_object_namespace" value="https://biuro.biall-net.pl/wfs/default_db/Types/infrastructure.xsd"/>
+            <param name="TargetNamespaceBindingsApi" value="https://biuro.biall-net.pl/wfs"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" value="default_db"/>
+            <param name="NamespaceObjectInstanceType" value="table"/>
+            <param name="targetNamespace.base" value="https://biuro.biall-net.pl/xmlschema_procesy5/default_db"/>
         </antcall>
         
         
+        
+        
     </target>
     
     
     
+    
+    
+    
     <!--TODO TO TEST FIX ETC-->
     <target  name="system_cache__appinfo:object_modeling_new_add_new_table"  depends="read_build_properties,system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check" description="TODO Create new schema (empty table - not working currently)">
         <input addproperty="TargetNamespaceBindingsApi" defaultvalue="https://biuro.biall-net.pl/wfs"/> <!-- root namespace API -->
@@ -451,6 +707,7 @@
             <param name="template_object.xml_location" expression="${template_object.xml_location.xml}"/>
             <param name="object_modeling_new_basedir_repository" expression="${object_modeling_new_basedir_repository}"/>
             <param name="procesy5_system_schema_collection_dir" expression="${basedir}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
         </xslt>
     </target>
@@ -458,13 +715,39 @@
     <!-- depends="system_cache__appinfo:object_modeling_new" test off -->
     <target  name="system_cache__appinfo:object_modeling_new_by_xml_schema" depends="read_build_properties,system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check"   description="TESTING Create new schema based on default_db.xml(xsd) + prototype">
         <input addproperty="prototype_object_namespace" defaultvalue="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd" />
-        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml_if_not_exists" />
-        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema"/> <!-- or system_cache__appinfo:default_db_get_xml_schema_if_not_exists -->
-        <echo> object_modeling_new_basedir_repository= ${object_modeling_new_basedir_repository}
+        <input addproperty="NamespaceDatabaseStorageDefinitionPrefix" defaultvalue="default_db" />
+        <antcall target="template_object.xml_location.xml" inheritall="yes" inheritrefs="yes"/>
+        <!--   
+        <ant antfile="${build_object_modeling_by_default_db_xml_schema.xml}" target="system_cache__appinfo:default_db_get_xml_schema"/> <!-\- or system_cache__appinfo:default_db_get_xml_schema_if_not_exists -\->
+        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml" />
+        -->
+        <echo>#615 
+            
+            object_modeling_new_basedir_repository= ${object_modeling_new_basedir_repository}
             procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
             generating from ${prototype_object_namespace}
-            generating to ${new_object_namespace}
+            $NamespaceDatabaseStorageDefinitionPrefix = ${NamespaceDatabaseStorageDefinitionPrefix}
+            $NamespaceObjectInstanceType = ${NamespaceObjectInstanceType}
+            $template_object.xml_location.xml = ${template_object.xml_location.xml}
+            
+            prototype_object_namespace" expression="${prototype_object_namespace}
+            TargetNamespaceBindingsApi" expression="${TargetNamespaceBindingsApi}
+            NamespaceDatabaseStorageDefinitionPrefix" expression="${NamespaceDatabaseStorageDefinitionPrefix}
+            NamespaceObjectInstanceType" expression="${NamespaceObjectInstanceType}
+            NamespaceObjectInstanceTable" expression="${NamespaceObjectInstanceTable}
+            template_object.xml_location" expression="${template_object.xml_location.xml}
+            object_modeling_new_basedir_repository" expression="${object_modeling_new_basedir_repository}
+            procesy5_system_schema_collection_dir" expression="${basedir}
+            default_db.xml" expression="${default_db.xml}
+            targetNamespace.base" expression="${targetNamespace.base}
+            external_schema_table.path" expression="${external_schema_table.path}
+            default_db.instance.xml" expression="${default_db.instance.xml}
+            object_modeling_new ${object_modeling_new}
+            
+            
+            <!--generating to ${new_object_namespace}-->
         </echo>
+        
         <xslt basedir="./" style="${object_modeling_new_by_xml_schema.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${new_object_by_prototype_result.xml}" >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
@@ -479,7 +762,9 @@
             <param name="object_modeling_new_basedir_repository" expression="${object_modeling_new_basedir_repository}"/>
             <param name="procesy5_system_schema_collection_dir" expression="${basedir}"/>
             <param name="default_db.xml" expression="${default_db.xml}"/>
+            <param name="targetNamespace.base" expression="${targetNamespace.base}"/>
             <param name="external_schema_table.path" expression="${external_schema_table.path}"/>
+            <param name="default_db.instance.xml" expression="${default_db.instance.xml}"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
         </xslt>
         <loadfile property="new_object_by_prototype_result.xml_loadfile" srcfile="${new_object_by_prototype_result.xml}"/>

+ 4 - 9
SE/schema/WPS_Functions/stock_optimize_calculations_raszczyk/build_stock_optimize_calculations_raszczyk.xml

@@ -66,10 +66,11 @@
         </ant>
     </target>
     
-    <target name="build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.xml" depends="clean,read_build_properties,system_cache__appinfo:build_stock_optimize_calculations_raszczyk.create_tempdir" description="import from csv files koszty wytworzenia">
+    <target name="build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.xml" depends="clean,read_build_properties,system_cache__appinfo:build_stock_optimize_calculations_raszczyk.create_tempdir,from_csv_2_xml" description="import from csv files koszty wytworzenia">
         <loadfile encoding="utf-8" property="build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.csv.content" srcfile="${build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.csv}"/>
-        <echoxml file="${build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.xml}" namespacepolicy="all">
-            <koszty_wytworzenia.csv xmlns="build_stock_optimize_calculations_raszczyk">
+        <delete file="${build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.xml}"/>
+        <echoxml file="${build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.xml}" namespacepolicy="all" >
+                <koszty_wytworzenia.csv xmlns="build_stock_optimize_calculations_raszczyk" > <!-- xmlns="build_stock_optimize_calculations_raszczyk" -->
                 ${build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.csv.content}
             </koszty_wytworzenia.csv>
         </echoxml>
@@ -98,8 +99,6 @@
     <!-- depends="from_xsl_2_xml" -->
   
     <target name="stock_optimize_calculations_raszczyk"  depends="read_build_properties,from_xsl_2_xml,build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.koszty_wytworzenia.xml" description="to be moved to ant moving txt file surrounding with xml">
-        
-        
         <xslt basedir="${build_stock_optimize_calculations_raszczyk.basedir.temp}" style="${stock_optimize_calculations_raszczyk.xsl}" in="${build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow.xml}"   out="${build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow_fix.xml}" force="true" >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
@@ -111,11 +110,7 @@
             <!--<param name="Types__x3A__xlsx__x3A__unzipped_xlsx" expression="${build_stock_optimize_calculations_raszczyk.basedir.temp}"/>-->
             <!--<param name="Types__x3A__xlsx__x3A__unzipped_xlsx" expression="${basedir}/${poprawione_obszary_xml_dir}"/>-->
         </xslt>
-        
-        
         <move file="${build_stock_optimize_calculations_raszczyk.basedir.analiza_sklepow_fix.xml}" todir="${default_db:recurse_ant_basedir.out}" overwrite="true"/>
-        
-        
     </target>
 
   

+ 350 - 74
SE/schema/WPS_Functions/stock_optimize_calculations_raszczyk/stock_optimize_calculations_raszczyk.xsl

@@ -3,6 +3,7 @@
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:Types__x3A__xlsx="https://biuro.biall-net.pl/wfs/default_db/Types/xlsx.xsd"
     xmlns:build_stock_optimize_calculations_raszczyk="build_stock_optimize_calculations_raszczyk"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
     exclude-result-prefixes="xs"
     version="2.0">
     
@@ -11,6 +12,8 @@
     <xsl:strip-space elements="*"/>
     <!-- do parsowania xslx z naszej stajni -->
     
+    <xsl:include href="../../default_db_xml_cache.public/default_db/big_values_format.xsl"/>
+    
     <xsl:param name="build_stock_optimize_calculations_raszczyk:koszty_wytworzenia.csv" required="yes"/> <!-- it is csv file to be parsed -->
     
     <xsl:variable name="build_stock_optimize_calculations_raszczyk:koszty_wytworzenia.csv.xml" select="doc($build_stock_optimize_calculations_raszczyk:koszty_wytworzenia.csv)"/>
@@ -22,13 +25,41 @@
     
     <xsl:variable name="cennik_2_sheet_name">
         <cennik_2_sheet_name>
-            <sheet_source sheet_name="spacerowa">leclerc GD</sheet_source>
-            <sheet_source sheet_name="nowowiejska">leclerc GD</sheet_source>
-            <sheet_source sheet_name="Żeromskiego">leclerc GD</sheet_source>
-            <sheet_source sheet_name="polanki">leclerc GD</sheet_source>
+            <sheet_source sheet_name="spacerowa">real Gdynia</sheet_source>
+            <sheet_source sheet_name="nowowiejska">real Gdynia</sheet_source>
+            <sheet_source sheet_name="Żeromskiego">real Gdynia</sheet_source>
+            <sheet_source sheet_name="polanki">real Gdynia</sheet_source>
+            <sheet_source sheet_name="leclerc GD">real Gdynia</sheet_source>
         </cennik_2_sheet_name>
     </xsl:variable>
     
+    <xsl:variable name="aleksander_raport_order">
+        <aleksander_raport_order>
+            <sheet_source sheet_name="leclerc GD">Leclerc GD</sheet_source>
+            <sheet_source sheet_name="gospody">Gospody</sheet_source>
+            <sheet_source sheet_name="pomorska">Pomorska</sheet_source>
+            <sheet_source sheet_name="alfa centrum">Alfa</sheet_source>
+            <sheet_source sheet_name="real Gdynia">Real</sheet_source>
+            <sheet_source sheet_name="NDG NETTO">Nowy Dwór</sheet_source>
+            <sheet_source sheet_name="nowowiejska">Nowowiejska 2</sheet_source>
+            <!--<sheet_source sheet_name="">Hynka</sheet_source> - brak hynka?-->
+            <sheet_source sheet_name="niepodległosci sopot">Sopot</sheet_source>
+            <!--<sheet_source sheet_name="">Stegna</sheet_source> brak arkusza-->
+            <!--<sheet_source sheet_name="">Iława</sheet_source>-->
+            <sheet_source sheet_name="maja 52">Maja 52</sheet_source>
+            <sheet_source sheet_name="maja 2">Maja 2</sheet_source>
+            <sheet_source sheet_name="teatralna">Teatralna</sheet_source>
+            <sheet_source sheet_name="brzozowa">Brzozowa</sheet_source>
+            <!--<sheet_source sheet_name="">Ogrody</sheet_source> brak arkusza-->
+            <sheet_source sheet_name="ogrodowa">Ogrodowa</sheet_source>
+            <sheet_source sheet_name="bankowa">Bankowa</sheet_source>
+            <sheet_source sheet_name="spacerowa">Spacerowa</sheet_source>
+            <sheet_source sheet_name="polanki">Polanki</sheet_source>
+            <sheet_source sheet_name="Żeromskiego">Żeromskiego</sheet_source>
+            
+        </aleksander_raport_order>
+    </xsl:variable>
+    
     
     <xsl:template match="Types__x3A__xlsx:main">
         
@@ -63,11 +94,11 @@
                 
                  
                 <xsl:result-document href="temp/raszczyk_row_prod_local_sum">
-                    <xsl:copy-of select="$raszczyk_row_prod_local_sum"></xsl:copy-of>
+                    <xsl:copy-of select="$raszczyk_row_prod_local_sum"/>
                 </xsl:result-document>
                 <!--<xsl:copy-of select="$raszczyk_row_prod_local_sum"/>-->
                  
-                <xsl:apply-templates mode="raszczyk_row_prod_local_sum.errors" select="$raszczyk_row_prod_local_sum"/>
+                
                  
                <!-- <topic id="topic_tabele_efektywnosci_4bb{generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
@@ -78,6 +109,9 @@
                         </p>
                     </body>-->
                     <xsl:apply-templates mode="SKLEPY_EFEKTYWNOSC_TABELE" select="$raszczyk_row_prod_local_sum"/>
+                
+                <xsl:apply-templates mode="raszczyk_row_prod_local_sum.errors" select="$raszczyk_row_prod_local_sum"/>
+                
                 <!--</topic>-->
                  
                  <!--<topic id="topic_x5j_mrk_4bb{generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -110,6 +144,7 @@
     
     <xsl:template match="row[  lower-case(normalize-space(Nazwa)) =  lower-case(normalize-space(Grupa)) ]" mode="raszczyk_row_prod_local_sum">
         <xsl:message>#77 group ignored <xsl:value-of select="Grupa"/> = <xsl:value-of select="Nazwa"/></xsl:message>
+        <xsl:comment>#77 group ignored <xsl:value-of select="Grupa"/> = <xsl:value-of select="Nazwa"/></xsl:comment>
     </xsl:template> <!-- ignore groups -->
     
     
@@ -175,7 +210,7 @@
         <xsl:variable name="Cena">
             <xsl:choose>
                 <xsl:when test=" string-length($Cena)  &lt; 1 ">
-                    <xsl:message>#178 Nie bylo ceny na <xsl:value-of select="Nazwa"/> w cenniku doscelowym - ustalam cene x2 <xsl:value-of select="Cena * 2"/> </xsl:message>
+                    <xsl:message>#178 w sheet:<xsl:value-of select=".././@sheet_name"/>; (<xsl:value-of select="@sheet_name"/>; ) row:<xsl:value-of select="@r"/>; Nie bylo ceny na <xsl:value-of select="Nazwa"/> w cenniku docelowym - ustalam cene x2 (<xsl:value-of select="Cena"/>* 2 )</xsl:message>
                     <xsl:value-of select="Cena * 2"/>
                 </xsl:when>
                 <xsl:otherwise><xsl:value-of select="$Cena"/></xsl:otherwise>
@@ -183,6 +218,7 @@
         </xsl:variable>
         
         <xsl:message>#166 ustalam cene na <xsl:value-of select="$Cena"/> - oryg <xsl:value-of select="Cena"/></xsl:message>
+        <xsl:comment>#166 ustalam cene na <xsl:value-of select="$Cena"/> - oryg <xsl:value-of select="Cena"/></xsl:comment>
         <row><xsl:copy-of select="@*"/>
         <xsl:apply-templates mode="raszczyk_row_prod_local_sum"/>
         <xsl:element name="wynik">
@@ -524,11 +560,11 @@
                                     <xsl:variable name="sheet_name_group" select="current-group()"/>
                                     <xsl:for-each select="$Grupy/Grupy/Grupa">
                                         <stentry>
-                                            <xsl:value-of select="round(sum($sheet_name_group[Grupa = current()]/wynik[ text()]))"/> <!-- [ ../Grupa = current()] -->
+                                            <xsl:value-of select="format-number(sum($sheet_name_group[Grupa = current()]/wynik[ text()]) , '###,###.00')"/> <!-- [ ../Grupa = current()] -->
                                         </stentry>
                                     </xsl:for-each>
                                     <stentry>
-                                        <xsl:value-of select="round(sum( current-group()/wynik [ text()]))"/>
+                                        <xsl:value-of select="format-number(sum( current-group()/wynik [ text()]) , '###,###.00')"/>
                                     </stentry>
                                 </strow>
                             </xsl:for-each-group>
@@ -536,10 +572,10 @@
                                 <stentry></stentry>
                                 <xsl:for-each select="$Grupy/Grupy/Grupa" >
                                     <stentry>
-                                        <xsl:value-of select="round(sum( $miesiac_group [ Grupa = current()]/wynik [text()])) "/>
+                                        <xsl:value-of select="format-number(sum( $miesiac_group [ Grupa = current()]/wynik [text()]), '###,###.00') "/>
                                     </stentry>
                                 </xsl:for-each>
-                                <stentry><xsl:value-of select="round(sum( current-group()/wynik[ text()])) "/></stentry>
+                                <stentry><xsl:value-of select="format-number(sum( current-group()/wynik[ text()]) , '###,###.00')"/></stentry>
                             </strow>
                             
                             
@@ -547,6 +583,63 @@
                         </p>
                     </xsl:for-each-group>
                     
+                    <!-- CSV -->
+<!--<xsl:result-document href="temp/aleksander_raport_order.csv" omit-xml-declaration="yes">-->
+                    <p>Wersja CSV zgodnie z wymaganiami z dnia 2017-12-08 $aleksander_raport_order <codeblock>                    
+<!--<xsl:variable name="raport_2">-->
+<xsl:variable name="row" select="row"/>
+<xsl:text>lp;nazwa_u_moenert;nazwa_w_raport;</xsl:text>
+<xsl:for-each-group select="row" group-by="@miesiac">
+<xsl:value-of select="@miesiac"/><xsl:text>;</xsl:text>
+</xsl:for-each-group>
+<xsl:text>
+</xsl:text>
+<xsl:for-each select="$aleksander_raport_order//sheet_source">
+<xsl:variable name="sheet_name" select="@sheet_name"/>
+<xsl:value-of select="position()"/><xsl:text>;</xsl:text><xsl:value-of select="text()"/><xsl:text>;</xsl:text><xsl:value-of select="$sheet_name"/><xsl:text>;</xsl:text>
+<xsl:for-each-group select="$row" group-by="@miesiac">
+<xsl:variable name="miesiac" select="@miesiac"/>
+<xsl:value-of select="round(sum($row[@sheet_name=$sheet_name and @miesiac=$miesiac]/wynik[ text()]))"/><xsl:text>;</xsl:text>
+</xsl:for-each-group>
+<xsl:text>
+</xsl:text>
+</xsl:for-each>
+</codeblock>
+</p>
+                            <!--<xsl:for-each-group select="row" group-by="@miesiac">
+                                <row>
+                                <xsl:variable name="miesiac" select="@miesiac"/>
+                                <xsl:variable name="miesiac_group" select=" current-group()"/>
+                                    <xsl:attribute name="miesiac" select="$miesiac"/>
+                                    <xsl:attribute name="miesiac_group" select="$miesiac_group"/>
+                                    <xsl:for-each-group select="current-group()" group-by="@sheet_name">
+                                            <row2>
+                                            <xsl:variable name="sheet_name_group" select="current-group()"/>
+                                                <xsl:attribute name="sheet_name_group" select="$sheet_name_group"/>
+                                            <xsl:for-each select="$Grupy/Grupy/Grupa">
+                                                    <row3>
+                                                    <xsl:value-of select="format-number(sum($sheet_name_group[Grupa = current()]/wynik[ text()]) , '###,###.00')"/> <!-\- [ ../Grupa = current()] -\->
+                                                    </row3>
+                                            </xsl:for-each>
+                                                <row4>
+                                                <xsl:value-of select="format-number(sum( current-group()/wynik [ text()]) , '###,###.00')"/>
+                                                </row4>
+                                            </row2>
+                                    </xsl:for-each-group>
+                                    
+                                        <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                                                <row5>
+                                                <xsl:value-of select="format-number(sum( $miesiac_group [ Grupa = current()]/wynik [text()]), '###,###.00') "/>
+                                                </row5>
+                                        </xsl:for-each>
+                                    <row6>
+                                        <xsl:value-of select="format-number(sum( current-group()/wynik[ text()]) , '###,###.00')"/>
+                                    </row6>
+                                    
+                                </row>
+                            </xsl:for-each-group>-->
+                        <!--</xsl:variable>-->
+                    <!--</xsl:result-document>-->
                             <!--<p><simpletable frame="all" id="simplet_sklep_able_56_{ generate-id()}">
                                 <sthead>
                                     <stentry>Sklep</stentry>
@@ -588,74 +681,213 @@
                             </p>-->
                     
                 </body>
-                <topic id="topic_x5jffas_{generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
-                    <title>Tabela sprzedazy dla produktów/sklepów  (2A) </title>  
-                    <body>
-                    <xsl:for-each-group select="row" group-by="@miesiac">
-                        <xsl:variable name="miesiac" select="@miesiac"/>
-                        <xsl:variable name="miesiac_group" select=" current-group()"/>
-                        <p>Miesiąc - Wart_sprzed  <xsl:value-of select="@miesiac"/></p>
-                        <p><simpletable frame="all" id="simplaaet_sklep_ablMissese_{position()}_56_{ generate-id()}">
-                            <sthead>
-                                <stentry>Sklep</stentry>
-                                <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                
+                
+                
+
+            </topic>
+        
+        <topic id="topic_x5aaggUaj_{generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title>Tabela wyników dla produktów/sklepów - analityka  (2-N) </title>
+            <body>
+                
+                <!--<xsl:copy-of select="$Grupy"/>-->
+                
+                
+                <xsl:for-each-group select="row" group-by="@miesiac">
+                    <xsl:variable name="miesiac" select="@miesiac"/>
+                    <xsl:variable name="miesiac_group" select=" current-group()"/>
+                    <p>Miesiąc <xsl:value-of select="@miesiac"/></p>
+                    <p><simpletable frame="all" id="simplet_sklep_ablMiese_{position()}_56_{ generate-id()}">
+                        <sthead>
+                            <stentry>Sklep</stentry>
+                            <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                                <stentry>
+                                    <xsl:value-of select="."/>
+                                </stentry>
+                            </xsl:for-each>
+                            <stentry>suma</stentry>
+                        </sthead>
+                        
+                        <xsl:for-each-group select="current-group()" group-by="@sheet_name">
+                            <strow>
+                                <stentry>
+                                    <xsl:value-of select="@sheet_name"/>
+                                </stentry>
+                                <xsl:variable name="sheet_name_group" select="current-group()"/>
+                                <xsl:for-each select="$Grupy/Grupy/Grupa">
                                     <stentry>
-                                        <xsl:value-of select="."/>
+                                        S:<xsl:value-of select="round(sum( $sheet_name_group[ Grupa = current()]/(Sprz_fakt[ text()] * Cena_cennik[text()]))) "/>
+                                        Z:<xsl:value-of select="round(sum(  $sheet_name_group[ Grupa = current()]/(Il_zw[ text()] * koszt_wytworzenia[text()])) ) "/>
+                                        W:<xsl:value-of select="round(sum($sheet_name_group[Grupa = current()]/wynik[ text()]))"/> <!-- [ ../Grupa = current()] -->
                                     </stentry>
                                 </xsl:for-each>
-                                <stentry>suma</stentry>
-                            </sthead>
-                            
-                            <xsl:for-each-group select="current-group()" group-by="@sheet_name"> <!-- [@sheet_name='real Gdynia'] -->
-                                <xsl:variable name="current_group" select="current-group()"/>
-                                <strow>
-                                    <stentry>
-                                        <xsl:value-of select="@sheet_name"/>
-                                    </stentry>
-                                    <xsl:variable name="sheet_name" select="@sheet_name"/>
-                                    <xsl:message>#661 anal dla <xsl:value-of select="$sheet_name"/> and miesiac <xsl:value-of select="$miesiac"/></xsl:message>
-                                    <xsl:for-each select="$Grupy/Grupy/Grupa">
-                                        <xsl:variable name="grupa" select="."/>
-                                        <stentry>
-                                            <!--<xsl:value-of select="round(sum(current-group()[ @miesiac = $miesiac and @sheet_name = $sheet_name  and   Grupa = $grupa ]/Wart_sprzed[ text()]))"/>--> <!-- [ ../Grupa = current()] -->
-                                            <xsl:value-of select="round(sum($current_group[ Grupa = $grupa ]/Wart_sprzed[ text()]))"/>
-                                            <!--<debug><xsl:copy-of select="$row[ @miesiac = $miesiac and @sheet_name = $sheet_name  and   Grupa = $grupa ]"></xsl:copy-of></debug>-->
-                                        </stentry>
-                                    </xsl:for-each>
+                                <stentry>
+                                    S:<xsl:value-of select="round(sum( current-group()/(Sprz_fakt[ text()] * Cena_cennik[text()]))) "/>
+                                    Z:<xsl:value-of select="round(sum(  current-group()/(Il_zw[ text()] * koszt_wytworzenia[text()])) ) "/>
+                                    W:<xsl:value-of select="round(sum( current-group()/wynik [ text()]))"/>
+                                </stentry>
+                            </strow>
+                        </xsl:for-each-group>
+                        <strow>
+                            <stentry></stentry>
+                            <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                                <stentry>
+                                    S:<xsl:value-of select="round(sum( $miesiac_group [ Grupa = current()]/(Sprz_fakt[ text()] * Cena_cennik[text()]))) "/>
+                                    Z:<xsl:value-of select="round(sum(  $miesiac_group[ Grupa = current()]/(Il_zw[ text()] * koszt_wytworzenia[text()])) ) "/>
+                                    W:<xsl:value-of select="round(sum( $miesiac_group [ Grupa = current()]/wynik [text()])) "/>
+                                </stentry>
+                            </xsl:for-each>
+                            <stentry>
+                                S:<xsl:value-of select="system_cache__dita:big_values_format(sum(  current-group()/(Sprz_fakt[ text()] * Cena_cennik[text()])) ) "/>
+                                Z:<xsl:value-of select="system_cache__dita:big_values_format(sum(  current-group()/(Il_zw[ text()] * koszt_wytworzenia[text()])) ) "/>
+                                W:<xsl:value-of select="system_cache__dita:big_values_format(sum( current-group()/wynik[ text()])) "/>
+                            </stentry>
+                        </strow>
+                        
+                        
+                    </simpletable>
+                    </p>
+                </xsl:for-each-group>
+                
+                
+                
+            </body>
+        </topic>
+        
+        
+        
+        
+        <topic id="topic_x5jffas_{generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title>Tabela sprzedazy dla produktów/sklepów  (2A) </title>  
+            <body>
+                <xsl:for-each-group select="row" group-by="@miesiac">
+                    <xsl:variable name="miesiac" select="@miesiac"/>
+                    <xsl:variable name="miesiac_group" select=" current-group()"/>
+                    <p>Miesiąc - Wart_sprzed  <xsl:value-of select="@miesiac"/></p>
+                    <p><simpletable frame="all" id="simplaaet_sklep_ablMissese_{position()}_56_{ generate-id()}">
+                        <sthead>
+                            <stentry>Sklep</stentry>
+                            <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                                <stentry>
+                                    <xsl:value-of select="."/>
+                                </stentry>
+                            </xsl:for-each>
+                            <stentry>suma</stentry>
+                        </sthead>
+                        
+                        <xsl:for-each-group select="current-group()" group-by="@sheet_name"> <!-- [@sheet_name='real Gdynia'] -->
+                            <xsl:variable name="current_group" select="current-group()"/>
+                            <strow>
+                                <stentry>
+                                    <xsl:value-of select="@sheet_name"/>
+                                </stentry>
+                                <xsl:variable name="sheet_name" select="@sheet_name"/>
+                                <xsl:message>#661 anal dla <xsl:value-of select="$sheet_name"/> and miesiac <xsl:value-of select="$miesiac"/></xsl:message>
+                                <xsl:for-each select="$Grupy/Grupy/Grupa">
+                                    <xsl:variable name="grupa" select="."/>
                                     <stentry>
-                                        <!--<xsl:value-of select="round(sum($row [  @miesiac = $miesiac and @sheet_name = $sheet_name  ]/Wart_sprzed [ text()] ))"/>-->
-                                        <xsl:value-of select="round(sum(current-group()/Wart_sprzed [ text()] ))"/>
+                                        <!--<xsl:value-of select="round(sum(current-group()[ @miesiac = $miesiac and @sheet_name = $sheet_name  and   Grupa = $grupa ]/Wart_sprzed[ text()]))"/>--> <!-- [ ../Grupa = current()] -->
+                                        <xsl:value-of select="round(sum($current_group[ Grupa = $grupa ]/Wart_sprzed[ text()]))"/>
+                                        <!--<debug><xsl:copy-of select="$row[ @miesiac = $miesiac and @sheet_name = $sheet_name  and   Grupa = $grupa ]"></xsl:copy-of></debug>-->
                                     </stentry>
-                                </strow>
-                            </xsl:for-each-group>
+                                </xsl:for-each>
+                                <stentry>
+                                    <!--<xsl:value-of select="round(sum($row [  @miesiac = $miesiac and @sheet_name = $sheet_name  ]/Wart_sprzed [ text()] ))"/>-->
+                                    <xsl:value-of select="round(sum(current-group()/Wart_sprzed [ text()] ))"/>
+                                </stentry>
+                            </strow>
+                        </xsl:for-each-group>
+                        <strow>
+                            <stentry></stentry>
+                            <!--<xsl:variable name="curr_gr" select="current-group()"/>-->
+                            <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                                <stentry>
+                                    <!--<xsl:value-of select="round(sum( $row [  @miesiac = $miesiac and ../Grupa = current()]/Wart_sprzed [text()])) "/>-->
+                                    <xsl:value-of select="round(sum( $miesiac_group [ Grupa = current()]/Wart_sprzed [text()])) "/>
+                                </stentry>
+                            </xsl:for-each>
+                            <stentry><xsl:value-of select="round(sum(  current-group()/Wart_sprzed[text()]) div 1000 ) "/> kpln</stentry>
+                        </strow>
+                        
+                        
+                    </simpletable>
+                    </p>
+                </xsl:for-each-group>
+            </body>
+        </topic>
+            
+        <topic id="topic_x5jffaaaaLLs_{generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title>Tabela sprzedazy dla produktów/sklepów   (2AB) Sprz_fakt </title>  
+            <body>
+                <xsl:for-each-group select="row" group-by="@miesiac">
+                    <xsl:variable name="miesiac" select="@miesiac"/>
+                    <xsl:variable name="miesiac_group" select=" current-group()"/>
+                    <p>Miesiąc - Wart_sprzed  <xsl:value-of select="@miesiac"/></p>
+                    <p><simpletable frame="all" id="simplaaet_sklep_ablMissese_{position()}_56_{ generate-id()}">
+                        <sthead>
+                            <stentry>Sklep</stentry>
+                            <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                                <stentry>
+                                    <xsl:value-of select="."/>
+                                </stentry>
+                            </xsl:for-each>
+                            <stentry>suma</stentry>
+                        </sthead>
+                        
+                        <xsl:for-each-group select="current-group()" group-by="@sheet_name"> <!-- [@sheet_name='real Gdynia'] -->
+                            <xsl:variable name="current_group" select="current-group()"/>
                             <strow>
-                                <stentry></stentry>
-                                <!--<xsl:variable name="curr_gr" select="current-group()"/>-->
-                                <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                                <stentry>
+                                    <xsl:value-of select="@sheet_name"/>
+                                </stentry>
+                                <xsl:variable name="sheet_name" select="@sheet_name"/>
+                                <xsl:message>#791 anal dla <xsl:value-of select="$sheet_name"/> and miesiac <xsl:value-of select="$miesiac"/></xsl:message>
+                                <xsl:for-each select="$Grupy/Grupy/Grupa">
+                                    <xsl:variable name="grupa" select="."/>
                                     <stentry>
-                                        <!--<xsl:value-of select="round(sum( $row [  @miesiac = $miesiac and ../Grupa = current()]/Wart_sprzed [text()])) "/>-->
-                                        <xsl:value-of select="round(sum( $miesiac_group [ Grupa = current()]/Wart_sprzed [text()])) "/>
+                                        <!--<xsl:value-of select="round(sum(current-group()[ @miesiac = $miesiac and @sheet_name = $sheet_name  and   Grupa = $grupa ]/Wart_sprzed[ text()]))"/>--> <!-- [ ../Grupa = current()] -->
+                                        <xsl:value-of select="round(sum($current_group[ Grupa = $grupa ]/(Sprz_fakt[ text()] * Cena[text()])))"/>
+                                        <!--<debug><xsl:copy-of select="$row[ @miesiac = $miesiac and @sheet_name = $sheet_name  and   Grupa = $grupa ]"></xsl:copy-of></debug>-->
                                     </stentry>
                                 </xsl:for-each>
-                                <stentry><xsl:value-of select="round(sum(  current-group()/Wart_sprzed[text()]) div 1000 ) "/> kpln</stentry>
+                                <stentry>
+                                    <!--<xsl:value-of select="round(sum($row [  @miesiac = $miesiac and @sheet_name = $sheet_name  ]/Wart_sprzed [ text()] ))"/>-->
+                                    <xsl:value-of select="round(sum(current-group()/(Sprz_fakt[ text()] * Cena[text()] )))"/>
+                                </stentry>
                             </strow>
-                            
-                            
-                        </simpletable>
-                        </p>
-                    </xsl:for-each-group>
-                    </body>
-                </topic>
-                
-            </topic>
+                        </xsl:for-each-group>
+                        <strow>
+                            <stentry></stentry>
+                            <!--<xsl:variable name="curr_gr" select="current-group()"/>-->
+                            <xsl:for-each select="$Grupy/Grupy/Grupa" >
+                                <stentry>
+                                    <!--<xsl:value-of select="round(sum( $row [  @miesiac = $miesiac and ../Grupa = current()]/Wart_sprzed [text()])) "/>-->
+                                    <xsl:value-of select="round(sum( $miesiac_group [ Grupa = current()]/(Sprz_fakt[ text()] * Cena[text()]))) "/>
+                                </stentry>
+                            </xsl:for-each>
+                            <stentry><xsl:value-of select="round(sum(  current-group()/(Sprz_fakt[ text()] * Cena[text()])) div 1000 ) "/> kpln</stentry>
+                        </strow>
+                        
+                    </simpletable>
+                    </p>
+                </xsl:for-each-group>
+            </body>
+        </topic>
             
             
             
         
+        
     </xsl:template>
     
     
+    
+    
+    
     <xsl:template match="raszczyk_row_prod_local_sum" mode="SKLEPY_EFEKTYWNOSC">
         <xsl:for-each-group select="row" group-by="@sheet_name">
             
@@ -943,19 +1175,38 @@
     
     
     <xsl:template match="sheetData">
+            <xsl:message>#1088 match sheetData @sheet_name=<xsl:value-of select="@sheet_name"/></xsl:message>
+            <xsl:variable name="row_month_wrz" select="row[c[v='wrzesień']]/@r"/>
+            <xsl:variable name="row_month_paz" select="row[c[v='październik' or v='pazdziernik' or v='pażdziermok' or v='pażdziermok' or v='pażdziermok']]/@r"/>
+            <xsl:variable name="row_month_lis" select="row[c[v='listopad']]/@r"/>
+            <xsl:message>#1088-D row_month_wrz=<xsl:value-of select="$row_month_wrz"/>; row_month_paz=<xsl:value-of select="$row_month_paz"/>; row_month_lis=<xsl:value-of select="$row_month_lis"/>;</xsl:message>
             
-            <xsl:variable name="row_month" select="row[c[v='wrzesień']]/@r"/>
+            <xsl:choose>
+                <xsl:when test="not(empty($row_month_lis) ) and empty($row_month_paz) ">
+                    <xsl:message terminate="no">#1095 bledny arkusz - nie pokolei miesiace lub brak znacznika</xsl:message>
+                </xsl:when>
+                
+            </xsl:choose>
             
+        <xsl:variable name="first_row_with_header" select="row[ c/v='Grupa' and c/v='Cena'][1]"/>
+        
+        
             <xsl:variable name="detect_sheet_format">
                 <xsl:call-template name="detect_sheet_format">
-                    <xsl:with-param name="row_1" select="row[ position() = 1]"/>
+                    <xsl:with-param name="row_1" select="$first_row_with_header"/> <!-- row[ position() = 1] -->
                 </xsl:call-template>
             </xsl:variable>
             
+        <xsl:result-document href="temp/detect_sheet_format__{@document-uri}___.file">
+            <xsl:copy-of select="$detect_sheet_format"/>
+        </xsl:result-document>
+            
                 <xsl:apply-templates mode="raszczyk_row_prod">
                     <xsl:with-param name="detect_sheet_format" select="$detect_sheet_format"/>
                     <xsl:with-param name="sheet_name" select="@sheet_name"/>
-                    <xsl:with-param name="row_month" select="$row_month"/>
+                    <xsl:with-param name="row_month_wrz" select="$row_month_wrz"/>
+                    <xsl:with-param name="row_month_paz" select="$row_month_paz"/>
+                    <xsl:with-param name="row_month_lis" select="$row_month_lis"/>
                 </xsl:apply-templates>
         
         
@@ -969,24 +1220,48 @@
     <xsl:template match="row" mode="raszczyk_row_prod">
         <xsl:param name="detect_sheet_format" required="yes"/>
         <xsl:param name="sheet_name" required="yes"/>
-        <xsl:param name="row_month" required="yes"/>
+        <xsl:param name="row_month_wrz" required="yes"/>
+        <xsl:param name="row_month_paz" required="yes"/>
+        <xsl:param name="row_month_lis" required="yes"/>
         <xsl:choose>
-            <xsl:when test="$row_month = @r or ( $row_month + 1 ) = @r">
-                <xsl:comment>#101 bypased row with month sign <xsl:value-of select="@r"/></xsl:comment>
+            <xsl:when test="number($row_month_wrz) = @r or ( number($row_month_wrz) + 1 ) = @r or number($row_month_paz) = @r or ( number($row_month_paz) + 1 ) = @r or  number($row_month_lis) = @r or ( number($row_month_lis) + 1 ) = @r ">
+                <xsl:comment>#101 bypased row with month sign <xsl:value-of select="@r"/> for $sheet_name = <xsl:value-of select="$sheet_name"/> ;</xsl:comment>
+                <xsl:message>#101 bypased row with month sign <xsl:value-of select="@r"/> for $sheet_name = <xsl:value-of select="$sheet_name"/> ;</xsl:message>
+            </xsl:when>
+            <xsl:when test="c[v='Grupa'] and c[v='Nazwa wyrobu'] and c[v='Cena']">
+                <xsl:comment>#101B bypased by content row with month sign <xsl:value-of select="@r"/> for $sheet_name = <xsl:value-of select="$sheet_name"/> ;</xsl:comment>
+                <xsl:message>#101B bypased by content row with month sign <xsl:value-of select="@r"/> for $sheet_name = <xsl:value-of select="$sheet_name"/> ;</xsl:message>
             </xsl:when>
             <xsl:otherwise>
                 <row>
                     <xsl:attribute name="sheet_name" select=" normalize-space($sheet_name)"/>
                     <xsl:choose>
-                        <xsl:when test=" number(@r) &lt; number($row_month)">
-                            <xsl:attribute name="miesiac" select="'biezacy'"/>
+                        <xsl:when test="number($row_month_lis) &gt; 0 and string-length($row_month_wrz) = 0 and string-length($row_month_paz) = 0">
+                            <xsl:attribute name="miesiac" select="'listopad'"/>
+                        </xsl:when>
+                        <xsl:when test=" number(@r) &lt; number($row_month_wrz)">
+                            <xsl:attribute name="miesiac" select="'sierpien'"/>
+                        </xsl:when>
+                        <xsl:when test=" number(@r) &gt;= number($row_month_wrz) and number(@r) &lt;= number($row_month_paz) or string-length($row_month_paz)=0 ">
+                            <xsl:attribute name="miesiac" select="'wrzesien'"/>
+                        </xsl:when>
+                        <xsl:when test=" number(@r) &gt;= number($row_month_paz) and number(@r) &lt;= number($row_month_lis) ">
+                            <xsl:attribute name="miesiac" select="'pazdziernik'"/>
                         </xsl:when>
-                        <xsl:when test="number(@r) &gt; number($row_month)">
-                            <xsl:attribute name="miesiac" select="'poprzedni'"/>
+                        <xsl:when test=" number(@r) &gt;= number($row_month_lis)  ">
+                            <xsl:attribute name="miesiac" select="'listopad'"/>
                         </xsl:when>
-                        <xsl:otherwise><xsl:message terminate="yes">#979 error with <xsl:copy-of select="@*"></xsl:copy-of> </xsl:message></xsl:otherwise>
+                        <xsl:when test=" string-length($row_month_lis)=0 and  string-length($row_month_paz)=0">
+                            <xsl:message>#1148 bypased SN=<xsl:value-of select="$sheet_name"/>; $row_month_lis=<xsl:value-of select="$row_month_lis"/>; $row_month_paz=<xsl:value-of select="$row_month_paz"/>;</xsl:message>
+                            <xsl:comment>#1148 bypased SN=<xsl:value-of select="$sheet_name"/>; $row_month_lis=<xsl:value-of select="$row_month_lis"/>; $row_month_paz=<xsl:value-of select="$row_month_paz"/>;</xsl:comment>
+                        </xsl:when>
+                        
+                        
+                        <xsl:otherwise><xsl:message terminate="yes">#979 error with <xsl:copy-of select="@*"/> (W<xsl:value-of select="$row_month_wrz"/>/P<xsl:value-of select="$row_month_paz"/>/L<xsl:value-of select="$row_month_lis"/> ) </xsl:message></xsl:otherwise>
                     </xsl:choose>
-                    <xsl:attribute name="row_month" select="$row_month"/>
+                    <xsl:attribute name="row_month_wrz" select="$row_month_wrz"/>
+                    <xsl:attribute name="row_month_paz" select="$row_month_paz"/>
+                    <xsl:attribute name="row_month_lis" select="$row_month_lis"/>
                     <xsl:attribute name="r" select="@r"/>
                     <xsl:variable name="c" select="c"/>
                     <xsl:for-each select="$detect_sheet_format/detect_sheet_format/*">
@@ -1119,6 +1394,7 @@
     </xsl:function>
     
     <xsl:template match="koszty_wytworzenia.csv" mode="build_stock_optimize_calculations_raszczyk:koszty_wytworzenia.xml" xpath-default-namespace="build_stock_optimize_calculations_raszczyk">
+        <xsl:message>#1289 koszty_wytworzenia.csv Processing! OK</xsl:message>
         <koszty_wytworzenia.xml>
             <xsl:for-each select=" tokenize( text(),'\n')">
                 <row>

+ 45 - 6
SE/schema/default_db_xml_cache.public/build_ant_universal_by_xsl_match.xsl

@@ -2,6 +2,7 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:p5_tr_map="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/procesy5_translate_map.xsd"
     xmlns:wfs="http://www.opengis.net/wfs"
     exclude-result-prefixes="xs"
     version="2.0">
@@ -33,21 +34,44 @@
     <!--<xsl:param name="external_schema_table.path" required="yes"/>-->
     
     
-    <xsl:template mode="build_element_complexType.xml build_tr_map.xml" match="system_cache__appinfo:element_complexType"> <!-- for type generate in main build.xml mode -->
+    <xsl:template mode="build_element_complexType.xml" match="system_cache__appinfo:element_complexType"> <!-- for type generate in main build.xml mode -->
                 <project basedir="{$basedir}" name="{$antfile_prefix}" default="{$antfile_prefix}"
                     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
                     <xsl:if test="$properties.xml"><xsl:copy-of select="doc($properties.xml)/properties/*" copy-namespaces="no"/></xsl:if>
                     <target name="{$antfile_prefix}">
                         <parallel  failonany="true" threadCount="{$threadCount}"> <!-- threadCount="4"  -->
-                            <xsl:apply-templates mode="#current"/>
+                            <xsl:apply-templates mode="#current">
+                                <xsl:sort select="number(@id.int.rand)" order="descending"/>
+                        </xsl:apply-templates>
                         </parallel>                        
                     </target>
                 </project>
     </xsl:template>
     
+    <xsl:template mode="build_tr_map.xml" match="system_cache__appinfo:element_complexType"> <!-- for type generate in main build.xml mode -->
+        <project basedir="{$basedir}" name="{$antfile_prefix}" default="{$antfile_prefix}"
+            xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
+            <xsl:if test="$properties.xml"><xsl:copy-of select="doc($properties.xml)/properties/*" copy-namespaces="no"/></xsl:if>
+            <target name="{$antfile_prefix}">
+                <parallel  failonany="true" threadCount="{(number($threadCount) + 2)}"> <!-- threadCount="4"  -->
+                    <xsl:apply-templates mode="#current">
+                        <xsl:sort select="number(@id.int.rand)" order="descending"/>
+                    </xsl:apply-templates>
+                </parallel>                        
+            </target>
+        </project>
+    </xsl:template>
+    
     <xsl:template mode="build_element_complexType.xml" match="build_cache">
-        <sequential>
-        <tempfile property="{with-param/@select}{with-param/@name}" deleteonexit="yes"><xsl:attribute name="destdir" select="'${detect_resource_type.local}'"/></tempfile>
+        <xsl:message>#51 testing against unparsed-text-available <xsl:value-of select="system_cache__appinfo:element-filename/text()"/></xsl:message>
+        <xsl:choose>
+            <xsl:when test="system_cache__appinfo:element-filename/text() and unparsed-text-available(system_cache__appinfo:element-filename/text())">
+                <echo> #54 suppressed generating <xsl:value-of select="with-param/@name"/> because of  unparsed-text-available(<xsl:value-of select="system_cache__appinfo:element-filename/text()"/>)</echo>
+            </xsl:when>
+            <xsl:otherwise><xsl:comment>#56 not exists <xsl:value-of select="system_cache__appinfo:element-filename/text()"/></xsl:comment>
+                <sequential>
+        <!--<xsl:attribute name="id.int.rand" select="@id.int.rand"/>-->
+                    <tempfile property="{with-param/@select}{with-param/@name}" deleteonexit="yes"><xsl:attribute name="destdir" select="'${detect_resource_type.local}'"/></tempfile>
             <echo>creating <xsl:value-of select="with-param/@select"/>:<xsl:value-of select="with-param/@name"/></echo>
         <xslt basedir="./"    destdir="./"   out="${with-param/@select}{with-param/@name}">
             <xsl:attribute name="style" select="'${build_complexType.xsl}'"/>
@@ -96,10 +120,19 @@
                 <xsl:attribute name="file" select="concat('${',with-param/@select,with-param/@name,'}')"/>
             </delete>
         </sequential>
+    </xsl:otherwise>
+        </xsl:choose>
+        
     </xsl:template>
     
     <xsl:template mode="build_tr_map.xml" match="build_cache">
-        <sequential>
+        <xsl:message>#114 testing against unparsed-text-available <xsl:value-of select="p5_tr_map:element-filename/text()"/></xsl:message>
+        <xsl:choose>
+            <xsl:when test="p5_tr_map:element-filename/text() and unparsed-text-available(p5_tr_map:element-filename/text())">
+                <echo> #117 suppressed generating <xsl:value-of select="with-param/@name"/> because of  unparsed-text-available(<xsl:value-of select="system_cache__appinfo:element-filename/text()"/>)</echo>
+            </xsl:when>
+            <xsl:otherwise><xsl:comment>#118 not exists <xsl:value-of select="p5_tr_map:element-filename/text()"/></xsl:comment>
+                <sequential>
             <tempfile property="{with-param/@select}{with-param/@name}" deleteonexit="yes"><xsl:attribute name="destdir" select="'${detect_resource_type.local}'"/></tempfile>
             <echo>creating <xsl:value-of select="with-param/@select"/>:<xsl:value-of select="with-param/@name"/></echo>
             <xslt basedir="./"    destdir="./"   out="${with-param/@select}{with-param/@name}">
@@ -143,12 +176,18 @@
                     <xsl:attribute name="expression" select="'${external_schema_table.path}'"/>
                 </param>
                 <param name="debug_level_param" expression="{$debug_level_param}"/>
-                <classpath location="/opt/local/share/java/saxon9he.jar"/>
+                <param name="vrtfNamespaces_file">
+                            <xsl:attribute name="expression" select="'${vrtfNamespaces_file}'"/>
+                        </param>
+                        <classpath location="/opt/local/share/java/saxon9he.jar"/>
             </xslt>
             <delete>
                 <xsl:attribute name="file" select="concat('${',with-param/@select,with-param/@name,'}')"/>
             </delete>
         </sequential>
+    </xsl:otherwise>
+        </xsl:choose>
+        
     </xsl:template>
     
     <xsl:template match="*">

+ 1 - 1
SE/schema/default_db_xml_cache.public/build_object_install_se_ant_object.xsl

@@ -49,7 +49,7 @@
    
     
    
-    <xsl:template match="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" 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:template match="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix[xs:schema/@targetNamespace='https://biuro.biall-net.pl/wfs/default_db/table/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.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>

+ 73 - 14
SE/schema/default_db_xml_cache.public/get_all_xsd.xsl

@@ -3,13 +3,15 @@
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     exclude-result-prefixes="xs hfp"
     version="2.0"
+    xmlns:p5_tr_map="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/procesy5_translate_map.xsd"
     xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
     xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
     
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
-    
+    <xsl:param name="vc:minVersion" select="'1.1'" />
+    <xsl:param name="vc:maxVersion"/>
     <xsl:param name="procesy5_system_schema" select="'../default_db.instance.xml/transformed/procesy5_system_schema.xml'"/>
     <xsl:param name="procesy5_system_schema_collection_dir" select="'../'"/>
     <xsl:param name="cache" select="'refresh'"/>
@@ -25,7 +27,7 @@
     
     <xsl:param name="WPS_Functions" select="'public_html/WPS_Functions/'"/>
     <xsl:param name="new-schema-with-ID-to-move-and-rename-to-xsd" select="'/new-schema-with-ID-to-move-and-rename-to-xsd'"/>
-    
+    <xsl:param name="default_db.instance.xml" required="yes"/> <!-- todo better always include get_all_xsd -->
     
     <xsl:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
     <xsl:include href="system_cache__appinfo/external_schema_targetNamespace.xsl"/>
@@ -115,7 +117,7 @@
         <xsl:param name="system_cache__appinfo:vrtfNamespaces" />
         <xsl:param name="targetNamespace" />
         <!--<xsl:message>#115 system_cache__appinfo:prefix_from_targetNamespace elements in system_cache__appinfo:vrtfNamespaces=<xsl:value-of select="count($system_cache__appinfo:vrtfNamespaces//ns)" xpath-default-namespace=""/></xsl:message>-->
-        <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces//ns[@uri=$targetNamespace][1]/@prefix" xpath-default-namespace=""/>
+        <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces//ns[substring-after(@uri,'://')=substring-after($targetNamespace,'://')][1]/@prefix" xpath-default-namespace=""/>
     </xsl:function>
     <xsl:function name="system_cache__appinfo:targetNamespace_from_prefix">
         <xsl:param name="system_cache__appinfo:vrtfNamespaces" />
@@ -134,7 +136,14 @@
         </xsl:if>
     </xsl:function>
     
-   
+    <xsl:function name="system_cache__appinfo:id.int.rand">
+        <xsl:param name="id"/><!-- like DYSTRYBUCJI___d4e7067-1_ID_PROJECT -->
+        <xsl:variable name="id.int" select="replace($id,'([a-z]|[A-Z]|_|-)','')"/>
+        <xsl:variable name="mod.10" select="(number($id.int)+string-length($id)) mod 10"/>
+        <xsl:variable name="mod.9" select="number($id.int) mod 9"/>
+        <xsl:variable name="mod.8" select="number($id.int) mod 8"/>
+        <xsl:value-of select="concat(1,$mod.10,$mod.9,$mod.8)"/>
+    </xsl:function>
     <!--<xsl:function name="system_cache__appinfo:php_function_name_from_obj_with_prefix">
         <xsl:param name="object_name" required="yes"/>
         <xsl:value-of select="replace($object_name,':','__x3A__')"/>
@@ -391,8 +400,9 @@
                     <xsl:copy-of select="namespace::node()"/>
                     <xsl:namespace name="p5Type" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
                     <xsl:copy-of select="@targetNamespace"/>
-                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
-                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
+                    <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
+                   
                     <xsl:comment>#144 when  @targetNamespace exists and prefix not exists</xsl:comment>
                     <xsl:comment>namespaces_cur/ns/@uri=<xsl:value-of select="$targetNamespace"/> = <xsl:value-of select="$namespaces_cur/namespaces_cur/ns[@uri=$targetNamespace]/@prefix"/> </xsl:comment>
                     <xsl:comment> count: <xsl:value-of select="count($namespaces_cur/namespaces_cur/ns)"/> </xsl:comment>
@@ -404,8 +414,8 @@
                     <xsl:namespace name="p5Type" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
                     <xsl:copy-of select="namespace::node()"/>
                     <xsl:copy-of select="@targetNamespace"/>
-                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
-                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
+                    <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
                     <xsl:comment>#147 when  @targetNamespace and prefix probably exists!</xsl:comment>
                     <xsl:copy-of select="*"/>                    
                 </xsl:when>
@@ -415,8 +425,8 @@
                     <xsl:copy-of select="namespace::node()"/>
                     <xsl:namespace name="p5Type" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
                     <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
-                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
-                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
+                    <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
                     <xsl:message>#35 detect. targetNamespace <xsl:value-of select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/></xsl:message>
                     <xsl:comment>#158 otherwise not @targetNamespace and no prefix</xsl:comment>
                     <xsl:copy-of select="*"/>
@@ -473,8 +483,8 @@
                     <xsl:namespace name="{$detect_prefix}" select="@targetNamespace"/>
                     <xsl:copy-of select="namespace::node()"/>
                     <xsl:copy-of select="@targetNamespace"/>
-                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
-                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:attribute name="vc:minVersion" select="'1.1'"/>
+                    <!--<xsl:attribute name="vc:maxVersion" select="'1.1'"/>-->
                     <xsl:comment>#147 when  @targetNamespace and prefix probably exists!</xsl:comment>
                     <!--<xsl:copy-of select="*" copy-namespaces="yes"/>-->
                     <!--<xs:debug_test>
@@ -496,8 +506,10 @@
                     <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
                     <xsl:copy-of select="namespace::node()"/>
                     <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
-                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
-                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
+                    <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
+
+                    <!--<xsl:attribute name="vc:maxVersion" select="'1.1'"/>-->
                     <xsl:message>#35 detect. targetNamespace <xsl:value-of select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/></xsl:message>
                     <xsl:comment>#158 otherwise not @targetNamespace and no prefix</xsl:comment>
                     <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
@@ -801,6 +813,47 @@
     </xsl:template>
     
     
+    <xsl:function name="system_cache__appinfo:element-filename">
+        <xsl:param name="objectType"/> <!-- build_element , build_complexType , go_recurse_from_root_by_build_element_cache , p5_tr_map:go_recurse_from_root_by_build_complexType ,  -->
+        <xsl:param name="element"/>
+        <xsl:param name="prefix"/>
+        <xsl:param name="namespace_uri_param"/>
+        <xsl:variable name="element-filename" > <!-- TODO add to funciton -->
+            <xsl:choose>
+                <xsl:when test="$prefix">
+                    <xsl:value-of select="system_cache__appinfo:escape_object_prefix_to_string(concat($prefix,':',$element))"/>
+                </xsl:when>
+                <xsl:when test="$namespace_uri_param">
+                    <xsl:value-of select="system_cache__appinfo:escape_object_prefix_to_string(concat($namespace_uri_param,':',$element))"/>
+                </xsl:when>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="$objectType='build_complexType'">
+                <xsl:value-of select="concat($default_db.instance.xml,'/build_complexType/complexType-',$element-filename,'.xml')"/>
+            </xsl:when>
+            <xsl:when test="$objectType='build_element'">
+                <xsl:value-of select="concat($default_db.instance.xml,'/build_complexType/element-',$element-filename,'.xml')"/>
+            </xsl:when>
+            <xsl:otherwise><xsl:message terminate="yes">#833 unknown type $objectType=<xsl:value-of select="$objectType"/></xsl:message></xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+    <xsl:function name="p5_tr_map:element-filename">
+        <xsl:param name="objectType"/><!-- go_recurse_from_root_by_build_element_cache , go_recurse_from_root_by_build_complexType ,  -->
+        <xsl:param name="parent_type"/> 
+        
+        <xsl:choose>
+            <xsl:when test="$objectType='go_recurse_from_root_by_build_element_cache'">
+                <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/element-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
+            </xsl:when>
+            <xsl:when test="$objectType='go_recurse_from_root_by_build_complexType_cache'">
+                <xsl:value-of select="concat($default_db.instance.xml,'/p5_tr_map/complexType-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
+            </xsl:when>
+            <xsl:otherwise><xsl:message terminate="yes">#833 unknown type $objectType=<xsl:value-of select="$objectType"/></xsl:message></xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
     <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:element_complexType">
         <xsl:param name="targetNamespace" select="$targetNamespace_DEFAULTS"/>    
             <system_cache__appinfo:element_complexType>
@@ -832,13 +885,19 @@
                                     <xsl:choose>
                                         <xsl:when test="local-name()='element'">
                                             <build_cache name="build_element">
+                                                <xsl:attribute name="id.int.rand" select="system_cache__appinfo:id.int.rand(@id)"/>
                                                 <with-param name="element" select="{$prefix_134}:{$complexType_or_element_name186}"/>
+                                                <system_cache__appinfo:element-filename><xsl:value-of select="system_cache__appinfo:element-filename('build_element',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename>
+                                                <p5_tr_map:element-filename><xsl:value-of select="p5_tr_map:element-filename('go_recurse_from_root_by_build_complexType_cache',concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename>
                                             </build_cache>
                                         </xsl:when>
                                         <xsl:when test="local-name()='complexType'">
                                             <build_cache name="build_complexType">
+                                                <xsl:attribute name="id.int.rand" select="system_cache__appinfo:id.int.rand(@id)"/>
                                                 <with-param name="complexType"
                                                     select="{$prefix_134}:{$complexType_or_element_name186}"/>
+                                                <system_cache__appinfo:element-filename><xsl:value-of select="system_cache__appinfo:element-filename('build_complexType',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename>
+                                                <p5_tr_map:element-filename><xsl:value-of select="p5_tr_map:element-filename('go_recurse_from_root_by_build_complexType_cache',concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename>
                                             </build_cache>
                                         </xsl:when>
                                     </xsl:choose>

+ 1 - 0
SE/schema/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl

@@ -84,6 +84,7 @@
                 <xsl:otherwise><xsl:value-of select="concat($username,':',$username.pass,'@')"/></xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
+        <xsl:if test="number($debug) &gt; 0"><xsl:message>#76 req:<xsl:value-of select="$REQUEST.TYPENAME"/> filter <xsl:value-of select="$OGC_Filter//ogc:PropertyName/text()"/>/<xsl:value-of select="$OGC_Filter//ogc:Literal/text()"/></xsl:message></xsl:if>
         <xsl:value-of select="concat($protocol,$username_and_pass,$api,'/',$targetNamespace_DEFAULTS_prefix,'/?SERVICE=',$REQUEST.SERVICE,'&amp;VERSION=',$REQUEST.VERSION,'&amp;REQUEST=',$REQUEST.TYPE,'&amp;TYPENAME=',$REQUEST.TYPENAME,$php_session_id_ok.string,$OGC_Filter,'&amp;SRSNAME=',$REQUEST.SRSNAME)"/>
     </xsl:template>
     

+ 38 - 12
SE/schema/default_db_xml_cache.public/main_build_recurse_ant.dita_with_id.xsl

@@ -129,6 +129,7 @@
             <!--<xsl:variable name="detect_resource_type" select=" system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type_from_cache(@parent_type)"/>-->
             <xsl:call-template name="p5_tr_map:simpleTypeMakeOgcFilter">
                 <xsl:with-param name="build_complexType" select="$build_complexType"/>
+                <xsl:with-param name="p5_tr_map:go_recurse_from_root_by_build_element" select="*" xpath-default-namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/procesy5_translate_map.xsd" />
             </xsl:call-template>
             <xsl:comment>#68 from <xsl:value-of select="p5_tr_map:go_recurse_from_root_by_build_element_434/@parent_type"/>; I get prefixed_object_info/@element <xsl:value-of select="$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@element"/>; </xsl:comment>
             <xsl:apply-templates>
@@ -231,6 +232,7 @@
                     
                     <xsl:call-template name="p5_tr_map:simpleTypeMakeOgcFilter">
                         <xsl:with-param name="build_complexType" select="$build_complexType"/>
+                        <xsl:with-param name="p5_tr_map:go_recurse_from_root_by_build_element" select="*" />
                     </xsl:call-template>
                     <xsl:element name="{concat($namespace_prefix,':',$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@element)}">
                         <xsl:attribute name="xml_id" select="concat(generate-id(),'_child')"/>
@@ -298,6 +300,7 @@
                 <xsl:comment>@298 p5_tr_map:simpleTypeMakeOgcFilter</xsl:comment>
                 <xsl:call-template name="p5_tr_map:simpleTypeMakeOgcFilter">
                     <xsl:with-param name="build_complexType" select="$build_complexType"/>
+                    <xsl:with-param name="p5_tr_map:go_recurse_from_root_by_build_element" select="*" />
                 </xsl:call-template>
                 <xsl:element name="{concat($namespace_prefix,':',$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@element)}">
                     <xsl:attribute name="xml_id" select="generate-id()"/>
@@ -470,20 +473,32 @@
     
     <xsl:template name="p5_tr_map:simpleTypeMakeOgcFilter">
         <xsl:param name="build_complexType" required="yes"/>
+        <xsl:param name="p5_tr_map:go_recurse_from_root_by_build_element"/>
         <!--<xsl:param name="system_cache__appinfo:id" required="yes"/>-->
-        <xsl:variable name="simpleTypeMakeOgcFilter">
-            <xsl:apply-templates mode="p5_tr_map:simpleTypeMakeOgcFilter" select="$build_complexType/element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
-        </xsl:variable>
-        <!--<debug.476>
+        <xsl:choose>
+            <xsl:when test="not($p5_tr_map:go_recurse_from_root_by_build_element/*) or $p5_tr_map:go_recurse_from_root_by_build_element/p5_tr_map:go_recurse_from_root_by_build_element_4942 or $p5_tr_map:go_recurse_from_root_by_build_element/go_recurse_from_root_by_build_element_4940 or $p5_tr_map:go_recurse_from_root_by_build_element/go_recurse_from_root_by_build_element_4941 or not($p5_tr_map:go_recurse_from_root_by_build_element/p5_tr_map:go_recurse_from_root_by_build_element_494)" >
+                <xsl:variable name="simpleTypeMakeOgcFilter">
+                    <xsl:apply-templates mode="p5_tr_map:simpleTypeMakeOgcFilter" select="$build_complexType/element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                        <!--<xsl:with-param name="p5_tr_map:go_recurse_from_root_by_build_element" select="'true'" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>-->
+                    </xsl:apply-templates>
+                </xsl:variable>
+                <!--<debug.476>
             <xsl:copy-of select="$build_complexType/element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
         </debug.476>-->
-        <xsl:if test="$simpleTypeMakeOgcFilter/*"><!-- display element only if exists filter -->
-            <simpleTypeMakeOgcFilter>
-                <xsl:attribute name="name" select="$build_complexType/element/@name" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
-                <!--<xsl:attribute name="debug.479" select="true()"/>-->
-                <xsl:copy-of select="$simpleTypeMakeOgcFilter"/>
-            </simpleTypeMakeOgcFilter>
-        </xsl:if>
+                <xsl:if test="$simpleTypeMakeOgcFilter/*"><!-- display element only if exists filter -->
+                    <simpleTypeMakeOgcFilter>
+                        <xsl:attribute name="name" select="$build_complexType/element/@name" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                        <!--<xsl:attribute name="debug.479" select="true()"/>-->
+                        <xsl:copy-of select="$simpleTypeMakeOgcFilter"/>
+                    </simpleTypeMakeOgcFilter>
+                </xsl:if>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>#497 bypased simpleTypeMakeOgcFilter because of root p5_tr_map:go_recurse_from_root_by_build_element = <xsl:value-of select="$p5_tr_map:go_recurse_from_root_by_build_element/*/name()"/></xsl:message>
+                <xsl:comment>#497 bypased simpleTypeMakeOgcFilter because of root p5_tr_map:go_recurse_from_root_by_build_element =<xsl:value-of select="$p5_tr_map:go_recurse_from_root_by_build_element/*/name()"/> </xsl:comment>
+            </xsl:otherwise>
+        </xsl:choose>
+        
         
     </xsl:template>
     
@@ -507,8 +522,19 @@
     </xsl:template>
     
     <xsl:template mode="p5_tr_map:simpleTypeMakeOgcFilter" match="complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="p5_tr_map:go_recurse_from_root_by_build_element"/>
         <!--<xsl:element name="{name()}">-->
-        <xsl:apply-templates mode="p5_tr_map:simpleTypeMakeOgcFilter"/>
+        <xsl:choose>
+            <!--<xsl:when test="$p5_tr_map:go_recurse_from_root_by_build_element/* and ( $p5_tr_map:go_recurse_from_root_by_build_element/p5_tr_map:go_recurse_from_root_by_build_element_4942 or not( $p5_tr_map:go_recurse_from_root_by_build_element/p5_tr_map:go_recurse_from_root_by_build_element_494 ) )" >-->
+            <xsl:when test="not($p5_tr_map:go_recurse_from_root_by_build_element) or  ( $p5_tr_map:go_recurse_from_root_by_build_element/p5_tr_map:go_recurse_from_root_by_build_element_4942 or $p5_tr_map:go_recurse_from_root_by_build_element/go_recurse_from_root_by_build_element_4940 or $p5_tr_map:go_recurse_from_root_by_build_element/go_recurse_from_root_by_build_element_4941  or not( $p5_tr_map:go_recurse_from_root_by_build_element/p5_tr_map:go_recurse_from_root_by_build_element_494 ) )" >   
+                <xsl:apply-templates mode="p5_tr_map:simpleTypeMakeOgcFilter"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>#522 not generating filter because of $p5_tr_map:go_recurse_from_root_by_build_element / <xsl:value-of select="$p5_tr_map:go_recurse_from_root_by_build_element/name()"/> has not derivations so it is root</xsl:message>
+                <xsl:comment>#522 not generating filter because of p5_tr_map:go_recurse_from_root_by_build_element / <xsl:value-of select="$p5_tr_map:go_recurse_from_root_by_build_element/name()"/> has not derivations so it is root</xsl:comment>
+            </xsl:otherwise>
+        </xsl:choose>
+        
         <!--</xsl:element>-->
     </xsl:template>
     

+ 222 - 22
SE/schema/default_db_xml_cache.public/object_modeling.xsl

@@ -1,20 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
     exclude-result-prefixes="xs"
     version="2.0">
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
-    
+    <!-- TEN TEMPLATE NIE JEST DO ROBIENIA STRUKTURY LACZONEJ - UZYJ object_modeling_by_xml_schema.xsl  -->
     <!--<xsl:include href="get_all_xsd.xsl"/>-->
     <!--<xsl:param name="procesy5_system_schema_file" select="'../default_db.instance.xml/transformed/procesy5_system_schema.xml'"/>-->
     <xsl:include href="system_cache__appinfo/TargetNamespaceBindings.xsl"/>
     <!--<xsl:include href="get_all_xsd.xsl"/>--> <!-- for use system_cache__appinfo:escape_object_prefix_to_string -->
+    <xsl:include href="system_cache__appinfo/vrtfNamespaces.xsl"/>
     
-    <xsl:param name="prototype_object_namespace" select="'https://biuro.biall-net.pl/wfs/default_db/Types/Infrastructure.xsd'"/>
+    <xsl:param name="prototype_object_namespace" select="'https://biuro.biall-net.pl/wfs/default_db/Types/Empty.xsd'"/>
     <xsl:param name="new_object_namespace"/> <!-- example https://biuro.biall-net.pl/wfs/default_db/table/CRM_PROCES.xsd -->
-    <xsl:param name="targetNamespace.base" required="yes"/>
+    <xsl:param name="targetNamespace.base" required="yes"/> <!-- usually biuro.biall-net.pl/xmlschema_procesy5/default_db  -->
+    <xsl:param name="object_modeling.Error.Handling" required="yes"/>
+    <xsl:param name="NamespaceObjectInstanceTable" required="yes"/>
+    <xsl:param name="merge_priority" select="'database'"/> <!-- for default_db or prototype -->
+    <!--<xsl:param name="new_object.name" required="yes"/>--> <!-- Musi byc name = np ACCESS_REQUESTS -->
     <!--<xsl:param name="targetNamespace_DEFAULTS" select="'http://biuro.biall-net.pl/xmlschema_procesy5/default_db'"/>-->
     <!--<xsl:param name="procesy5_system_schema_collection_dir" select="'../../'"/>--> <!-- should be like /Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html -->
     
@@ -39,22 +45,40 @@
     </xsl:template>
     
     <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:new_object_by_prototype">
-        <xsl:variable name="system_cache__appinfo:new_object_by_prototype.base" select="system_cache__appinfo:get_all_xsd_default_db/schema[ substring-after(@targetNamespace,'://')=substring-after($targetNamespace.base,'://')]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
-        <xsl:if test="not($system_cache__appinfo:new_object_by_prototype.base/complexType)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><xsl:message terminate="yes">#25 unknow source object - not found for <xsl:value-of select="$targetNamespace.base"/></xsl:message></xsl:if>
-        <xsl:message>#26 <xsl:value-of select="count($system_cache__appinfo:new_object_by_prototype.base/complexType)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:message>
-        <debug.45><xsl:copy-of select="$system_cache__appinfo:new_object_by_prototype.base" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></debug.45>
+        <xsl:message>#72 system_cache__appinfo:new_object_by_prototype with param testing:
+            $targetNamespace.base = <xsl:value-of select="$targetNamespace.base"/>
+            $new_object_namespace = <xsl:value-of select="$new_object_namespace"/>
+            $prototype_object_namespace = <xsl:value-of select="$prototype_object_namespace"/>
+            searching for  @targetNamespace = <xsl:value-of select="substring-after($targetNamespace.base,'://')"/> ($targetNamespace.base)
+        </xsl:message>
+        <xsl:variable name="system_cache__appinfo:new_object_by_prototype.base" select="system_cache__appinfo:get_all_xsd_default_db/schema[ substring-after(@targetNamespace,'://')=substring-after($targetNamespace.base,'://')]/complexType[@name=$NamespaceObjectInstanceTable]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+        
+        <xsl:if test="not($system_cache__appinfo:new_object_by_prototype.base/*)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><xsl:message terminate="yes">#25 unknow source object - not found for <xsl:value-of select="$targetNamespace.base"/></xsl:message></xsl:if>
+        <xsl:message>#26 count($system_cache__appinfo:new_object_by_prototype.base//*) = <xsl:value-of select="count($system_cache__appinfo:new_object_by_prototype.base//*)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:message>
+        <!--<debug.45><xsl:copy-of select="$system_cache__appinfo:new_object_by_prototype.base" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></debug.45>-->
+        <xsl:variable name="system_cache__appinfo:new_object_by_prototype.base.simpleType" select="system_cache__appinfo:get_all_xsd_default_db/schema[ substring-after(@targetNamespace,'://')=substring-after($targetNamespace.base,'://')]/simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+        <xsl:message>#26 count($system_cache__appinfo:new_object_by_prototype.base.simpleType//*) = <xsl:value-of select="count($system_cache__appinfo:new_object_by_prototype.base.simpleType/*)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:message>
         <xsl:choose>
             <xsl:when test="$prototype_object_namespace and $new_object_namespace">
+                <xsl:message>#55 when test="$prototype_object_namespace and $new_object_namespace"</xsl:message>
                 <xsl:variable name="system_cache__appinfo:new_object_by_prototype_test_if_prototype">
                     <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_test_if_prototype">
                         <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
+                        <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" select="$system_cache__appinfo:new_object_by_prototype.base.simpleType"/>
                     </xsl:apply-templates>
                 </xsl:variable>
+                <xsl:message>#61 $system_cache__appinfo:new_object_by_prototype_test_if_prototype = <xsl:value-of select="count($system_cache__appinfo:new_object_by_prototype_test_if_prototype/*)" /></xsl:message>
                 <xsl:choose>
                     <xsl:when test="$system_cache__appinfo:new_object_by_prototype_test_if_prototype/*">
-                        <xsl:variable name="system_cache__appinfo:new_object_by_prototype.base" select="system_cache__appinfo:get_all_xsd_default_db/schema"/>
+                        <xsl:variable name="system_cache__appinfo:new_object_by_prototype.base" select="system_cache__appinfo:get_all_xsd_default_db/schema[ substring-after(@targetNamespace,'://')=substring-after($targetNamespace.base,'://')]/complexType[@name=$NamespaceObjectInstanceTable]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                        <xsl:message>#65 $system_cache__appinfo:new_object_by_prototype.base is in schema - OK applying</xsl:message>
+                        <!-- podciagniecie brakujacych simpleschema -->
+                        
+                            
+                        <xsl:message>#72 count system_cache__appinfo:new_object_by_prototype.base.simpleType= <xsl:value-of select="count($system_cache__appinfo:new_object_by_prototype.base.simpleType/*)"/></xsl:message>
                         <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype">
                             <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
+                            <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" select="$system_cache__appinfo:new_object_by_prototype.base.simpleType"/>
                         </xsl:apply-templates>
                     </xsl:when>
                     <xsl:otherwise>
@@ -69,8 +93,11 @@
     
     <xsl:template mode="system_cache__appinfo:new_object_by_prototype" match="system_cache__appinfo:get_all_xsd">
         <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/>
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" required="yes"/>
+        <xsl:message>#82 matched system_cache__appinfo:get_all_xsd <xsl:value-of select="schema/@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/> / <xsl:value-of select="schema/*[@id][1]/@id" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:message>
         <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype">
             <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
+            <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" select="$system_cache__appinfo:new_object_by_prototype.base.simpleType"/>
         </xsl:apply-templates>
     </xsl:template>
     
@@ -84,11 +111,94 @@
     
     <xsl:template mode="system_cache__appinfo:new_object_by_prototype_test_if_prototype" match="*|text()|comment()"/>
         
+    <xsl:template mode="system_cache__appinfo:new_object_by_prototype.base.simpleType" match="text()|comment()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
     
+    <xsl:template mode="system_cache__appinfo:new_object_by_prototype.base.simpleType" match="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <!-- add needed simpleType from prototype -->
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/>
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" required="yes"/><!-- this is complexType -->
+        <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace"  required="yes"/>
+        <xsl:param name="new_TargetNamespaceBindings_from_Namespace"  required="yes"/>
+        <xsl:param name="prototype_NamespacePrefix"  required="yes"/>
+        <xsl:message>#118 matched schema mode system_cache__appinfo:new_object_by_prototype.base.simpleType </xsl:message>
+        <xsl:variable name="base.simpleSchema.to.unique">
+        
+            <xsl:variable name="current" select="."/>
+                <xsl:for-each select="$system_cache__appinfo:new_object_by_prototype.base//element[@type]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                    <xsl:variable name="current.base" select="."/>
+                    <xsl:for-each-group select="$current//element[@type]" group-by="@type" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                            <xsl:choose>
+                                <xsl:when test="$current.base/@name = current()/@name" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                                    <xsl:message>#143 detected @name=<xsl:value-of select="$current.base/@name"/>; @type=<xsl:value-of select="$current.base/@type"/>; bypassing</xsl:message>
+                                    <!--<xsl:comment>#143 detected @name=<xsl:value-of select="$current.base/@name"/>; @type=<xsl:value-of select="$current.base/@type"/>; bypassing</xsl:comment>-->
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:message>#146 NOT detected name()=<xsl:value-of select="$current.base/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;  @name=<xsl:value-of select="$current.base/@name"/>; @type=<xsl:value-of select="$current.base/@type" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/> simpleTYpe for @type=<xsl:value-of select="$current.base/@type"/></xsl:message>
+                                    <xsl:comment>#146 NOT detected name()=<xsl:value-of select="$current.base/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;  @name=<xsl:value-of select="$current.base/@name"/>; @type=<xsl:value-of select="$current.base/@type" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/> simpleTYpe for @type=<xsl:value-of select="$current.base/@type"/></xsl:comment>
+                                    <!--<xsl:copy-of select="$system_cache__appinfo:new_object_by_prototype.base.simpleType//simpleType[@name = system_cache__appinfo:clean_object_prefix(@type) ]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>-->
+                                    <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_root" select="$system_cache__appinfo:new_object_by_prototype.base.simpleType[@name=$current.base/system_cache__appinfo:clean_object_prefix(@type)]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                                        <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base"  select="$system_cache__appinfo:new_object_by_prototype.base"/>
+                                        <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
+                                        <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
+                                        <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+                                    </xsl:apply-templates>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                    </xsl:for-each-group>
+                </xsl:for-each>
+        </xsl:variable>
+        <xsl:for-each-group select="$base.simpleSchema.to.unique/simpleType" group-by="@name" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+            <xsl:copy-of select="."/>
+        </xsl:for-each-group>
+    </xsl:template>
     
+    <xsl:template mode="system_cache__appinfo:new_object_by_prototype.base.simpleType" match="*" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <!-- add needed simpleType from prototype -->
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/>
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" required="yes"/><!-- this is complexType -->
+        
+        <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype.base.simpleType">
+            <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base"  select="$system_cache__appinfo:new_object_by_prototype.base"/>
+            <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base.simpleType"  select="$system_cache__appinfo:new_object_by_prototype.base.simpleType"/>
+        </xsl:apply-templates>
+    </xsl:template>
     
-    <xsl:template mode="system_cache__appinfo:new_object_by_prototype" match="schema[@targetNamespace=$prototype_object_namespace]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    <xsl:template mode="system_cache__appinfo:new_object_by_prototype.base.simpleType" match="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <!-- add needed simpleType from prototype -->
         <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/>
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" required="yes"/><!-- this is complexType -->
+        
+        <xsl:message>#115 matched sequence/ </xsl:message>
+        <xsl:comment>#115 matched sequence/ </xsl:comment>
+       
+           <xsl:variable name="current" select="current()"/>
+            <!--<xsl:for-each select="$system_cache__appinfo:new_object_by_prototype.base//element[@type]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"> <!-\- if priority is for prototype TODO -\->-->
+               <!-- najpierw sprawdzamy czy element juz nie byl, priorytet ma @typ z prototypu? todo  -->
+                <xsl:choose>
+                    <xsl:when test="$current/@name = current()/@name">
+                        <xsl:message>#143 detected @name=<xsl:value-of select="@name"/>; element/@type=<xsl:value-of select="@type"/>; bypassing</xsl:message>
+                        <xsl:comment>
+#143 detected <xsl:value-of select="@name"/> element, bypassing
+</xsl:comment>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:message>#146 NOT detected <xsl:value-of select="@name"/> element, trying to add @type=<xsl:value-of select="@type"/> simpleTYpe for @type=<xsl:value-of select="@type"/></xsl:message>
+                        <xsl:comment>
+#146 NOT detected <xsl:value-of select="@name"/> element, trying to add @type simpleTYpe for @type=<xsl:value-of select="@type"/>, found <xsl:value-of select="count($system_cache__appinfo:new_object_by_prototype.base.simpleType//simpleType[@name = system_cache__appinfo:clean_object_prefix(@type) ])"/>
+</xsl:comment>
+                        <!--<xsl:copy-of select="$system_cache__appinfo:new_object_by_prototype.base.simpleType//simpleType[@name = system_cache__appinfo:clean_object_prefix(@type) ]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>-->
+                        <xsl:value-of select="$system_cache__appinfo:new_object_by_prototype.base.simpleType/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
+              
+           <!-- </xsl:for-each>-->
+        
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__appinfo:new_object_by_prototype" match="schema[@targetNamespace=$prototype_object_namespace]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/> <!-- this is complexType -->
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" required="yes"/>
         <xsl:variable name="prototype_TargetNamespaceBindings_from_Namespace">
             <xsl:call-template name="system_cache__appinfo:TargetNamespaceBindings_from_Namespace">
                 <xsl:with-param name="TargetNamespace" select="$prototype_object_namespace"/>
@@ -120,9 +230,9 @@
                 <xsl:copy-of select="$prototype_NamespacePrefix"/>
             </prototype_NamespacePrefix>
             <xsl:choose>
-                <xsl:when test=" doc-available(concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd'))">
+                <xsl:when test="$object_modeling.Error.Handling='IGNORE' and doc-available(concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd'))">
                     <ERROR>
-                        <xsl:attribute name="message" select="'document already generated and aviable'"/>
+                        <xsl:attribute name="message" select="concat('document already generated and aviable at ',$procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd')"/>
                         OUTPUT__START
                         document already generated and aviable
                         OUTPUT__END
@@ -130,32 +240,47 @@
                 </xsl:when>
                 <xsl:otherwise>
                     <xsl:result-document href="{ concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd')}">
+                        <xsl:message>#139 saving to <xsl:value-of select="concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd')"/></xsl:message>
                         <!--<xsl:attribute name="href" select=" concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd')"/>-->
                         <xsl:element name="xs:schema">
                             <xsl:copy-of select="namespace::node()"/>
                             <xsl:namespace name="{$new_TargetNamespaceBindings_from_Namespace//@NamespacePrefix}" select="$new_object_namespace"/>
                             <xsl:attribute name="targetNamespace" select="$new_object_namespace"/>
+                            <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
+                            <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
                             <xsl:variable name="system_cache__appinfo:check_if_schema_element_exists_by_base" >
                                 <xsl:call-template name="system_cache__appinfo:check_if_schema_element_exists_by_base">
                                     <xsl:with-param name="base" select="$system_cache__appinfo:new_object_by_prototype.base/*"/>
                                     <xsl:with-param name="prototype" select="*"/>
                                 </xsl:call-template>
                             </xsl:variable>
-                            <debug.143>
+                            <!--<debug.143>
                                 <xsl:attribute name="base" select="$system_cache__appinfo:new_object_by_prototype.base/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" />
                                 <xsl:attribute name="prototype" select="name()"/>
                                 <xsl:copy-of select="$system_cache__appinfo:check_if_schema_element_exists_by_base"/>
-                            </debug.143>
-                            <debug.147.base>
+                            </debug.143>-->
+                            <!--<debug.147.base>
                                 
                                 <xsl:copy-of select="$system_cache__appinfo:new_object_by_prototype.base"/>
-                            </debug.147.base>
+                            </debug.147.base>-->
+                            
+                            
+                            
                             <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_root">
                                 <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
                                 <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
                                 <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
                                 <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
                             </xsl:apply-templates>
+                            
+                            <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype.base.simpleType" select="." >
+                                <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base.simpleType" select="$system_cache__appinfo:new_object_by_prototype.base.simpleType"/>
+                                <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
+                                
+                                <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
+                                <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
+                                <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+                            </xsl:apply-templates>
                         </xsl:element>
                     </xsl:result-document>
                 </xsl:otherwise>
@@ -168,16 +293,14 @@
         <xsl:copy-of select="."/>
     </xsl:template>
     
-    
-    
-    <xsl:template mode="system_cache__appinfo:new_object_by_prototype_schema_root" match="element|complexType|simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+    <xsl:template mode="system_cache__appinfo:new_object_by_prototype_schema_root" match="complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
         <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
         <xsl:param name="prototype_NamespacePrefix" required="yes"/>
         <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/>
         
         <xsl:element name="{name()}">
-            <xsl:message>#145 debug name form prototype is <xsl:value-of select="$system_cache__appinfo:new_object_by_prototype.base/name()"/></xsl:message>
+            <xsl:message>#145 debug name form prototype is <xsl:value-of select="$system_cache__appinfo:new_object_by_prototype.base/name()"/>//<xsl:value-of select="*/name()"/></xsl:message>
             <xsl:apply-templates select="@*" mode="system_cache__appinfo:new_object_by_prototype_schema_root">
                 <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
                 <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
@@ -189,6 +312,30 @@
                 <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
                 <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
                 <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+                <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__appinfo:new_object_by_prototype_schema_root" match="element|simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
+        <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
+        <xsl:param name="prototype_NamespacePrefix" required="yes"/>
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/>
+        <xsl:element name="{name()}">
+            <xsl:message>#145 debug name form prototype is <xsl:value-of select="$system_cache__appinfo:new_object_by_prototype.base/name()"/>//<xsl:value-of select="*/name()"/></xsl:message>
+            <xsl:apply-templates select="@*" mode="system_cache__appinfo:new_object_by_prototype_schema_root">
+                <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
+                <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
+                <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+            </xsl:apply-templates>
+            <!--<xsl:attribute name="id" select="concat(substring($new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,0,8),'_', substring(replace(@name,$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable),0,5),'_',generate-id())"/>-->
+            <!--<xsl:attribute name="name" select=" replace(@name,$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'InfrastructureAAAA')"/>-->
+            <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_child">
+                <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
+                <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
+                <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+                <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
             </xsl:apply-templates>
         </xsl:element>
     </xsl:template>
@@ -197,22 +344,58 @@
         <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
         <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
         <xsl:param name="prototype_NamespacePrefix" required="yes"/>
-        <xsl:message>#200 matched <xsl:value-of select="name()"/></xsl:message>
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/>
+        <xsl:message>#200 matched <xsl:value-of select="name()"/>//<xsl:value-of select="*/name()"/></xsl:message>
         <xsl:element name="{name()}">
             <!--<xsl:attribute name="id" select="concat(substring($new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,0,15),'_',generate-id())"/>-->
         <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_child">
             <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
             <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
             <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+            <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
         </xsl:apply-templates>
+            <xsl:variable name="current" select="."/>
+            <xsl:message>#269 testing merge sequence - should be sequence=sequence=<xsl:value-of select="$system_cache__appinfo:new_object_by_prototype.base/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:message>
+            <xsl:for-each select="$system_cache__appinfo:new_object_by_prototype.base/sequence/element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                <xsl:choose>
+                    <xsl:when test="@name">
+                        <xsl:choose>
+                            <xsl:when test="$current/element[@name =  current()/@name]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                                <xsl:message>#272 found ignored <xsl:value-of select="@name"/></xsl:message>
+                                <xsl:comment>#272 found ignored <xsl:value-of select="@name"/></xsl:comment>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:comment>#272-A found adding <xsl:value-of select="@name"/>, $prototype_NamespacePrefix = <xsl:value-of select="$prototype_NamespacePrefix"/></xsl:comment>
+                                <xsl:element name="{name()}">
+                                    <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_child" select="@*">
+                                        <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
+                                        <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
+                                        <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+                                        <xsl:with-param name="node" select="."/>
+                                    </xsl:apply-templates>
+                                </xsl:element>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:when test="@ref">
+                        <xsl:message terminate="yes">#288 unsupported yed @ref <xsl:value-of select="@ref"/></xsl:message>
+                    </xsl:when>
+                    
+                    
+                </xsl:choose>
+            </xsl:for-each>
         </xsl:element>
     </xsl:template>
     
+    
+    
+    
     <xsl:template match="element|complexContent|restriction|enumeration|minInclusive" mode="system_cache__appinfo:new_object_by_prototype_schema_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
         <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
         <xsl:param name="prototype_NamespacePrefix" required="yes"/>
-        <xsl:message>#215 matched <xsl:value-of select="name()"/>/<xsl:value-of select="@name"/></xsl:message>
+        <xsl:param name="system_cache__appinfo:new_object_by_prototype.base" required="yes"/>
+        <xsl:message>#215 matched <xsl:value-of select="name()"/>/<xsl:value-of select="@name"/>//<xsl:value-of select="*/name()"/></xsl:message>
         <xsl:element name="{name()}">
             <xsl:copy-of select="@minOccurs"/>
             <xsl:copy-of select="@maxOccurs"/>
@@ -226,7 +409,9 @@
                 <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
                 <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
                 <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+                <xsl:with-param name="system_cache__appinfo:new_object_by_prototype.base" select="$system_cache__appinfo:new_object_by_prototype.base"/>
             </xsl:apply-templates>
+            
         </xsl:element>
     </xsl:template>
     
@@ -255,7 +440,19 @@
         <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
         <xsl:param name="prototype_NamespacePrefix" required="yes"/>
         <!--<xsl:attribute name="{name()}" select=" concat($prototype_NamespacePrefix,':', substring-after(.,':'),'__to__',concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable, ':',  replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable  )) )"/>-->
-        <xsl:attribute name="{ name()}" select=" replace(., concat($prototype_NamespacePrefix,':', substring-after(.,':')),  concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,':',  replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable  ) )  )"/>
+        <xsl:choose>
+            <xsl:when test="contains( system_cache__appinfo:get_object_prefix(.),system_cache__appinfo:prefix_from_targetNamespace($system_cache__appinfo:vrtfNamespaces,$targetNamespace.base))">
+                <!--<xsl:attribute name="debug.335" select="$targetNamespace.base"/>-->
+                <!--<xsl:attribute name="debug.336" select="."/>-->
+                <!--<xsl:attribute name="debug.337" select="system_cache__appinfo:prefix_from_targetNamespace($system_cache__appinfo:vrtfNamespaces,$targetNamespace.base)"/>-->
+                <!--<xsl:attribute name="{ name()}" select=" replace(., concat(system_cache__appinfo:prefix_from_targetNamespace($system_cache__appinfo:vrtfNamespaces,$targetNamespace.base),':'),  concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,':',  replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable  ) )  )"/>-->
+                <xsl:attribute name="{ name()}" select=" replace(., concat(system_cache__appinfo:prefix_from_targetNamespace($system_cache__appinfo:vrtfNamespaces,$targetNamespace.base),':', substring-after(.,':')),  concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,':',  replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable  ) )  )"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="{ name()}" select=" replace(., concat($prototype_NamespacePrefix,':', substring-after(.,':')),  concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,':',  replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable  ) )  )"/>
+            </xsl:otherwise>
+        </xsl:choose>
+        
     </xsl:template>
     
     <xsl:template match="@*" mode="system_cache__appinfo:new_object_by_prototype_schema_child">
@@ -276,6 +473,9 @@
     <xsl:template match="@name" mode="system_cache__appinfo:new_object_by_prototype_schema_root">
         <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
         <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
+        <!--<xsl:attribute name="debug.476" select="."/>-->
+        <!--<xsl:attribute name="debug.477" select="$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable"/>-->
+        <!--<xsl:attribute name="debug.478" select="$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable"/>-->
         <xsl:attribute name="{ name()}" select=" replace(.,$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable)"/>
     </xsl:template>
     

+ 27 - 6
SE/schema/default_db_xml_cache.public/object_modeling_new.xsl

@@ -16,6 +16,7 @@
     <xsl:param name="template_object.xml_location" required="yes"/> <!-- <xsl:variable name="template_object.xml_location" select="concat($object_modeling_new_repository,'/',$NamespaceDatabaseStorageDefinitionPrefix,'/',$NamespaceObjectInstanceType,'/',$NamespaceObjectInstanceTable,'.xml')"/> -->
     <xsl:param name="object_modeling_new_basedir_repository" required="yes"/> <!-- location where is template modified objects repository for debug only -->
     
+    <xsl:param name="object_modeling.Error.Handling" select="'IGNORE'"/> <!-- ERROR / IGNORE / OVERWRITE / MERGE (todo)  -->
     
     <!--<xsl:param name="prototype_object_namespace" select="'https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd'"/>--> <!-- for default prototype object set in child xsl -->
     
@@ -65,11 +66,16 @@
                 <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_test_if_exists"/>
             </xsl:variable>
             <xsl:choose>
-                <xsl:when test="$system_cache__appinfo:object_modeling_new_test_if_exists/*">
+                <xsl:when test="$system_cache__appinfo:object_modeling_new_test_if_exists/* and $object_modeling.Error.Handling='ERROR'">
                     <ERROR>
                         Object already defined in current schema
                     </ERROR>
                 </xsl:when>
+                <xsl:when test="$system_cache__appinfo:object_modeling_new_test_if_exists/* and $object_modeling.Error.Handling='IGNORE'">
+                    <WARNING>
+                        Object already defined in current schema - but ignoring due to $object_modeling.Error.Handling param set to <xsl:value-of select="$object_modeling.Error.Handling"/>
+                    </WARNING>
+                </xsl:when>
                 <xsl:otherwise>
                     <OK>
                         We try to create new object in <xsl:value-of select="$template_object.xml_location"/>
@@ -144,9 +150,24 @@
     <xsl:template mode="system_cache__appinfo:object_modeling_new_test_if_exists" match="schema[@targetNamespace=$TargetNamespace_from_Bindings//@TargetNamespace]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <!-- not good - we have some objects already in this schema -->
         <!--<xsl:copy-of select="."/>-->
-        <ERROR>
-            Object already defined in current schema
-        </ERROR>
+        <xsl:choose>
+            <xsl:when test="$object_modeling.Error.Handling='ERROR'">
+                <ERROR>
+                    Object already defined in current schema
+                </ERROR>
+            </xsl:when>
+            <xsl:when test="$object_modeling.Error.Handling='IGNORE'">
+                <WARNING>
+                    Object already defined in current schema - but ignoring due to $object_modeling.Error.Handling param set to <xsl:value-of select="$object_modeling.Error.Handling"/> 
+                </WARNING>
+            </xsl:when>
+            <xsl:otherwise>
+                <ERROR>
+                    Object already defined in current schema
+                </ERROR>
+            </xsl:otherwise>
+        </xsl:choose>
+        
         <!--<xsl:copy-of select="."/>-->
     </xsl:template>
     
@@ -171,8 +192,8 @@
                 <xsl:namespace name="{$TargetNamespace_from_Bindings//@Prefix}" select="$TargetNamespace_from_Bindings//@TargetNamespace"/>
                 <xsl:attribute name="elementFormDefault" select="'qualified'"/>
                 <xsl:attribute name="targetNamespace" select="$TargetNamespace_from_Bindings//@TargetNamespace"/>
-                <xsl:attribute name="vc:minVersion" select="'1.0'"/>
-                <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
+                <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
                 <xs:complexType name="{$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable}">
                     <xs:sequence />
                 </xs:complexType>

+ 26 - 5
SE/schema/default_db_xml_cache.public/object_modeling_new_by_xml_schema.xsl

@@ -2,6 +2,7 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
     exclude-result-prefixes="xs"
     version="2.0">
     
@@ -13,9 +14,10 @@
     <!--<xsl:param name="new_object_namespace" required="yes"/>--> <!-- example https://biuro.biall-net.pl/wfs/default_db/table/CRM_PROCES.xsd -->
    
     <xsl:param name="default_db.xml" required="yes"/>
+    <xsl:param name="vc:minVersion" select="'1.1'" />
+    <xsl:param name="vc:maxVersion"/>
     
-    
-    
+    <xsl:param name="debug" select="4"/>
     
     
     <!-- based on object_modeling_new.xsl for use with  system_cache__appinfo:object_modeling_new_by_xml_schema in build_object_modelling_new.xml - to generate merged object from default_db.xml and prototype from Type -->
@@ -43,11 +45,16 @@
                 <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_test_if_exists"/>
             </xsl:variable>
             <xsl:choose>
-                <xsl:when test="$system_cache__appinfo:object_modeling_new_test_if_exists/*">
+                <xsl:when test="$system_cache__appinfo:object_modeling_new_test_if_exists/* and $object_modeling.Error.Handling='ERROR'">
                     <ERROR>
                         Object already defined in current schema
                     </ERROR>
                 </xsl:when>
+                <xsl:when test="$system_cache__appinfo:object_modeling_new_test_if_exists/* and $object_modeling.Error.Handling='IGNORE'">
+                    <WARNING>
+                        Object already defined in current schema - but ignoring due to $object_modeling.Error.Handling param set to <xsl:value-of select="$object_modeling.Error.Handling"/>
+                    </WARNING>
+                </xsl:when>
                 <xsl:otherwise>
                     <OK>
                         We try to create new object in <xsl:value-of select="$template_object.xml_location"/>
@@ -74,12 +81,14 @@
     
     
     <xsl:template mode="system_cache__appinfo:object_modeling_new_add_xml_schema" match="schema[@targetNamespace=$prototype_object_namespace]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
-        <xsl:result-document href="{$template_object.xml_location}">
+        <xsl:message>#83 hit found schema @targetNamespace=$prototype_object_namespace</xsl:message>
+        <!--<xsl:result-document href="{$template_object.xml_location}"> DEBUG SAVE OFF-->
             <xsl:message>#78 saving to <xsl:value-of select="$template_object.xml_location"/></xsl:message>
             <xsl:element name="xs:schema">
                 <xsl:copy-of select="namespace::node()"/>
                 <xsl:namespace name="{$new_TargetNamespaceBindings_from_Namespace//@NamespacePrefix}" select="$TargetNamespace_from_Bindings//@TargetNamespace"/>
                 <xsl:attribute name="targetNamespace" select="$TargetNamespace_from_Bindings//@TargetNamespace"/>
+                <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
                 <xsl:variable name="prototype_NamespacePrefix">
                     <xsl:for-each select="namespace::node()">
                         <xsl:if test=".= $prototype_object_namespace">
@@ -94,6 +103,18 @@
                 <xsl:if test="$targetNamespace.base='${targetNamespace.base}'"><xsl:message terminate="yes">#91 not set <xsl:value-of select="$targetNamespace.base"/></xsl:message></xsl:if>
                 <!--<xsl:variable name="merge_complexType" select="doc($default_db.xml)//complexType[@name=$NamespaceObjectInstanceTable]/sequence" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>--><!-- TODO use system schema instead -->
                 <xsl:variable name="merge_complexType" select="root()//system_cache__appinfo:get_all_xsd_default_db/schema[ substring-after(@targetNamespace,'://')=substring-after($targetNamespace.base,'://')]/complexType[@name=$NamespaceObjectInstanceTable]/sequence" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                <xsl:message>#105 $merge_complexType count() <xsl:value-of select="count($merge_complexType/*)"/></xsl:message>
+                <xsl:comment>#105 $merge_complexType count() <xsl:value-of select="count($merge_complexType/*)"/></xsl:comment>
+                <xsl:choose>
+                    <xsl:when test="number($debug) &gt; 2">
+                        <xsl:comment>#107 debug </xsl:comment>
+                        <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_add_xml_schema_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                            <xsl:with-param name="merge_complexType" select="$merge_complexType"/>
+                        </xsl:apply-templates>
+                        <xsl:comment>#107 debug EOF</xsl:comment>
+                    </xsl:when>
+                </xsl:choose>
+                
                 <xsl:variable name="schema_merged">
                     <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_add_xml_schema_root" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                         <xsl:with-param name="merge_complexType" select="$merge_complexType"/>
@@ -120,7 +141,7 @@
                 </debug_90>-->
                 
             </xsl:element>
-        </xsl:result-document>
+        <!--</xsl:result-document>-->
     </xsl:template>
     
     

+ 7 - 2
SE/schema/default_db_xml_cache.public/system_cache__appinfo/TargetNamespaceBindings.xsl

@@ -96,8 +96,13 @@
                     </system_cache__appinfo:binding>
                 </xsl:otherwise>
             </xsl:choose>
-            
-        
+    </xsl:template>
+    
+    
+    <xsl:template name="system_cache__appinfo:new_object_namespace"> <!-- used in build_object_modeling_new.child.xsl and object_modeling_build_infrastructure.xsl -->
+        <xsl:param name="TargetNamespace" required="yes"/> <!-- e.g. ${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType} -->
+        <xsl:param name="name" required="yes"/> <!-- e.g. prototype/base element/complexType @name from schema -->
+        <xsl:value-of select="concat($TargetNamespace,'/',$name,'.xsd')"/>
     </xsl:template>
     
 </xsl:stylesheet>