Przeglądaj źródła

Nowy sposob przetwazania recurse ant dla druku

a.binder 9 lat temu
rodzic
commit
b19fb9793d
27 zmienionych plików z 3697 dodań i 612 usunięć
  1. 75 0
      SE/schema/WPS_Functions/build_WPS_Functions.xml
  2. 0 172
      SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/build.xml
  3. 270 0
      SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/build_CRM_PROCES_tree.xml
  4. 64 0
      SE/schema/WPS_Functions/default_db/check_java_process_count/build_check_java_process_count.xml
  5. 116 0
      SE/schema/WPS_Functions/default_db/recurse_ant/IN7_DZIENNIK_KORESP.dita
  6. 95 16
      SE/schema/WPS_Functions/default_db/recurse_ant/build_recurse_ant.xml
  7. 218 0
      SE/schema/WPS_Functions/get_wfs/build_get_wfs.xml
  8. 68 0
      SE/schema/WPS_Functions/object_modeling/build_object_modeling.xml
  9. 79 0
      SE/schema/WPS_Functions/object_modeling_build_infrastructure/build_object_modeling_build_infrastructure.xml
  10. 48 0
      SE/schema/WPS_Functions/object_modeling_build_infrastructure/object_modeling_build_infrastructure.xsl
  11. 40 0
      SE/schema/WPS_Functions/object_modeling_by_default_db_xml_schema/build_object_modeling_by_default_db_xml_schema.xml
  12. 254 0
      SE/schema/WPS_Functions/object_modeling_new/build_object_modeling_new.xml
  13. 1 0
      SE/schema/ant-url_action/default_db.in7_dziennik_koresp/check_java_process_count
  14. 88 12
      SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build_recurse_ant.xml
  15. 1 0
      SE/schema/ant-url_action/get_wfs
  16. 4 1
      SE/schema/default_db_xml_cache.public/build_ant_universal_by_xsl_match.xsl
  17. 554 269
      SE/schema/default_db_xml_cache.public/build_recurse_ant.xsl
  18. 299 69
      SE/schema/default_db_xml_cache.public/build_recurse_ant_merge_dita_from_temp.xsl
  19. 177 0
      SE/schema/default_db_xml_cache.public/build_recurse_ant_xsl_xpath_filter.xsl
  20. 262 70
      SE/schema/default_db_xml_cache.public/builds_to_ant.xsl
  21. 31 0
      SE/schema/default_db_xml_cache.public/default_db/CRM_PROCES/CRM_PRZYPADEK.xsl
  22. 467 0
      SE/schema/default_db_xml_cache.public/default_db/CRM_PROCES/PROCES_INIT_tree_to_dita.xsl
  23. 334 0
      SE/schema/default_db_xml_cache.public/default_db/IN7_MK_BAZA_DYSTRYBUCJI/IN7_MK_BAZA_DYSTRYBUCJI_tree_to_dita.xsl
  24. 16 0
      SE/schema/default_db_xml_cache.public/default_db/extract_text.xsl
  25. 40 0
      SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.xsl
  26. 49 0
      SE/schema/default_db_xml_cache.public/system_cache__appinfo/postprocess.xsl
  27. 47 3
      SE/schema/default_db_xml_cache.public/xpath_query_check_create_xsl.xsl

+ 75 - 0
SE/schema/WPS_Functions/build_WPS_Functions.xml

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="../." name="build_WPS_Functions">
+  
+  
+    <!-- parent properties -->
+    <property name="build_root.xml" location="${basedir}/build.xml"/>
+    <property name="build_properties" location="${basedir}/build_properties" />
+  
+    <!-- modules WPS_Functions - to be copied to any module needed -->
+    <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"/>
+    <!-- eof modules WPS_Functions  -->
+  
+  <!-- modules properties copied / controlled references -->
+    
+    <property name="object_modeling_basedir" location="${basedir}/WPS_Functions/object_modeling"  />
+    <property name="object_modeling_build" location="${object_modeling_basedir}/build_object_modeling.xml"  />
+    <property name="object_modeling_new_basedir" location="${basedir}/WPS_Functions/object_modeling_new"  />
+    <property name="object_modeling_by_default_db_xml_schema_basedir" location="${basedir}/WPS_Functions/object_modeling_by_default_db_xml_schema"  />
+    
+    <property name="default_db:recurse_ant_basedir" location="${basedir}/WPS_Functions/default_db/recurse_ant"/>
+    <!--<property name="default_db:recurse_ant_basedir.temp" location="${default_db:recurse_ant_basedir}/temp/${uuid}"/>-->
+    <property name="default_db:recurse_ant_basedir.out" location="${default_db:recurse_ant_basedir}/out"/>
+    <property name="default_db:recurse_ant" location="${default_db:recurse_ant_basedir}/build_recurse_ant.xml"/>
+    
+    <property name="get_wfs_basedir" location="${basedir}/WPS_Functions/get_wfs"/><!-- to ordinary retrieve wfs data  -->
+    <property name="get_wfs_basedir.temp" location="${get_wfs_basedir}/temp"/>
+    <property name="get_wfs" location="${get_wfs_basedir}/build_get_wfs.xml"/><!-- to ordinary retrieve wfs data  -->
+    
+    <property  name="object_modeling_new.xsl" location="${basedir}/default_db_xml_cache.public/object_modeling_new.xsl"/>
+    <property  name="object_modeling.xsl" location="${basedir}/default_db_xml_cache.public/object_modeling.xsl"/>
+    
+    <property name="build_CRM_PROCES_tree" location="${WPS_Functions}/default_db/CRM_PROCES_tree/build_CRM_PROCES_tree.xml"/>
+    
+    <property name="build_check_java_process_count.xml"  value="${basedir}/WPS_Functions/default_db/check_java_process_count/build_check_java_process_count.xml"/><!-- will set  output current max process in STDOUT - by using with ps ax|grep ant-launcher |wc -l -->
+        
+    <property name="mapserver_gml_to_png" location="${basedir}/WPS_Functions/mapserver_gml_to_png/build_mapserver_gml_to_png.xml"/>
+    <property name="mapserver_gml_to_png_basedir" location="${basedir}/WPS_Functions/mapserver_gml_to_png"  />                         
+    <property name="mapserver_gml_to_png_basedir.temp" location="${mapserver_gml_to_png_basedir}/temp"  />
+    
+        
+    <property name="postprocess.xsl" location="${basedir}/default_db_xml_cache.public/system_cache__appinfo/postprocess.xsl"/>
+    <!-- EOF modules properties copied / controlled references -->
+    
+    
+ 
+    
+   <!-- <property name="wfs_output.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>
+    <property name="wfs_result.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_result.xml"/>
+    <property name="wfs_error.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_error.xml"/>
+    <property name="wfs_timestamp.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_timestamp.xml"/>
+    -->
+    
+    
+  
+    <target name="save_build_properties" > <!-- todo nie wiem czy trzymac properties tu i tam - do optymalziacji-->
+        <!-- ${uuid} -->
+        <ant antfile="${build_root.xml}"  target="save_build_properties"/>
+        <loadproperties srcfile="${build_properties}"/>
+        
+        <property name="PROCES_INIT_tree_to_dita.xsl" location="${default_db_xml_cache.public}/default_db/CRM_PROCES/PROCES_INIT_tree_to_dita.xsl"/> <!-- to disable and use tree_to_dita.xsl which includes it  -->
+        <property name="tree_to_dita.xsl" location="${default_db_xml_cache.public}/default_db/tree_to_dita.xsl"/>
+        <property name="api_url" value="${TargetNamespaceBindings}/SE/version-git/wfs-data.php"/> <!-- TO BE SET FROM LICENCE -->
+        <property name="namespace_prefix" value="default_db"/>
+        <property name="namespace_prefix_p5_tr_map" value="default_db"/>
+        <property name="p5_tr_map_dir" location="${p5_tr_map.local}"/>
+        <property name="simpleSchema_dir" location="${simpleSchema.local}"/>
+        <property name="detect_resource_type_dir" location="${detect_resource_type.local}"/>
+        <property name="build_complexType_dir" location="${build_complexType.local}"/>
+        <echoproperties destfile="${build_WPS_Functions.xml.properties}" />
+    </target>
+  
+  
+</project>

+ 0 - 172
SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/build.xml

@@ -1,172 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project basedir="../../../." name="CRM_PROCES_tree" default="default_db:PROCES_INIT:tree"
-    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
-    <description>
-        To retrieve process tree - just process menu and structurized processes
-    </description>
-    
-    <property name="CRM_PROCES_tree_basedir" location="${basedir}/WPS_Functions/default_db/CRM_PROCES_tree"  />                         
-    
-    <property name="CRM_PROCES_tree_basedir.temp" location="${CRM_PROCES_tree_basedir}/temp"  />
-    
-    <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="build_properties.xml" location="${public_html}/build_properties.xml" />
-    
-    
-    
-    
-    <target name="default_db:CRM_PROCES:tree:create_tempdir">
-        <mkdir dir="${CRM_PROCES_tree_basedir.temp}"/>
-    </target>
-    
-    <target name="read_build_properties.xml" depends="default_db:CRM_PROCES:tree:create_tempdir">
-        <ant antfile="${root_build.xml}" target="save_build_properties.xml"/>
-        <loadproperties srcfile="${build_properties.xml}"/>
-    </target>
-    
-    
-    
-    
-    <target name="default_db:CRM_PROCES:tree" depends="read_build_properties.xml">
-        <ant antfile="${default_db:recurse_ant}"  target="clean_temp_dir"/>
-        <ant antfile="${default_db:recurse_ant}"  target="xml_recursed_from_tr_map_with_RelatedFeatureLoop">
-            <property name="uuid" value="CRM_PROCES_tree"/>
-            <property name="typeName" value="p5_default_db:CRM_PROCES"/>
-            <property name="xpath" value="PARENT_ID"/>
-            <property name="xpath_value" value="0"/>
-            <property name="xpath_query" value="[ not(local-name()='PROCES_INIT') and  not(local-name()='CRM_WSKAZNIK') and not(local-name()='CRM_LISTA_ZASOBOW') ]"/>
-        </ant>        
-    </target>
-    
-    
-    
-    <target name="default_db:PROCES_INIT:from_recurse" depends="read_build_properties.xml">
-        <ant antfile="${default_db:recurse_ant}"  target="clean_temp_dir"/>
-        <ant antfile="${default_db:recurse_ant}"  target="xml_recursed_from_tr_map_with_RelatedFeatureLoop">
-            <property name="uuid" value="PROCES_INIT_list"/>
-            <property name="typeName" value="default_db:PROCES_INIT"/>
-            <property name="xpath" value="TYPE"/>
-            <property name="xpath_value" value="PROCES_INIT"/>
-            <property name="xpath_query" value="[ local-name()='PROCES_INIT' ]"/>
-        </ant>      
-        <loadfile property="PROCES_INIT.RelatedFeatureRoot" srcfile="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"/>
-    </target>
-    
-    
-    
-    <target name="default_db:PROCES_INIT"   depends="read_build_properties.xml" description="Get Process List">
-        <echo>TODO currently testing just one process 994  ${default_db:recurse_ant}
-            simpleSchema_dir = ${simpleSchema_dir}</echo>
-        <property name="uuid" value="PROCES_INIT_list"/>
-        <ant antfile="${get_wfs}" target="GetFeature">
-            <property name="uuid" value="${uuid}"/>
-            <property name="typeName" value="default_db:CRM_PROCES"/>
-            <property name="xpath" value="TYPE"/>
-            <property name="xpath_value" value="PROCES_INIT"/>
-            
-            <!--<property name="xpath_query" value="[1=2 ]"/>-->
-        </ant>
-        <loadfile property="PROCES_INIT.FeatureCollection" srcfile="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>
-        <!--<echo>$PROCES_INIT.FeatureCollection ${PROCES_INIT.FeatureCollection}</echo>-->
-    </target>
-    
-    <target name="default_db:PROCES_INIT:tree_from_wfs"   depends="read_build_properties.xml,default_db:PROCES_INIT" description="By generating default_db:CRM_PROCES:tree we will respond with structurized PROCES_INIT with child process and resources xml structures - in parallel ant queries">
-        <!-- foreach PROCES_INIT.FeatureCollection/  -->
-        <property name="uuid" value="PROCES_INIT_list"/><!-- moze nie dzialac nowe uuid -->
-        <loadfile property="PROCES_INIT.FeatureCollection" srcfile="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>
-        <property name="default_db:PROCES_INIT:tree.raport.xml" location="${CRM_PROCES_tree_basedir.temp}/PROCES_INIT_list.raport.xml"/>
-        <tempfile property="properties.xml" prefix="properties-for-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>
-        <tempfile property="properties_override.xml" prefix="properties_override-for-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>
-        <echoxml file="${properties_override.xml}">
-            <properties>
-                <property name="uuid" value="PROCES_INIT_TREE_$${xpath_value}"/> <!-- to be evaluated in child xsl/ant-->
-                <property name="typeName" value="default_db:PROCES_INIT"/>
-                <property name="xpath" value="ID"/>
-            </properties>
-        </echoxml>
-        <!--<property name="uuid" value="PROCES_INIT_TREE_$${xpath_value}"/>-->
-        <echoproperties destfile="${properties.xml}" format="xml"/>
-        
-        <!--<loadfile property="PROCES_INIT.RelatedFeatureRoot" srcfile="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"/>-->
-        <!--<echo> $PROCES_INIT.RelatedFeatureRoot ${PROCES_INIT.RelatedFeatureRoot}</echo>-->
-        <delete file="${default_db:PROCES_INIT:tree.raport.xml}"/>
-        
-        <xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${build_ant_universal_by_xsl_match.xsl}" in="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"  destdir="${CRM_PROCES_tree_basedir.temp}" out="${default_db:PROCES_INIT:tree.raport.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"/>
-            <param name="antfile_prefix" expression="PROCES_INIT_tree_child"/>
-            <param name="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
-            <param name="basedir" expression="${CRM_PROCES_tree_basedir}"/>
-            <param name="antfile" expression="${default_db:recurse_ant}"/>
-            <param name="target" expression="xml_recursed_from_tr_map_with_RelatedFeatureLoop"/>
-            <param name="match_child_element" expression="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="10"/>
-        </xslt>
-    </target>
-    
-    <!-- depends ,default_db:PROCES_INIT:from_recurse -->
-    <target name="default_db:PROCES_INIT:tree"   depends="read_build_properties.xml" description="By generating default_db:CRM_PROCES:tree we will respond with structurized PROCES_INIT with child process and resources xml structures - in parallel ant queries">
-        <!-- foreach PROCES_INIT.FeatureCollection/  -->
-        <property name="uuid" value="PROCES_INIT_list"/>
-        
-        <property name="default_db:PROCES_INIT:tree.raport.xml" location="${CRM_PROCES_tree_basedir.temp}/build_PROCES_INIT_list.raport.xml"/>
-        <tempfile property="properties.xml" prefix="properties-for-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>
-        <tempfile property="properties_override.xml" prefix="properties_override-for-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>
-        <echoxml file="${properties_override.xml}">
-            <properties>
-                <property name="uuid" value="PROCES_INIT_TREE_$${xpath_value}"/> <!-- to be evaluated in child xsl/ant-->
-                <property name="typeName" value="default_db:PROCES_INIT"/>
-                <property name="xpath" value="ID"/>
-            </properties>
-        </echoxml>
-        <property name="uuid" value="PROCES_INIT_TREE_$${xpath_value}"/>
-        <echoproperties destfile="${properties.xml}" format="xml"/>
-        <!--<loadfile property="PROCES_INIT.FeatureCollection" srcfile="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>-->
-        
-        <loadfile property="PROCES_INIT.RelatedFeatureRoot" srcfile="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"/>
-        <!--<echo> $PROCES_INIT.RelatedFeatureRoot ${PROCES_INIT.RelatedFeatureRoot}</echo>-->
-        <delete file="${default_db:PROCES_INIT:tree.raport.xml}"/>
-        
-        <xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${build_ant_universal_by_xsl_match.xsl}" in="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"  destdir="${CRM_PROCES_tree_basedir.temp}" out="${default_db:PROCES_INIT:tree.raport.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="RelatedFeatureRoot"/>
-            <param name="match_element" expression="PROCES_INIT"/>
-            <param name="antfile_prefix" expression="PROCES_INIT_tree_child"/>
-            <param name="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
-            <param name="basedir" expression="${CRM_PROCES_tree_basedir}"/>
-            <param name="antfile" expression="${default_db:recurse_ant}"/>
-            <param name="target" expression="xml_recursed_from_tr_map_with_RelatedFeatureLoop"/>
-            <param name="match_child_element" expression="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="10"/>
-        </xslt>
-    </target>
-    
-    
-    
-    
-    
-    
-    
-   
-</project>

+ 270 - 0
SE/schema/WPS_Functions/default_db/CRM_PROCES_tree/build_CRM_PROCES_tree.xml

@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="../../../." name="CRM_PROCES_tree" default="default_db:PROCES_INIT:tree"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
+    <description>
+        To retrieve process tree - just process menu and structurized processes
+    </description>
+    
+    <!-- modules WPS_Functions - to be copied to any module needed -->
+    <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"/>
+    <!-- eof modules WPS_Functions  -->
+    
+    
+    <!-- local module individual properties should contain ${project.name} basedir ant its .temp -->
+    <property name="build_CRM_PROCES_tree" location="${basedir}/WPS_Functions/default_db/CRM_PROCES_tree/build_CRM_PROCES_tree.xml"/>
+    <property name="CRM_PROCES_tree_basedir" location="${basedir}/WPS_Functions/default_db/CRM_PROCES_tree"  />                         
+    <property name="CRM_PROCES_tree_basedir.temp" location="${CRM_PROCES_tree_basedir}/temp"  />
+    
+    <property name="set_parallel_java_process_max_aviable" value="40"/> <!-- override property for  -->
+    
+    <!-- eof local module individual properties -->
+    
+    
+    <!-- inherited module wfs properties refs -->
+ 
+    <!--<property name="PROCES_INIT_tree_to_dita.xsl" location="${default_db_xml_cache.public}/default_db/CRM_PROCES/PROCES_INIT_tree_to_dita.xsl"/>-->
+    <!--<property name="tree_to_dita.xsl" location="${default_db_xml_cache.public}/default_db/tree_to_dita.xsl"/>--> <!-- file:/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/default_db_xml_cache.public/default_db/tree_to_dita.xsl -->
+    
+    
+    <!-- WPS_Function standard properties mainaint to be copied to any build module -->
+    <target name="default_db:CRM_PROCES:tree:create_tempdir">
+        <mkdir dir="${CRM_PROCES_tree_basedir.temp}"/>
+    </target>
+    
+    <target name="read_build_properties" depends="default_db:CRM_PROCES:tree:create_tempdir">
+        <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
+        <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
+    </target>
+    <!-- eof WPS_Function  -->
+    
+    
+    
+    <target name="default_db:CRM_PROCES:tree" depends="read_build_properties" description="builds process tree finishing to PROCES_INIT without it ">
+        <ant antfile="${default_db:recurse_ant}"  target="clean_temp_dir">
+            <property name="uuid" value="CRM_PROCES_tree"/>
+        </ant>
+        <ant antfile="${default_db:recurse_ant}"  target="xml_recursed_from_tr_map_with_RelatedFeatureLoop">
+            <property name="uuid" value="CRM_PROCES_tree"/>
+            <property name="typeName" value="p5_default_db:CRM_PROCES"/>
+            <property name="xpath" value="PARENT_ID"/>
+            <property name="xpath_value" value="0"/>
+            <property name="xpath_query" value="[ not(local-name()='PROCES_INIT') and  not(local-name()='CRM_WSKAZNIK') and not(local-name()='CRM_LISTA_ZASOBOW') and not(local-name()='SALES_PLAN')  ]"/>
+        </ant>        
+    </target>
+    
+    
+    
+    <target name="default_db:PROCES_INIT:from_recurse" depends="read_build_properties">
+        <ant antfile="${default_db:recurse_ant}"  target="clean_temp_dir">
+            <property name="default_db:recurse_ant_basedir.temp" location="${default_db:recurse_ant_basedir}/temp/PROCES_INIT_list"/>
+        </ant>
+        <ant antfile="${default_db:recurse_ant}"  target="xml_recursed_from_tr_map_with_RelatedFeatureLoop">
+            <property name="default_db:recurse_ant_basedir.temp" location="${default_db:recurse_ant_basedir}/temp/PROCES_INIT_list"/>
+            <property name="uuid" value="PROCES_INIT_list"/>
+            <property name="typeName" value="default_db:PROCES_INIT"/>
+            <property name="xpath" value="TYPE"/>
+            <property name="xpath_value" value="PROCES_INIT"/>
+            <property name="xpath_query" value="[ local-name()='PROCES_INIT' ]"/>
+        </ant>      
+        <loadfile property="PROCES_INIT.RelatedFeatureRoot" srcfile="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"/>
+    </target>
+    
+    
+    
+    <target name="default_db:PROCES_INIT.wfs"   depends="read_build_properties" description="Get Process List">
+        <echo>TODO currently testing just one process 994  ${default_db:recurse_ant}
+            simpleSchema_dir = ${simpleSchema_dir}</echo>
+        <property name="uuid" value="PROCES_INIT_list"/>
+        
+        <property name="wfs_output.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>
+        <property name="wfs_result.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_result.xml"/>
+        <property name="wfs_error.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_error.xml"/>
+        <property name="wfs_timestamp.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_timestamp.xml"/>
+        
+        <ant antfile="${get_wfs}" target="GetFeature" inheritall="yes">
+            <property name="uuid" value="${uuid}"/>
+            <property name="typeName" value="default_db:CRM_PROCES"/>
+            <property name="xpath" value="TYPE"/>
+            <property name="xpath_value" value="PROCES_INIT"/>
+            <!--<property name="xpath_query" value="[1=2 ]"/>-->
+        </ant>
+        <!--<echo>$PROCES_INIT.FeatureCollection ${PROCES_INIT.FeatureCollection}</echo>-->
+    </target>
+    
+    <target name="default_db:PROCES_INIT:tree_from_wfs"   depends="read_build_properties,default_db:PROCES_INIT.wfs" description="By generating default_db:CRM_PROCES:tree we will respond with structurized PROCES_INIT with child process and resources xml structures - in parallel ant queries">
+        <!-- foreach PROCES_INIT.FeatureCollection/  -->
+        <property name="uuid" value="PROCES_INIT_list"/><!-- moze nie dzialac nowe uuid -->
+        <property name="default_db:PROCES_INIT:tree.raport.xml" location="${CRM_PROCES_tree_basedir.temp}/build_PROCES_INIT_list.raport.xml"/>
+        <property name="default_db:PROCES_INIT:tree.raport_for_dita.xml" location="${CRM_PROCES_tree_basedir.temp}/build_PROCES_INIT_list.raport_for_dita.xml"/>
+        <tempfile property="properties.xml" prefix="properties-for-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>
+        <tempfile property="properties_override.xml" prefix="properties_override-for-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>
+        <echoxml file="${properties_override.xml}" >
+            <properties>
+                <property name="uuid" value="PROCES_INIT_TREE_$${xpath_value}"/> <!-- to be evaluated in child xsl/ant-->
+                <property name="typeName" value="default_db:PROCES_INIT"/>
+                <property name="xpath" value="ID"/>
+            </properties>
+        </echoxml>
+        <!--<property name="uuid" value="PROCES_INIT_TREE_$${xpath_value}"/>-->
+        <echoproperties destfile="${properties.xml}" format="xml"/>
+        <loadfile property="PROCES_INIT.FeatureCollection" srcfile="${wfs_output.xml}"/>
+        <!--<loadfile property="PROCES_INIT.RelatedFeatureRoot" srcfile="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"/>-->
+        <!--<echo> $PROCES_INIT.RelatedFeatureRoot ${PROCES_INIT.RelatedFeatureRoot}</echo>-->
+        <delete file="${default_db:PROCES_INIT:tree.raport.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.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"/>
+            <param name="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
+            <param name="basedir" expression="${CRM_PROCES_tree_basedir}"/>
+            <param name="antfile" expression="${default_db:recurse_ant}"/>
+            <param name="target" expression="xml_recursed_from_tr_map_with_RelatedFeatureLoop"/>
+            <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="10"/>
+            <param name="ant-launcher.jar" expression="${ant-launcher.jar}"/>
+        </xslt>
+        <echo> should ant build be generated $default_db:PROCES_INIT:tree.raport.xml in ${default_db:PROCES_INIT:tree.raport.xml} </echo>
+        
+        <!--<ant antfile="${default_db:PROCES_INIT:tree.raport.xml}"/>-->
+        
+        <!--<tempfile property="properties_override_dita.xml" prefix="properties_override-for-dita-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>-->
+        <!--<echoxml file="${properties_override_dita.xml}" >
+            <properties>
+                <property name="uuid" value="PROCES_INIT_TREE_DITA_$${xpath_value}"/> <!-\- to be evaluated in child xsl/ant-\->
+                <property name="typeName" value="default_db:PROCES_INIT"/>
+                <property name="xpath" value="ID"/>
+            </properties>
+        </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}" >
+            <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_CRM_PROCES_tree}"/>
+            <param name="target" expression="default_db:PROCES_INIT:tree:dita"/>
+            <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="10"/>
+            <param name="ant-launcher.jar" expression="${ant-launcher.jar}"/>
+        </xslt>
+    </target>
+    
+    <!-- depends ,default_db:PROCES_INIT:from_recurse -->
+    <target name="default_db:PROCES_INIT:tree"   depends="read_build_properties,default_db:PROCES_INIT:from_recurse" description="By generating default_db:CRM_PROCES:tree we will respond with structurized PROCES_INIT with child process and resources xml structures - in parallel ant queries">
+        <!-- foreach PROCES_INIT.FeatureCollection/  -->
+        <property name="uuid" value="PROCES_INIT_list"/>
+        
+        <property name="default_db:PROCES_INIT:tree.raport.xml" location="${CRM_PROCES_tree_basedir.temp}/build_PROCES_INIT_list.raport.xml"/>
+        <tempfile property="properties.xml" prefix="properties-for-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>
+        <tempfile property="properties_override.xml" prefix="properties_override-for-PROCES_INIT_Tree" suffix=".xml" destdir="${CRM_PROCES_tree_basedir.temp}" deleteonexit="no"/>
+        <echoxml file="${properties_override.xml}">
+            <properties>
+                <property name="uuid" value="PROCES_INIT_TREE_$${xpath_value}"/> <!-- to be evaluated in child xsl/ant-->
+                <property name="typeName" value="default_db:PROCES_INIT"/>
+                <property name="xpath" value="ID"/>
+            </properties>
+        </echoxml>
+        <property name="uuid" value="PROCES_INIT_TREE_$${xpath_value}"/>
+        <echoproperties destfile="${properties.xml}" format="xml"/>
+        <!--<loadfile property="PROCES_INIT.FeatureCollection" srcfile="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>-->
+        
+        <loadfile property="PROCES_INIT.RelatedFeatureRoot" srcfile="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"/>
+        <!--<echo> $PROCES_INIT.RelatedFeatureRoot ${PROCES_INIT.RelatedFeatureRoot}</echo>-->
+        <delete file="${default_db:PROCES_INIT:tree.raport.xml}"/>
+        
+        <xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${build_ant_universal_by_xsl_match.xsl}" in="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"  destdir="${CRM_PROCES_tree_basedir.temp}" out="${default_db:PROCES_INIT:tree.raport.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="RelatedFeatureRoot"/>
+            <param name="match_element" expression="PROCES_INIT"/>
+            <param name="antfile_prefix" expression="PROCES_INIT_tree_child"/>
+            <param name="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
+            <param name="basedir" expression="${CRM_PROCES_tree_basedir}"/>
+            <param name="antfile" expression="${default_db:recurse_ant}"/>
+            <param name="target" expression="xml_recursed_from_tr_map_with_RelatedFeatureLoop"/>
+            <param name="match_child_element" expression="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="10"/>
+            <param name="ant-launcher.jar" expression="${ant-launcher.jar}"/>
+        </xslt>
+    </target>
+    
+    
+    
+    <target name="default_db:PROCES_INIT:tree:dita" depends="read_build_properties" description="To create .dita file by using PROCES_INIT_tree_to_dita.xsl">
+        <delete dir="${CRM_PROCES_tree_basedir.temp}/${uuid}" />
+        <mkdir dir="${CRM_PROCES_tree_basedir.temp}/${uuid}"/>
+        <property name="uuid" value="${uuid}"/> <!-- to be set from param -->
+        <xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${tree_to_dita.xsl}" in="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"  out="${CRM_PROCES_tree_basedir.temp}/${uuid}/${uuid}.ditamap"  force="true">
+            <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="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
+            <param name="uuid" expression="${uuid}"/>
+        </xslt>
+        
+        <tempfile prefix="postprocess" suffix=".xml" property="postprocess" destdir="${CRM_PROCES_tree_basedir.temp}/${uuid}"/>
+        
+        <xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${tree_to_dita.xsl}" in="${default_db:recurse_ant_basedir.out}/${uuid}.out_task.dita.final_with_RelatedFeatureLoop.xml"  out="${postprocess}"  >
+            <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="postprocess"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
+            <param name="uuid" expression="${uuid}"/>
+        </xslt>
+        <tempfile prefix="build_postprocess" suffix=".xml" property="build_postprocess" destdir="${CRM_PROCES_tree_basedir.temp}/${uuid}"/>
+        
+        <xslt basedir="${CRM_PROCES_tree_basedir.temp}" style="${postprocess.xsl}" in="${postprocess}"  out="${build_postprocess}">
+            <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}postprocess"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="temp" expression="${CRM_PROCES_tree_basedir.temp}"/>
+            <param name="uuid" expression="${uuid}"/>
+        </xslt>
+        
+        <ant antfile="${build_postprocess}"/>
+        
+        
+    </target>
+    
+    
+    
+    
+    
+   
+</project>

+ 64 - 0
SE/schema/WPS_Functions/default_db/check_java_process_count/build_check_java_process_count.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="${basedir}" name="check_java_process_count" default="set_parallel_java_process_max">
+  <description>To check ammount of working process in java  - use as input/output value </description>
+  
+  
+    <!-- modules WPS_Functions - to be copied to any module needed -->
+    <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"/>
+    
+    <property name="build_check_java_process_count.xml"  value="${WPS_Functions}/default_db/check_java_process_count/build_check_java_process_count.xml"/>
+    
+    <property name="parallel_java_process_max" value="20" />
+    <property name="parallel_java_process_max_safe" value="5" />
+    <property name="builds_to_ant_set_parallel_java_process_max" location="${builds_to_ant_set_parallel_java_process_max}" /> <!-- it is tempfile to save properties -->
+    <property name="process_locks" value="${process_locks}"/>
+    
+    <!--<property name="set_parallel_java_process_max_aviable" value="20"/>-->
+    
+    <!-- eof modules WPS_Functions  -->
+  
+  
+    <target  name="check_java_process_count" >
+        <exec executable="bash" dir="." outputproperty="check_java_process_count" >
+            <arg  value="-c" />
+            <arg value="ps ax|grep ant |grep -v grep |wc -l |tr -d [:blank:]"/>
+        </exec>
+        <!--<exec executable="bash" dir="." outputproperty="check_java_process_count" >
+            <arg  value="-c" />
+            <arg value="ls ${process_locks} |wc -l |tr -d [:blank:]"/>
+        </exec>-->
+        <!--<ant antfile="asd" inheritall="yes"></ant>-->
+        <!--<property name="check_java_process_count" value="${check_java_process_count}"/>-->
+        <echo> build_check_java_process_count.xml: $check_java_process_count = ${check_java_process_count}</echo>
+    </target>
+  
+    <target name="set_parallel_java_process_max" depends="check_java_process_count">
+        <exec executable="bash" dir="." outputproperty="check_java_process_count_result" >
+            <arg  value="-c" />
+            <arg value="[ ${check_java_process_count} -lt ${parallel_java_process_max} ] &amp;&amp; echo below || echo exceed"/>
+        </exec>
+        <echo level="debug"> $check_java_process_count_result = ${check_java_process_count_result} </echo>
+        <condition property="set_parallel_java_process_max_if">
+            <contains string="${check_java_process_count_result}" substring="below"/>
+        </condition>
+        <antcall target="set_parallel_java_process_max_below"/>
+        <antcall target="set_parallel_java_process_max_exceed"/>
+    </target>
+  
+    <target name="set_parallel_java_process_max_below"  if="${set_parallel_java_process_max_if}" >
+        <exec executable="bash" dir="." outputproperty="set_parallel_java_process_max_aviable" >
+            <arg  value="-c" />
+            <arg value="echo $[ ${parallel_java_process_max} - ${check_java_process_count} ]"/>
+        </exec>
+        <echo>:) :) :) :) PARALLEL PROCESS BELOW - REDUCING PARALLEL TO ${set_parallel_java_process_max_aviable} (${parallel_java_process_max_safe}) (current ${check_java_process_count} ) ( set.max ${parallel_java_process_max}) :) :) :) :) </echo>
+        <!--<echo file="${builds_to_ant_set_parallel_java_process_max}" message="${set_parallel_java_process_max_aviable}"/>--><!-- bylo aby pokazywac pozostale procesy, a robimy aby powoli rozpedzac i dawac po 5 rownoleglych, aby szybciej sie drzewo konczylo -->
+        <echo file="${builds_to_ant_set_parallel_java_process_max}" message="${parallel_java_process_max_safe}"/>
+    </target>
+    <target name="set_parallel_java_process_max_exceed" unless="${set_parallel_java_process_max_if}" >
+        <echo>:( :( :( :( PARALLEL PROCESS EXCEEDED - REDUCING PARALLEL TO 1 (current ${check_java_process_count} ) ( set.max ${parallel_java_process_max}) :( :( :( :(  </echo>
+        <echo file="${builds_to_ant_set_parallel_java_process_max}" message="1"/>
+    </target>
+  
+</project>

+ 116 - 0
SE/schema/WPS_Functions/default_db/recurse_ant/IN7_DZIENNIK_KORESP.dita

@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<RelatedFeature xpath="ID"  typeName="p5_default_db:IN7_DZIENNIK_KORESP"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:noNamespaceSchemaLocation="../../../default_db_xml_cache.public/topicProcesy5.xsd">
+  <!-- Sample template to use with Procesy5 model-driven engine with Concurrent and Parallel processing   -->
+  <!-- for more information see http://procesy5.pl/procesy5-wfs-api-doc/ or http://procesy5.pl/procesy5-wfs-api-doc/data_read_ant_example_with_filter.html  -->
+  <!-- to be used inside Procesy5 system or separatelly in ant environment  together with following scripts:
+       build.xml - TODO TO BE DOCUMENTED
+       Documentation ref - TODO TO BE DOCUMENTED
+    -->
+  <!-- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -->
+<topic id="untitled4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+  <title><ph>Pismo nr </ph><ph xpath="ID_PROJECT"/><ph>-</ph><ph xpath="ID"/>
+    <ph>z dnia</ph>
+    <ph xpath="K_DATA_OTRZYMANEJ_KORESP"/></title>
+  <body>
+    <simpletable id="simpletable_uym_ps1_zy">
+      <strow>
+        <stentry>
+          <RelatedFeature xpath="ID" xpath_value="../ID_BILLING_OWNER" typeName="p5_default_db:BILLING_OWNER"><!-- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -->
+            <p>Nadawca:</p><ph/>
+            <p xpath="name1"/><ph/>
+            <p xpath="name2"/><ph/>
+            <p><ph xpath="kod"/><ph> </ph><ph xpath="miasto"/><ph> ul.</ph><ph xpath="ulica"/><ph> </ph><ph xpath="numer_dom"/></p>
+            <p><ph>nip:</ph><ph xpath="nip"/><ph> regon:</ph><ph xpath="regon"/></p>
+            <p><ph>email:</ph><ph xpath="BILLING_OWNER_EMAIL"/> <ph> tel:</ph><ph xpath="tel"/> </p>
+            <p><ph>nr r-ku:</ph><ph xpath="nr_rach"/></p>
+        </RelatedFeature></stentry>
+        <stentry>
+          <p>Odbiorca:</p><ph/>
+          <p xpath="K_OD_KOGO"/><ph/>
+          <p xpath="OD_KOGO_ADRES"/><ph/>
+          <p xpath="K_NR_OTRZYM_KORESP"/><ph/>
+        </stentry>
+      </strow>
+    </simpletable>
+    <p><b>Temat: <ph/><ph xpath="K_ZAWARTOS"/></b></p>
+    <p>Tresc: </p>
+    <bodydiv xpath="K_ZAWARTOSC_HTML"/>
+    <p> Miejsca na podpisy<simpletable frame="all" relcolwidth="1.0* 1.0*"
+      id="simpletable_ejm_j2r_cz">
+      <strow>
+        <stentry/> 
+        <stentry>Podpis(*)</stentry>
+      </strow>
+      <strow>
+        <stentry/>
+        <stentry>
+          <codeblock>            
+          </codeblock>
+        </stentry>
+      </strow>
+    </simpletable></p>
+    <RelatedFeature xpath="ADM_ACCOUNT" xpath_value="../L_APPOITMENT_USER" typeName="p5_default_db:ADMIN_USERS"><!-- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -->
+      <p><simpletable frame="all" relcolwidth="1.0* 1.0*" id="simpletable_b2r_ldr_cz_adma">
+        <strow>
+          <stentry>Referent odpowiedzialny za dokument</stentry>
+          <stentry xpath="ADM_NAME"/>
+        </strow>
+        <strow>
+          <stentry>Kontakty</stentry>
+          <stentry><ph xpath="EMAIL_LOCAL_ACCOUNT_ADDRESS" xpath_token_filter=" " xpath_token="1"/><ph> </ph><ph xpath="ADM_PHONE"/></stentry>
+        </strow>
+      </simpletable>
+      </p>
+    </RelatedFeature>
+    <RelatedFeature xpath="ID" xpath_value="../ID_PROJECT" typeName="p5_default_db:IN7_MK_BAZA_DYSTRYBUCJI">
+      <RelatedFeature xpath="ADM_ACCOUNT" xpath_value="../L_APPOITMENT_USER" typeName="p5_default_db:ADMIN_USERS"><!-- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -->
+        <p><simpletable frame="all" relcolwidth="1.0* 1.0*" id="simpletable_b2r_ldr_cz_ref_spr">
+          <strow>
+            <stentry>Referent odpowiedzialny za sprawę</stentry>
+            <stentry xpath="ADM_NAME"/>
+          </strow>
+          <strow>
+            <stentry>Kontakty</stentry>
+            <stentry><ph xpath="EMAIL_LOCAL_ACCOUNT_ADDRESS" xpath_token_filter=" " xpath_token="1"/><ph> </ph><ph xpath="ADM_PHONE"/></stentry>
+          </strow>
+        </simpletable>
+        </p>
+      </RelatedFeature>
+    </RelatedFeature>
+    <p><b>Powiazane elementy (inne dokumenty w sprawie)</b></p>
+    <p>
+      <table>
+        <tgroup cols="3">
+          <thead>
+            <row>
+              <entry>ID</entry>
+              <entry>Data</entry>
+              <entry>Temat</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry/>
+              <entry/>
+              <entry/>
+            </row>
+            <RelatedFeature xpath="ID_PROJECT" xpath_value="../ID_PROJECT" typeName="p5_default_db:IN7_DZIENNIK_KORESP" xpath_query="[position()&lt;3]">  <!-- test sciagniecia powiazanych pism do sprawy -->
+              <row>
+                <entry xpath="ID" />
+                <entry xpath="K_DATA_OTRZYMANEJ_KORESP"/>
+                <entry xpath="K_ZAWARTOS"/>
+              </row>
+            </RelatedFeature>
+          </tbody>
+        </tgroup>
+      </table>
+    </p> 
+    <p/>
+    <p/>
+    <p><sup>wygenerowano przez procesy5.pl</sup></p>
+  </body>
+</topic>
+</RelatedFeature>

+ 95 - 16
SE/schema/WPS_Functions/default_db/recurse_ant/build.xml → SE/schema/WPS_Functions/default_db/recurse_ant/build_recurse_ant.xml

@@ -34,11 +34,11 @@
         -DtypeName="p5_default_db:IN7_DZIENNIK_KORESP" 
         -Dxpath=ID -Dxpath_value=1000 
         -Duuid=1 -DwebRootUrl=somePathDir-->
-    <property name="basedir"  value="${basedir}" /> <!-- do ustalenia glownego katalogu -->
+    <property name="basedir"  location="${basedir}" /> <!-- do ustalenia glownego katalogu -->
     <property name="default_db:recurse_ant_basedir" location="."/>
-    <property name="default_db:recurse_ant_basedir.temp" location="${default_db:recurse_ant_basedir}/temp"/>
-    <property name="default_db:recurse_ant" location="${default_db:recurse_ant}"/>
-    
+    <property name="default_db:recurse_ant_basedir.temp" location="${default_db:recurse_ant_basedir}/temp/${uuid}"/> <!-- /${uuid} -->
+    <property name="default_db:recurse_ant" value="${default_db:recurse_ant_basedir}/build_recurse_ant.xml"/>
+     
     <property name="out" value="out"/> <!-- output ready files like pdf -->
     <property name="p5_tr_map_dir" location="${basedir}/../../../default_db.instance.xml/p5_tr_map" />
     <property name="simpleSchema_dir" location="${basedir}/../../../default_db.instance.xml/simpleSchema" />
@@ -66,6 +66,8 @@
     <!--<property name="temp_name" value="temp" />--> <!-- temp files-->
     <property name="temp" value="${default_db:recurse_ant_basedir.temp}${loop_path_recurs}" /> <!-- temp files-->
     <property name="xpath_query.xsl" value="${default_db:recurse_ant_basedir.temp}/${uuid}.xpath_query.xsl"/>
+    <property name="build_recurse_ant_xpath_query.xsl" value="${default_db:recurse_ant_basedir.temp}/build_recurse_ant_xpath_query.xsl"/>
+    <property name="process_locks" value="${default_db:recurse_ant_basedir.temp}/.locks"/>
     <property name="empty.xml" value="${temp}/${uuid}.empty.xml"/>
     <!-- variables to first transform of doc for then get related features -->
     <!--<property name="default_db_xml_cache.public" value="../../../default_db_xml_cache.public"/>--> <!-- katalog z xsl z projektu src-xmlschema.git -->
@@ -78,11 +80,17 @@
     <property name="out_task.dita.final_with_RelatedFeatureLoop_no_path"   value="${uuid}.out_task.dita.final_with_RelatedFeatureLoop" />
     <property name="out_task.dita.final_with_RelatedFeatureLoop"   value="${default_db:recurse_ant_basedir}/out/${uuid}.out_task.dita.final_with_RelatedFeatureLoop" />
     
+    <property name="ant-launcher.jar" location="/opt/local/share/java/apache-ant/lib/ant-launcher.jar"/><!-- should be also set in parent build -->
+    <property name="build_check_java_process_count.xml"  value="${basedir}/../check_java_process_count/build_check_java_process_count.xml"/>
+    <property name="parallel_java_process_max" value="10"/> <!-- to limit max processes in parallel concurent tasks jobs - will use ${build_check_java_process_count.xml} -->
      <!-- do zrobienia  -->
     <!--<tempfile property="wfs_output" deleteonexit="no"  destdir="temp"  suffix=".xml" />-->
+    <property name="get_wfs_basedir" location="${default_db:recurse_ant_basedir}/../../get_wfs"/>
+    <property name="get_wfs" location="${get_wfs_basedir}/build_get_wfs.xml"/>
     
-
+    <property name="parallel_pos" value="1"/>
     
+    <echo>#93 $typeName= ${typeName};  $xpath= ${xpath};  $xpath_value= ${xpath_value}  </echo>
 
     <!--<echo> $basedir=${basedir}; 
         $temp=${temp};
@@ -302,7 +310,12 @@
                         <!--<echo message="OUTPUT__END"/>-->
                     </target>
     
-        <target name="xml_recursed_from_tr_map_with_RelatedFeatureLoop" depends="xml_recursed_from_tr_map" description="URL_TASK Pobierz XML obiektu">
+    
+        <target name="mkdir_process_locks">
+            <mkdir dir="${process_locks}"/>
+        </target>
+    
+    <target name="xml_recursed_from_tr_map_with_RelatedFeatureLoop" depends="mkdir_process_locks,build_recurse_ant_xsl_xpath_filter.xsl,xml_recursed_from_tr_map" description="URL_TASK Pobierz XML obiektu">
                         
                         <!-- TODO proba wlaczenia rekursywnosci zapisanie wezla do sciezki w folderze-->
                         <!--<copy file="${out_task.dita.final}" tofile="${temp}/${loop_path_recurs}/${uuid_tested}.loop_path.xml" />-->
@@ -385,6 +398,8 @@
         <property name="build_recurse_ant_merge_dita_from_temp.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_merge_dita_from_temp.xsl"/>
         <property name="builds_to_ant.xsl" value="${default_db_xml_cache.public}/builds_to_ant.xsl"/>
         <property name="xpath_query_check_create_xsl.xsl" value="${default_db_xml_cache.public}/xpath_query_check_create_xsl.xsl"/>
+        <property name="build_recurse_ant_xsl_xpath_filter.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_xsl_xpath_filter.xsl"/>
+        <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
         <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     
@@ -395,6 +410,7 @@
         <property name="build_recurse_ant_merge_dita_from_temp.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_merge_dita_from_temp.xsl"/>
         <property name="builds_to_ant.xsl" value="${default_db_xml_cache.public}/builds_to_ant.xsl"/>
         <property name="xpath_query_check_create_xsl.xsl" value="${default_db_xml_cache.public}/xpath_query_check_create_xsl.xsl"/>
+        <property name="build_recurse_ant_xsl_xpath_filter.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_xsl_xpath_filter.xsl"/>
         <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     
@@ -429,9 +445,10 @@
    
    
     <target name="clean_temp_dir" description="URL_TASK Wyczyść cache modułu ">
-        <delete includeemptydirs="yes">
-            <fileset dir="${temp}"/>
-        </delete>        
+        <!--<delete includeemptydirs="yes" failonerror="false">
+            <fileset dir="${default_db:recurse_ant_basedir.temp}"/>
+        </delete>-->    
+        <delete dir="${temp}" failonerror="false"/>
         <echo message="OUTPUT__START"/>   
         <echo>&lt;br&gt;Skasowano pliki tymczasowe&lt;/br&gt;</echo>         
         <echo message="OUTPUT__END"/>
@@ -474,6 +491,52 @@
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <param name="xpath_query" expression="[1=1]"/>
         </xslt>
+        <!--<copyfile src="${build_recurse_ant.xsl}" dest="${build_recurse_ant_xpath_query.xsl}"/>-->
+        <!--<xslt basedir="${default_db:recurse_ant_basedir}" style="${xpath_query_check_create_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${xpath_query.xsl}_secondary.xsl"  >
+            <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="xpath_query_check_create_xsl"/> 
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="xpath_query" expression="[1=1]"/>
+        </xslt>-->
+    </target>
+    
+    
+    <target name="build_recurse_ant_xsl_xpath_filter.xsl_check" description="if it is set ">
+        <condition taskname="build_recurse_ant_xsl_xpath_filter.xsl" property="xpath_query_set">
+            <or>
+                <equals arg1="${xpath_query}" arg2=""/>
+                <equals arg1="${xpath_query}" arg2="$${xpath_query}"/>
+            </or>
+        </condition>
+        <antcall target="build_recurse_ant_xsl_xpath_filter.xsl_fail"/> <!-- if failed run or not if not -->
+    </target>
+    
+    <target name="build_recurse_ant_xsl_xpath_filter.xsl_fail" depends="check_default_db_xml_cache.public_default,check_set_default_db_xml_cache.public_local"  if="${xpath_query_set}"  description="if it is not set ">
+        <echo>build_recurse_ant_xsl_xpath_filter.xsl using $default_db_xml_cache.public ${default_db_xml_cache.public}</echo>
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${build_recurse_ant_xsl_xpath_filter.xsl}" in="${build_recurse_ant.xsl}"  destdir="./" out="${build_recurse_ant_xpath_query.xsl}"  >
+            <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="xpath_query_check_create_xsl"/>--> 
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="xpath_query" expression="[1=1]"/>
+            <param name="default_db_xml_cache.public" expression="${default_db_xml_cache.public}"/>
+        </xslt>
+    </target>
+    
+    <target name="build_recurse_ant_xsl_xpath_filter.xsl" depends="check_default_db_xml_cache.public_default,check_set_default_db_xml_cache.public_local,build_recurse_ant_xsl_xpath_filter.xsl_check" unless="${xpath_query_set}" description="Create build_recurse_ant_xsl_xpath_filter.xsl">
+        <echo>build_recurse_ant_xsl_xpath_filter.xsl using $default_db_xml_cache.public ${default_db_xml_cache.public}</echo>
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${build_recurse_ant_xsl_xpath_filter.xsl}" in="${build_recurse_ant.xsl}"  destdir="./" out="${build_recurse_ant_xpath_query.xsl}"  >
+            <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="xpath_query_check_create_xsl"/>--> 
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="xpath_query" expression="${xpath_query}"/>
+            <param name="default_db_xml_cache.public" expression="${default_db_xml_cache.public}"/>
+        </xslt>
     </target>
     
     <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
@@ -482,9 +545,9 @@
         <property name="loop_xpath"  value="root" />
         <property name="build_recurse_ant.xml" value="${temp}/${uuid_tested}.build_${loop_xpath}.xml" />
         <echo>#113 ant build_recurse_ant.xml=${build_recurse_ant.xml}; </echo>
-        <record name="ant.log" loglevel="verbose" append="true" />
+        <!--<record name="ant.log" loglevel="verbose" append="true" />-->
         <!--<delete file="${build_recurse_ant.xml}"/>-->
-        <xslt basedir="${default_db:recurse_ant_basedir}" style="${build_recurse_ant.xsl}" in="${main_build_recurse_ant.dita_with_id}"  destdir="./" out="${build_recurse_ant.xml}"  >
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${build_recurse_ant_xpath_query.xsl}" in="${main_build_recurse_ant.dita_with_id}"  destdir="./" out="${build_recurse_ant.xml}"  >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
             </factory>
@@ -512,7 +575,7 @@
             <param name="recurse_ant_basedir" expression="${default_db:recurse_ant_basedir}"/>
             <param name="recurse_ant_basedir.temp" expression="${default_db:recurse_ant_basedir.temp}"/>
             <param name="recurse_ant" expression="${default_db:recurse_ant}"/>
-            <param name="build_recurse_ant.xsl" expression="${build_recurse_ant.xsl}"/>
+            <param name="build_recurse_ant.xsl" expression="${build_recurse_ant_xpath_query.xsl}"/>
             <param name="temp" expression="${temp}"/>
             <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
             <param name="cookie_curl_option" expression="${php_session_id_tested}"/>
@@ -523,10 +586,21 @@
             <param name="empty.xml" expression="${empty.xml}"/>
             <param name="simpleSchema_dir" expression="${simpleSchema_dir}"/>
             <param name="default_db_xml_cache.public" expression="${default_db_xml_cache.public}"/>
+            <param name="ant-launcher.jar" expression="${ant-launcher.jar}"/>
+            <param name="build_check_java_process_count.xml" expression="${build_check_java_process_count.xml}"/>
+            <param name="parallel_java_process_max" expression="${parallel_java_process_max}"/>
+            <param name="debug_xsl_in_filename" expression="${main_build_recurse_ant.dita_with_id}"/>
+            <param name="debug_xsl_out_filename" expression="${build_recurse_ant.xml}"/>
+            <param name="debug_xsl_out_filename" expression="${build_recurse_ant.xml}"/>
+            <param name="parallel_pos" expression="${parallel_pos}"/>
+            <param name="process_locks" expression="${process_locks}"/>
+            <param name="get_wfs" expression="${get_wfs}"/>
         </xslt>
         <!--<import file="${build_recurse_ant.xml}"/>-->
-        <record action="stop" name="ant.log"/>
-        <ant  antfile="${build_recurse_ant.xml}" dir="." />
+        <!--<record action="stop" name="ant.log"/>-->
+        <ant  antfile="${build_recurse_ant.xml}" dir="." >
+            <property name="parallel_pos" value="${parallel_pos}"/> <!-- To discrete parallel tasks in tempfiles creation errors etc -->
+        </ant>
 
         <!-- pozbierac wszystkie do kupy xmle  -->
     </target>
@@ -562,7 +636,12 @@
             <param name="temp" expression="${temp}"/>
             <param name="simpleSchema_dir" expression="${simpleSchema_dir}"/>
         </xslt>
-        <echo> zapisalem plik gotowy do utworzenia dita do ${out_task.dita.final}. </echo>
+        <echo> *************************************************************************
+               * #573 FIHISHED NODE-LOOP in SAVED TO BE MERGED BY MERGE                     
+               * $temp is ${temp}                                                      
+               * Saved to ${out_task.dita.final} . 
+               *************************************************************************    
+        </echo>
     </target>
     
     <target name="xml_recursed_from_tr_map_with_RelatedFeatureLoop_html" depends="xml_recursed_from_tr_map" description="URL_TASK Pobierz HTML obiektu">
@@ -631,7 +710,7 @@
 
 
 
-    <target name="buildpdf_recursed" depends="install_folders,uuid_check,typeName_check,xpath_check,xpath_value_check,passwordBase64Basic_check,php_session_id_check,check_dita" if="${test_if_dita}">
+    <target name="buildpdf_recursed" depends="install_folders,uuid_check,typeName_check,xpath_check,xpath_value_check,passwordBase64Basic_check,php_session_id_check,mkdir_process_locks,build_recurse_ant_xsl_xpath_filter.xsl,check_dita" if="${test_if_dita}">
         <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>
         <exec executable="${dita.dir}" dir=".">
             <arg value="-i"/>

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

@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:ogc="http://www.opengis.net/ogc" 
+    basedir="../../." name="example wfs" default="http_first_input">
+  <description>
+    Based on ant-url-action module to ordinary retrieve feature from WMF
+    To be called from CRM_PROCES_Tree etc
+  </description>
+
+    <!-- file:/SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-get-wfs-xml/build.xml -->
+
+    <!-- sample URL which call this exact variables in this ANT build -->
+    <!-- przykladowy URL ktory przekazuje parametry do tego ANT -->
+    <!--https://biuro.biall-net.pl/SE/version-git/index.php?_route=UrlAction_Ant&_task=ant&
+        path=${default_db.in7_dziennik_koresp/test-get-wfs-xml} -  this is the place to keep ant build (directory name with build.xml)
+        &namespace=p5_default_db:Rozdzielcza_test_bzyk_PE&featureID=123 - this is setting the <property name="url" value="${url}"/> - to point what is record/table to download
+        <property name="uuid" value="${uuid}"/> it is automatically also set to enable uinque transaction and to allow to save data with user
+        <property name="passwordBase64Basic" value="${passwordBase64Basic}"/> - this is also set - to enable communicate with API -
+        <property name="DwebRootUrl" value="${$webRootUrl}"/> - this is the place where script is localized to easyli to target user GUI by href to generated output
+    />
+    -->
+    <!-- modules WPS_Functions - to be copied to any module needed -->
+    <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"/>
+    <!-- eof modules WPS_Functions  -->
+    
+    <!-- module local properties -->
+    <property name="get_wfs_basedir" location="${basedir}/WPS_Functions/get_wfs"/><!-- to ordinary retrieve wfs data  -->
+    <property name="get_wfs_basedir.temp" location="${get_wfs_basedir}/temp"/>
+    <property name="get_wfs" location="${get_wfs_basedir}/build_get_wfs.xml"/><!-- to ordinary retrieve wfs data  -->
+    <property name="uuid" value="${uuid}"/>
+    
+    <property name="wfs_output.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_output.xml"/>
+    <property name="wfs_result.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_result.xml"/>
+    <property name="wfs_error.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_error.xml"/>
+    <property name="wfs_timestamp.xml" location="${get_wfs_basedir.temp}/${uuid}.wfs_timestamp.xml"/>
+    
+    <!-- eof module local properties -->
+
+    
+    <property name="passwordBase64Basic" value="${passwordBase64Basic}"/>
+    <!--<property name="url" value="${url}"/>-->
+    <!--<property name="api_url" value="${api_url}"/>-->
+    <property name="typeName" value="${typeName}" />
+    <property name="xpath" value="${xpath}"/>
+    <property name="xpath_value" value="${xpath_value}" />
+    <property name="php_session_id" value="${php_session_id}"/>
+    <property name="webRootUrl" value="${webRootUrl}"/>
+
+
+    <target name="read_build_properties" >
+        <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
+        <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
+        <echo level="debug">$api_url to ${api_url}  $namespace_prefix ${namespace_prefix} 
+            passwordBase64Basic=${passwordBase64Basic}
+        </echo>
+    </target>
+
+    <target name="http_first_input">
+        <echo message="FETCHING '${url}' ..."/>
+        <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result">
+            <arg line="--cookie 'PHPSESSID=${php_session_id}' '${url}&amp;REQUEST=GetFeature'"/>
+        </exec>
+        <echo message="OUTPUT__TYPE__XML"/>
+        <echo message="OUTPUT__START"/>
+        <echo message="${wfs_output}"/>
+
+        <echo message="webRootUrl"></echo>
+        <echo message="${webRootUrl}"></echo>
+
+        <echo message="OUTPUT__END"/>
+
+        <echo message="RESULT__START"/>
+        <echo message="${wfs_result}"/>
+        <echo message="RESULT__END"/>
+
+        <echo message="ERROR__START"/>
+        <echo message="${wfs_error}"/>
+        <echo message="ERROR__END"/>
+    </target>
+
+    <target name="DescribeFeatureType" description="URL_TASK Target DescribeFeatureType">
+        <echo message="FETCHING '${url}' ..." level="debug"/>
+        <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result">
+            <arg line="-H 'Authorization: Basic ${passwordBase64Basic}'  &#34;${url}&amp;REQUEST=DescribeFeatureType&#34;"/>
+        </exec>
+        <echo message="OUTPUT__TYPE__XML"/>
+        <echo message="OUTPUT__START"/>
+        <echo message="${wfs_output}"/>
+
+        <echo message="webRootUrl"></echo>
+        <echo message="${webRootUrl}"></echo>
+
+        <echo message="OUTPUT__END"/>
+
+        <echo message="RESULT__START"/>
+        <echo message="${wfs_result}"/>
+        <echo message="RESULT__END"/>
+
+        <echo message="ERROR__START"/>
+        <echo message="${wfs_error}"/>
+        <echo message="ERROR__END"/>
+    </target>
+
+
+    <target name="Filter_cond">
+        <condition property="Filter_cond" taskname="Filter_check">
+            <or>
+                <equals arg1="${xpath}" arg2=""/>
+                <equals arg1="${xpath}" arg2="$${uuid}"/>
+            </or>
+        </condition>
+    </target>
+    
+    <target name="Filter_check" depends="Filter_cond,Filter_fail,Filter_ok"/>
+    
+    <target name="Filter_ok" unless="${Filter_cond}">
+        <!--<mkdir dir="${get_wfs_basedir.temp}"/>
+        <tempfile destdir="${get_wfs_basedir.temp}" suffix=".xml" prefix="Filter_ok" property="Filter.xml"/>
+        <echoxml file="${Filter.xml}"></echoxml>
+        <loadfile property="Filter.xml_file" srcfile="${Filter.xml}"/>-->
+        <property name="Filter" value="&amp;Filter=&lt;ogc:Filter&gt;&lt;ogc:PropertyIsLike&gt;&lt;ogc:PropertyName&gt;${xpath}&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;${xpath_value}&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsLike&gt;&lt;/ogc:Filter&gt;"/>
+    </target>
+    
+    <target name="Filter_fail" if="${Filter_cond}">
+        <echo level="debug">#94 filter not set</echo>
+    </target>    
+
+    <target name="GetFeature" description="URL_TASK Target GetFeature" depends="read_build_properties,Filter_check">
+        <property name="get_url" value="${api_url}/${namespace_prefix}?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;typeName=${typeName}&amp;${Filter}"/>
+        <echo message="FETCHING '${get_url}'" level="debug"/>
+        <tstamp>
+            <format property="wfs.timestamp" pattern="yyyy-MM-dd HH:mm:ss"/>
+        </tstamp>
+
+        <exec executable="curl" outputproperty="wfs_output" errorproperty="wfs_error" resultproperty="wfs_result">
+            <arg line="-H 'Authorization: Basic ${passwordBase64Basic}'  '${get_url}'"/><!-- ${Filter} -->
+        </exec>
+        <!--<echo message="${wfs_output}" />-->
+        <echo file="${wfs_output.xml}" message="${wfs_output}"/>
+        <echo file="${wfs_result.xml}" message="${wfs_result}"/>
+        <echo file="${wfs_error.xml}" message="${wfs_error}"/>
+        <echoxml file="${wfs_timestamp.xml}"><wfs_timestamp>${wfs.timestamp}</wfs_timestamp></echoxml>
+    </target>
+    
+    <target name="GetFeatureByLastMod" description="URL_TASK Target GetFeatureByLastMod - should do incremental retrievement" depends="read_build_properties,Filter_check"/>
+       
+       
+    
+    
+    <target name="GetXmlByUrlVerifyRetry" description="To use from recruse ant and be verified">
+        <!--<echo>GetXmlByUrlVerifyRetry #154 we used </echo>-->
+        <exec executable="curl" output="${output}" errorproperty="wfs_error"> 
+            <arg line="${cookie_curl_option} &quot;${url}&quot;"/>
+            <arg line="--connect-timeout 5"/>
+            <arg line="--max-time 240"/>
+            <arg line="--retry 5"/>
+            <arg line="--retry-max-time 1200"/>
+        </exec>
+        <!--<echo message="ERROR__START"/>-->
+        <!--<echo>${wfs_error}</echo>-->
+        <!--<echo message="ERROR__END"/>-->
+        <antcall target="GetXmlByUrlVerifyRetry.validate_length"/>
+        <!--<antcall target="GetXmlByUrlVerifyRetry_verify"/>
+        <echo> Validate $GetXmlByUrlVerifyRetry_verify: ${GetXmlByUrlVerifyRetry_verify}</echo>
+        <echo> Validate $warn: ${warn}</echo>-->
+    </target>
+    
+    <target name="GetXmlByUrlVerifyRetry.validate_length.condition" description="To verify if downloaded file is correct" >
+        <length file="${output}" property="output.length"/>
+        <!--<echo> $output.length = ${output.length}</echo>-->
+        <condition property="output.length.failed" taskname="GetXmlByUrlVerifyRetry.validate_length">
+            <equals arg1="${output.length}" arg2="128"/>
+        </condition>
+        <condition property="output.length.failed.0" taskname="GetXmlByUrlVerifyRetry.validate_length.0">
+            <equals arg1="${output.length}" arg2="0"/>
+        </condition>
+    </target>
+    
+    <target name="GetXmlByUrlVerifyRetry.validate_length" depends="GetXmlByUrlVerifyRetry.validate_length.condition">
+        <antcall target="GetXmlByUrlVerifyRetry.validate_length.failed"/>
+        <antcall target="GetXmlByUrlVerifyRetry.validate_length.failed.0"/>
+    </target>
+    
+    <target name="GetXmlByUrlVerifyRetry.validate_length.failed" if="${output.length.failed}">
+        <echo>GetXmlByUrlVerifyRetry.validate_length.failed #182 - first retry ! </echo>
+        <delete file="${output}"/>
+        <exec executable="curl" output="${output}" errorproperty="wfs_error"> 
+            <arg line="${cookie_curl_option} &quot;${url}&quot;"/>
+            <arg line="--connect-timeout 5"/>
+            <arg line="--max-time 240"/>
+            <arg line="--retry 5"/>
+            <arg line="--retry-max-time 1200"/>
+        </exec>
+        <length file="${output}" property="output.length.try1"/>
+        <echo> $output.length.try1 = ${output.length.try1}</echo>
+    </target>
+    <target name="GetXmlByUrlVerifyRetry.validate_length.failed.0" if="${output.length.failed.0}">
+        <echo>GetXmlByUrlVerifyRetry.validate_length.failed #198 - first retry - zero length ! </echo>
+        <delete file="${output}"/>
+        <exec executable="curl" output="${output}" errorproperty="wfs_error"> 
+            <arg line="${cookie_curl_option} &quot;${url}&quot;"/>
+            <arg line="--connect-timeout 5"/>
+            <arg line="--max-time 240"/>
+            <arg line="--retry 5"/>
+            <arg line="--retry-max-time 1200"/>
+        </exec>
+        <length file="${output}" property="output.length.try.0"/>
+        <echo> $output.length.try.0 = ${output.length.try.0}</echo>
+    </target>
+    
+    <target name="GetXmlByUrlVerifyRetry_verify" description="To verify if downloaded file is correct" >
+        <xmlvalidate file="${output}" lenient="yes" failonerror="false" warn="warn" />
+        <echo>#169 after validated ? not set any?</echo>
+    </target>
+    
+    
+</project>

+ 68 - 0
SE/schema/WPS_Functions/object_modeling/build_object_modeling.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="../../." name="object_modeling" default="system_cache__appinfo:new_object_by_prototype"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
+    <description>
+        TO model objects capabilities
+    </description>
+    
+    <!-- modules WPS_Functions - to be copied to any module needed -->
+    <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"/>
+    <!-- eof modules WPS_Functions  -->
+    
+    <property name="object_modeling_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />
+    
+    <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="build_properties" location="${public_html}/build_properties" />
+    
+    
+   <!-- <property name="table.local" location="${public_html}/table"/>
+    
+    <property name="transformed.local" location="${default_db.instance.xml}/transformed"/>
+    <property name="procesy5_system_schema.xml" value="${transformed.local}/procesy5_system_schema.xml"/>
+    -->
+    <target name="read_build_properties">
+       <!-- <ant antfile="${root_build.xml}" target="save_build_properties"/>
+        <loadproperties srcfile="${build_properties}"/>-->
+        <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
+        <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
+        <property name="new_object_by_prototype.xml" value="${transformed.local}/system_cache__appinfo/new_object_by_prototype.xml"/>
+        <echo>We try to refresh ${default_db.xml} or ${detect_objects_parent_relations.xsl} or ${procesy5_system_schema.xml}</echo>
+    </target>
+    
+    
+    <target name="system_cache__appinfo:new_object_by_prototype" depends="read_build_properties" description="ANT_TARGET new object by using prototype from Types" >
+        <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}
+            procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
+            generating from ${prototype_object_namespace}
+            generating to ${new_object_namespace}
+        </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}" >
+            <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="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}"/>
+            <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}"/>
+    </target>
+    
+    
+    
+    
+  
+</project>

+ 79 - 0
SE/schema/WPS_Functions/object_modeling_build_infrastructure/build_object_modeling_build_infrastructure.xml

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-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
+    </description>
+    
+    
+    <!-- modules WPS_Functions - to be copied to any module needed -->
+    <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"/>
+    <!-- eof modules WPS_Functions  -->
+    
+    
+    <property name="object_modeling_build_infrastructure_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />
+    <property name="object_modeling_build_infrastructure_basedir.temp" location="${object_modeling_build_infrastructure_basedir}/temp"  />
+    
+    <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="build_properties" location="${public_html}/build_properties" />
+    
+    <property name="object_modeling_build_infrastructure.xsl" value="${object_modeling_build_infrastructure_basedir}/object_modeling_build_infrastructure.xsl"/>
+    
+   <!-- <property name="table.local" location="${public_html}/table"/>
+    
+    <property name="transformed.local" location="${default_db.instance.xml}/transformed"/>
+    <property name="procesy5_system_schema.xml" value="${transformed.local}/procesy5_system_schema.xml"/>
+    -->
+    <target name="read_build_properties">
+        <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
+        <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
+        <!--<ant antfile="${root_build.xml}" target="save_build_properties"/>
+        <loadproperties srcfile="${build_properties}"/>-->
+        <property name="new_object_by_prototype.xml" value="${transformed.local}/system_cache__appinfo/new_object_by_prototype.xml"/>
+    </target>
+    
+    
+    <target name="system_cache__appinfo:object_modeling_build_infrastructure" depends="read_build_properties" description="ANT_TARGET new object by using prototype from Types" >
+        <ant antfile="${root_build.xml}" target="procesy5_system_schema.xml_if_not_exists" /> 
+        
+        <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="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};
+        </echo>
+        
+        
+        <xslt basedir="./" style="${object_modeling_build_infrastructure.xsl}"  in="${default_db.xml}"  destdir="./" out="${build_object_modeling_build_infrastructure_child.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="{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="TargetNamespace" expression="${TargetNamespaceBindingsApi}/${NamespaceDatabaseStorageDefinitionPrefix}/${NamespaceObjectInstanceType}"/>
+            <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <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>

+ 48 - 0
SE/schema/WPS_Functions/object_modeling_build_infrastructure/object_modeling_build_infrastructure.xsl

@@ -0,0 +1,48 @@
+<?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"
+    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="TargetNamespace" required="yes"/>
+    <xsl:param name="prototype_object_namespace" required="yes"/>
+    
+    
+    <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"
+            xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
+            <target name="system_cache__appinfo:object_modeling_build_infrastructure_child">
+            <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)">
+                <ant>
+                    <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'"/>
+                        <xsl:attribute name="value" select="$prototype_object_namespace"/>
+                    </property>
+                    <property>
+                        <xsl:attribute name="name" select="'new_object_namespace'"/>
+                        <xsl:attribute name="value" select=" concat($TargetNamespace,'/',@name,'.xsd')"/>
+                    </property>
+                </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()"/>
+    
+</xsl:stylesheet>

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

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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
+    </description>
+    
+    <!-- modules WPS_Functions - to be copied to any module needed -->
+    <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"/>
+    <!-- eof modules WPS_Functions  -->
+    
+    <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_by_default_db_xml_schema_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />
+    <property name="object_modeling_by_default_db_xml_schema_basedir.temp" location="${object_modeling_by_default_db_xml_schema_basedir}/temp"  />
+    
+    
+    
+    <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="system_cache__appinfo:default_db_get_xml_schema" depends="read_build_properties">
+        <echo>We try to refresh ${default_db.xml} </echo>
+        <delete file="${default_db.xml}"/>
+        
+        <exec executable="curl" output="${default_db.xml}" errorproperty="wfs_error" resultproperty="wfs_result"> <!--  errorproperty="wfs_error" resultproperty="wfs_result" -->
+            <arg line=" -H 'Authorization: Basic ${passwordBase64Basic}' &#34;${default_db.xml.get_url}&#34;"/> <!-- ${TargetNamespaceBindings}/SE/version-git/api.php/xml/xsd/default_db  -->
+        </exec>
+    </target>
+</project>

+ 254 - 0
SE/schema/WPS_Functions/object_modeling_new/build_object_modeling_new.xml

@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="../../." name="object_modeling_new" default="system_cache__appinfo:object_modeling_new"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
+    <description>
+        TO model objects capabilities
+    </description>
+    
+    
+    <!-- modules WPS_Functions - to be copied to any module needed -->
+    <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"/>
+    <!-- eof modules WPS_Functions  -->
+    
+    <property name="object_modeling_new_basedir" location="${basedir}/WPS_Functions/${ant.project.name}"  />                         
+    <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="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_new.xsl" location="${basedir}/default_db_xml_cache.public/object_modeling_new.xsl"/>-->
+    <!--<property name="build_properties" location="${basedir}/build_properties" />-->
+    
+    
+   <!-- <property name="table.local" location="${public_html}/table"/>
+    
+    <property name="transformed.local" location="${default_db.instance.xml}/transformed"/>
+    <property name="procesy5_system_schema.xml" value="${transformed.local}/procesy5_system_schema.xml"/>
+    -->
+    
+    <target name="system_cache__appinfo:object_modeling_new_create_dirs">
+        <mkdir dir="${object_modeling_new_basedir_temp}"/>
+    </target>
+    
+    <target name="read_build_properties" depends="system_cache__appinfo:object_modeling_new_create_dirs">
+        <ant antfile="${build_WPS_Functions.xml}" target="save_build_properties"/>
+        <loadproperties srcfile="${build_WPS_Functions.xml.properties}"/>
+        <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="system_cache__appinfo:object_modeling_new_check_condition">
+        <!--<input addproperty="prototype_object_namespace" defaultvalue="https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd" />--> <!-- https://biuro.biall-net.pl/wfs/default_db/Types/Infrastructure.xsd -->
+        <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 -->
+        <!--<input addproperty="new_object_namespace" defaultvalue="${TargetNamespaceBindingsApi}/${$NamespaceDatabaseStorageDefinitionPrefix}/${$NamespaceObjectInstanceTable}.xsd" />--> <!-- https://biuro.biall-net.pl/wfs/default_db/table/Rozdzielcza_struktura_wewnetrzna_wsg84.xsd -->
+         
+        <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>
+        
+        <echo>#62 we checked it</echo>
+        <antcall target="system_cache__appinfo:object_modeling_new_check_fail"/>
+    </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">
+        <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 -->
+        <ant antfile="${build_root.xml}" target="procesy5_system_schema.xml_if_not_exists" />
+        
+        <echo> object_modeling_new_repository= ${object_modeling_new_repository}
+            procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
+            TargetNamespaceBindingsApi ${TargetNamespaceBindingsApi}
+            NamespaceDatabaseStorageDefinitionPrefix ${NamespaceDatabaseStorageDefinitionPrefix}
+            NamespaceObjectInstanceType ${NamespaceObjectInstanceType}
+            NamespaceObjectInstanceTable ${NamespaceObjectInstanceTable}
+            template_object.xml_location ${template_object.xml_location}
+            object_modeling_new_basedir_repository ${object_modeling_new_basedir_repository}
+            
+        </echo>
+        
+        <xslt basedir="./" style="${object_modeling_new.xsl}"  in="${procesy5_system_schema.xml}"  destdir="./" out="${object_modeling_new_in_schema_check.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="{http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd}object_modeling_new_test_if_exists"/>
+            </factory>
+            <!--<param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>-->
+            <param name="TargetNamespaceBindingsApi" expression="${TargetNamespaceBindingsApi}"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" expression="${NamespaceDatabaseStorageDefinitionPrefix}"/>
+            <param name="NamespaceObjectInstanceType" expression="${NamespaceObjectInstanceType}"/>
+            <param name="NamespaceObjectInstanceTable" expression="${NamespaceObjectInstanceTable}"/>
+            <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}"/>
+            <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}"/>
+        <condition property="system_cache__appinfo:object_modeling_new_in_schema_check" taskname="system_cache__appinfo:object_modeling_new_in_schema_check">
+            <contains string="${object_modeling_new_in_schema_check.xml.loadfile}" substring="ERROR"/>
+        </condition>
+        <antcall target="system_cache__appinfo:object_modeling_new_in_schema_check_fail"/>
+    </target>
+    <target name="system_cache__appinfo:object_modeling_new_in_schema_check" depends="system_cache__appinfo:object_modeling_new_in_schema_check_condition"/>
+    <target name="system_cache__appinfo:object_modeling_new_in_schema_check_fail" if="${system_cache__appinfo:object_modeling_new_in_schema_check}">
+        <fail message="ERROR ${object_modeling_new_in_schema_check.xml.loadfile}"/>
+    </target>
+    
+    
+    
+    <target name="system_cache__appinfo:object_modeling_new_in_xsd_check" depends="system_cache__appinfo:object_modeling_new_in_schema_check_condition" description="To check if such object exists in xsd repository"/>
+    
+    <target name="system_cache__appinfo:object_modeling_new_check_fail" if="${system_cache__appinfo:object_modeling_new_check}">
+        <echo>OUTPUT_START</echo>
+        <echo> Modeled object already exists in template directory - use model function instead of create new</echo>
+        <echo>OUTPUT_END</echo>
+        <fail/>
+    </target>
+    
+    <target name="system_cache__appinfo:object_modeling_new" depends="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" />
+        <echo> object_modeling_new_repository= ${object_modeling_new_repository}
+            procesy5_system_schema.xml= ${procesy5_system_schema.xml} 
+            generating from ${prototype_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}" >
+            <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}object_modeling_new"/>
+            </factory>
+            <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <param name="TargetNamespaceBindingsApi" expression="${TargetNamespaceBindingsApi}"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" expression="${NamespaceDatabaseStorageDefinitionPrefix}"/>
+            <param name="NamespaceObjectInstanceType" expression="${NamespaceObjectInstanceType}"/>
+            <param name="NamespaceObjectInstanceTable" expression="${NamespaceObjectInstanceTable}"/>
+            <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}"/>
+            <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}"/>
+        <echo message="${new_object_by_prototype_result.xml_loadfile}"/>
+    </target>
+    
+    
+    
+    
+    
+    
+    <target name="test_hand_usage_modeling_new" description="To use it manually and edit to create object and development testing">
+        <!--<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"/>
+            <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">
+            <param name="NamespaceObjectInstanceTable" value="CRM_PRZYPADEK"/>
+            <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">
+            <param name="NamespaceObjectInstanceTable" value="CRM_IMAGE"/>
+            <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">
+            <param name="NamespaceObjectInstanceTable" value="SALES_PLAN"/>
+            <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">
+            <param name="NamespaceObjectInstanceTable" value="Rozdzielcza_lokalizacje"/>
+            <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"/>
+        </antcall>-->
+        <antcall target="system_cache__appinfo:object_modeling_new">
+            <param name="NamespaceObjectInstanceTable" value="CRM_LISTA_ZASOBOW_OFFERS"/>
+            <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>
+    </target>
+    
+    
+    
+    
+    <target  name="system_cache__appinfo:object_modeling_new_add_new_table"  depends="system_cache__appinfo:object_modeling_new_in_schema_check,system_cache__appinfo:object_modeling_new_in_xsd_check" description="TODO Create new 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 -->
+        <echo>OKOKOKOKOKOK</echo>
+        <tempfile property="object_modeling_new_add_new_table.request" destdir="${object_modeling_new_basedir_temp}" prefix="object_modeling_new_add_new_table.request" suffix=".xml"/>
+        <tempfile property="object_modeling_new_add_new_table.result" destdir="${object_modeling_new_basedir_temp}" prefix="object_modeling_new_add_new_table.result" suffix=".xml"/>
+        <echoxml file="${object_modeling_new_add_new_table.request}" namespacepolicy="ignore">
+            <object_modeling_new_add_new_table  
+                TargetNamespaceBindingsApi="${TargetNamespaceBindingsApi}" 
+                NamespaceDatabaseStorageDefinitionPrefix="${NamespaceDatabaseStorageDefinitionPrefix}"
+                NamespaceObjectInstanceType="${NamespaceObjectInstanceType}"
+                NamespaceObjectInstanceTable="${NamespaceObjectInstanceTable}"/>
+        </echoxml>
+        <xslt basedir="./" style="${object_modeling_new.xsl}"  in="${object_modeling_new_add_new_table.request}"  destdir="./" out="${object_modeling_new_add_new_table.result}" >
+            <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}object_modeling_new_add_new_table"/>
+            </factory>
+            <param name="prototype_object_namespace" expression="${prototype_object_namespace}"/>
+            <param name="TargetNamespaceBindingsApi" expression="${TargetNamespaceBindingsApi}"/>
+            <param name="NamespaceDatabaseStorageDefinitionPrefix" expression="${NamespaceDatabaseStorageDefinitionPrefix}"/>
+            <param name="NamespaceObjectInstanceType" expression="${NamespaceObjectInstanceType}"/>
+            <param name="NamespaceObjectInstanceTable" expression="${NamespaceObjectInstanceTable}"/>
+            <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}"/>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+        </xslt>
+        
+    </target>
+    
+    <target name="system_cache__appinfo:object_modeling_new_add_child_element" description="TODO add new child element"/>
+    <target name="system_cache__appinfo:object_modeling_new_add_root_element_by_restriction" description="TODO add new instance element based on existient complexType"/>
+    <target name="system_cache__appinfo:object_modeling_new_add_root_element_by_aliasing" description="TODO add new instance element based on existient complexType"/>
+    
+    <target name="system_cache__appinfo:object_modeling_new_add_child_element_reference" description="TODO add new element to reference"/>
+    
+    <target name="system_cache__appinfo:object_modeling_new_modify_child_element_simpleType" description="TODO set simpleType"/>
+    <target name="system_cache__appinfo:object_modeling_new_add_simpleType" description="TODO add new simpleType"/>
+    <target name="system_cache__appinfo:object_modeling_new_add_simpleType_derived" description="TODO add new simpleType based by existient simpleType adding new type enum to parent and single value to child"/>
+    
+    <target name="system_cache__appinfo:object_modeling_new_modify_child_element_set_simpleType_to_parent" description="TODO to add simpleType to complexType - first parent complexType of parent simpleType than to all complexType"/>
+    <target name="system_cache__appinfo:object_modeling_new_modify_child_element_set_simpleType_to_derived" description="TODO controlled allow set simpleType to derived complexType by controlling derivation"/>
+    <!-- occurs -->
+    <target name="system_cache__appinfo:object_modeling_new_modify_child_element_set_Occurs_to_parent" description="TODO modify max/min Occurs to parent complexType and set all derived"/>
+    <target name="system_cache__appinfo:object_modeling_new_modify_child_element_set_Occurs_to_derived" description="TODO modify max/min Occurs to derived with controlling of derivation tree"/>
+  
+</project>

+ 1 - 0
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/check_java_process_count

@@ -0,0 +1 @@
+../../WPS_Functions/default_db/check_java_process_count

+ 88 - 12
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build_recurse_ant.xml

@@ -2,7 +2,7 @@
 <project basedir="." name="recurse_ant" default="buildpdf_recursed"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xs="http://www.w3.org/2001/XMLSchema" >
     <description>
-        Druki dedykowane dla danego typu
+        Druk domyslny dla danego typu
     </description>
     <!-- template do kopiowania test-druk @2017-03-02 bindera 
     Copyright BIALL-NET sp. z o.o. wszelkie prawa zastrzezone
@@ -34,10 +34,10 @@
         -DtypeName="p5_default_db:IN7_DZIENNIK_KORESP" 
         -Dxpath=ID -Dxpath_value=1000 
         -Duuid=1 -DwebRootUrl=somePathDir-->
-    <property name="basedir"  value="${basedir}" /> <!-- do ustalenia glownego katalogu -->
+    <property name="basedir"  location="${basedir}" /> <!-- do ustalenia glownego katalogu -->
     <property name="default_db:recurse_ant_basedir" location="."/>
     <property name="default_db:recurse_ant_basedir.temp" location="${default_db:recurse_ant_basedir}/temp/${uuid}"/> <!-- /${uuid} -->
-    <property name="default_db:recurse_ant" location="${default_db:recurse_ant}"/>
+    <property name="default_db:recurse_ant" value="${default_db:recurse_ant_basedir}/build_recurse_ant.xml"/>
      
     <property name="out" value="out"/> <!-- output ready files like pdf -->
     <property name="p5_tr_map_dir" location="${basedir}/../../../default_db.instance.xml/p5_tr_map" />
@@ -66,6 +66,8 @@
     <!--<property name="temp_name" value="temp" />--> <!-- temp files-->
     <property name="temp" value="${default_db:recurse_ant_basedir.temp}${loop_path_recurs}" /> <!-- temp files-->
     <property name="xpath_query.xsl" value="${default_db:recurse_ant_basedir.temp}/${uuid}.xpath_query.xsl"/>
+    <property name="build_recurse_ant_xpath_query.xsl" value="${default_db:recurse_ant_basedir.temp}/build_recurse_ant_xpath_query.xsl"/>
+    <property name="process_locks" value="${default_db:recurse_ant_basedir.temp}/.locks"/>
     <property name="empty.xml" value="${temp}/${uuid}.empty.xml"/>
     <!-- variables to first transform of doc for then get related features -->
     <!--<property name="default_db_xml_cache.public" value="../../../default_db_xml_cache.public"/>--> <!-- katalog z xsl z projektu src-xmlschema.git -->
@@ -79,11 +81,16 @@
     <property name="out_task.dita.final_with_RelatedFeatureLoop"   value="${default_db:recurse_ant_basedir}/out/${uuid}.out_task.dita.final_with_RelatedFeatureLoop" />
     
     <property name="ant-launcher.jar" location="/opt/local/share/java/apache-ant/lib/ant-launcher.jar"/><!-- should be also set in parent build -->
+    <property name="build_check_java_process_count.xml"  value="${basedir}/../check_java_process_count/build_check_java_process_count.xml"/>
+    <property name="parallel_java_process_max" value="10"/> <!-- to limit max processes in parallel concurent tasks jobs - will use ${build_check_java_process_count.xml} -->
      <!-- do zrobienia  -->
     <!--<tempfile property="wfs_output" deleteonexit="no"  destdir="temp"  suffix=".xml" />-->
+    <property name="get_wfs_basedir" location="${default_db:recurse_ant_basedir}/../../get_wfs"/>
+    <property name="get_wfs" location="${get_wfs_basedir}/build_get_wfs.xml"/>
     
-
+    <property name="parallel_pos" value="1"/>
     
+    <echo>#93 $typeName= ${typeName};  $xpath= ${xpath};  $xpath_value= ${xpath_value}  </echo>
 
     <!--<echo> $basedir=${basedir}; 
         $temp=${temp};
@@ -303,7 +310,12 @@
                         <!--<echo message="OUTPUT__END"/>-->
                     </target>
     
-        <target name="xml_recursed_from_tr_map_with_RelatedFeatureLoop" depends="xml_recursed_from_tr_map" description="URL_TASK Pobierz XML obiektu">
+    
+        <target name="mkdir_process_locks">
+            <mkdir dir="${process_locks}"/>
+        </target>
+    
+    <target name="xml_recursed_from_tr_map_with_RelatedFeatureLoop" depends="mkdir_process_locks,build_recurse_ant_xsl_xpath_filter.xsl,xml_recursed_from_tr_map" description="URL_TASK Pobierz XML obiektu">
                         
                         <!-- TODO proba wlaczenia rekursywnosci zapisanie wezla do sciezki w folderze-->
                         <!--<copy file="${out_task.dita.final}" tofile="${temp}/${loop_path_recurs}/${uuid_tested}.loop_path.xml" />-->
@@ -386,6 +398,8 @@
         <property name="build_recurse_ant_merge_dita_from_temp.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_merge_dita_from_temp.xsl"/>
         <property name="builds_to_ant.xsl" value="${default_db_xml_cache.public}/builds_to_ant.xsl"/>
         <property name="xpath_query_check_create_xsl.xsl" value="${default_db_xml_cache.public}/xpath_query_check_create_xsl.xsl"/>
+        <property name="build_recurse_ant_xsl_xpath_filter.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_xsl_xpath_filter.xsl"/>
+        <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
         <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     
@@ -396,6 +410,7 @@
         <property name="build_recurse_ant_merge_dita_from_temp.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_merge_dita_from_temp.xsl"/>
         <property name="builds_to_ant.xsl" value="${default_db_xml_cache.public}/builds_to_ant.xsl"/>
         <property name="xpath_query_check_create_xsl.xsl" value="${default_db_xml_cache.public}/xpath_query_check_create_xsl.xsl"/>
+        <property name="build_recurse_ant_xsl_xpath_filter.xsl" value="${default_db_xml_cache.public}/build_recurse_ant_xsl_xpath_filter.xsl"/>
         <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     
@@ -476,6 +491,52 @@
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <param name="xpath_query" expression="[1=1]"/>
         </xslt>
+        <!--<copyfile src="${build_recurse_ant.xsl}" dest="${build_recurse_ant_xpath_query.xsl}"/>-->
+        <!--<xslt basedir="${default_db:recurse_ant_basedir}" style="${xpath_query_check_create_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${xpath_query.xsl}_secondary.xsl"  >
+            <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="xpath_query_check_create_xsl"/> 
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="xpath_query" expression="[1=1]"/>
+        </xslt>-->
+    </target>
+    
+    
+    <target name="build_recurse_ant_xsl_xpath_filter.xsl_check" description="if it is set ">
+        <condition taskname="build_recurse_ant_xsl_xpath_filter.xsl" property="xpath_query_set">
+            <or>
+                <equals arg1="${xpath_query}" arg2=""/>
+                <equals arg1="${xpath_query}" arg2="$${xpath_query}"/>
+            </or>
+        </condition>
+        <antcall target="build_recurse_ant_xsl_xpath_filter.xsl_fail"/> <!-- if failed run or not if not -->
+    </target>
+    
+    <target name="build_recurse_ant_xsl_xpath_filter.xsl_fail" depends="check_default_db_xml_cache.public_default,check_set_default_db_xml_cache.public_local"  if="${xpath_query_set}"  description="if it is not set ">
+        <echo>build_recurse_ant_xsl_xpath_filter.xsl using $default_db_xml_cache.public ${default_db_xml_cache.public}</echo>
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${build_recurse_ant_xsl_xpath_filter.xsl}" in="${build_recurse_ant.xsl}"  destdir="./" out="${build_recurse_ant_xpath_query.xsl}"  >
+            <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="xpath_query_check_create_xsl"/>--> 
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="xpath_query" expression="[1=1]"/>
+            <param name="default_db_xml_cache.public" expression="${default_db_xml_cache.public}"/>
+        </xslt>
+    </target>
+    
+    <target name="build_recurse_ant_xsl_xpath_filter.xsl" depends="check_default_db_xml_cache.public_default,check_set_default_db_xml_cache.public_local,build_recurse_ant_xsl_xpath_filter.xsl_check" unless="${xpath_query_set}" description="Create build_recurse_ant_xsl_xpath_filter.xsl">
+        <echo>build_recurse_ant_xsl_xpath_filter.xsl using $default_db_xml_cache.public ${default_db_xml_cache.public}</echo>
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${build_recurse_ant_xsl_xpath_filter.xsl}" in="${build_recurse_ant.xsl}"  destdir="./" out="${build_recurse_ant_xpath_query.xsl}"  >
+            <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="xpath_query_check_create_xsl"/>--> 
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="xpath_query" expression="${xpath_query}"/>
+            <param name="default_db_xml_cache.public" expression="${default_db_xml_cache.public}"/>
+        </xslt>
     </target>
     
     <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
@@ -484,9 +545,9 @@
         <property name="loop_xpath"  value="root" />
         <property name="build_recurse_ant.xml" value="${temp}/${uuid_tested}.build_${loop_xpath}.xml" />
         <echo>#113 ant build_recurse_ant.xml=${build_recurse_ant.xml}; </echo>
-        <record name="ant.log" loglevel="verbose" append="true" />
+        <!--<record name="ant.log" loglevel="verbose" append="true" />-->
         <!--<delete file="${build_recurse_ant.xml}"/>-->
-        <xslt basedir="${default_db:recurse_ant_basedir}" style="${build_recurse_ant.xsl}" in="${main_build_recurse_ant.dita_with_id}"  destdir="./" out="${build_recurse_ant.xml}"  >
+        <xslt basedir="${default_db:recurse_ant_basedir}" style="${build_recurse_ant_xpath_query.xsl}" in="${main_build_recurse_ant.dita_with_id}"  destdir="./" out="${build_recurse_ant.xml}"  >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
             </factory>
@@ -514,7 +575,7 @@
             <param name="recurse_ant_basedir" expression="${default_db:recurse_ant_basedir}"/>
             <param name="recurse_ant_basedir.temp" expression="${default_db:recurse_ant_basedir.temp}"/>
             <param name="recurse_ant" expression="${default_db:recurse_ant}"/>
-            <param name="build_recurse_ant.xsl" expression="${build_recurse_ant.xsl}"/>
+            <param name="build_recurse_ant.xsl" expression="${build_recurse_ant_xpath_query.xsl}"/>
             <param name="temp" expression="${temp}"/>
             <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
             <param name="cookie_curl_option" expression="${php_session_id_tested}"/>
@@ -526,10 +587,20 @@
             <param name="simpleSchema_dir" expression="${simpleSchema_dir}"/>
             <param name="default_db_xml_cache.public" expression="${default_db_xml_cache.public}"/>
             <param name="ant-launcher.jar" expression="${ant-launcher.jar}"/>
+            <param name="build_check_java_process_count.xml" expression="${build_check_java_process_count.xml}"/>
+            <param name="parallel_java_process_max" expression="${parallel_java_process_max}"/>
+            <param name="debug_xsl_in_filename" expression="${main_build_recurse_ant.dita_with_id}"/>
+            <param name="debug_xsl_out_filename" expression="${build_recurse_ant.xml}"/>
+            <param name="debug_xsl_out_filename" expression="${build_recurse_ant.xml}"/>
+            <param name="parallel_pos" expression="${parallel_pos}"/>
+            <param name="process_locks" expression="${process_locks}"/>
+            <param name="get_wfs" expression="${get_wfs}"/>
         </xslt>
         <!--<import file="${build_recurse_ant.xml}"/>-->
-        <record action="stop" name="ant.log"/>
-        <ant  antfile="${build_recurse_ant.xml}" dir="." />
+        <!--<record action="stop" name="ant.log"/>-->
+        <ant  antfile="${build_recurse_ant.xml}" dir="." >
+            <property name="parallel_pos" value="${parallel_pos}"/> <!-- To discrete parallel tasks in tempfiles creation errors etc -->
+        </ant>
 
         <!-- pozbierac wszystkie do kupy xmle  -->
     </target>
@@ -565,7 +636,12 @@
             <param name="temp" expression="${temp}"/>
             <param name="simpleSchema_dir" expression="${simpleSchema_dir}"/>
         </xslt>
-        <echo> zapisalem plik gotowy do utworzenia dita do ${out_task.dita.final}. </echo>
+        <echo> *************************************************************************
+               * #573 FIHISHED NODE-LOOP in SAVED TO BE MERGED BY MERGE                     
+               * $temp is ${temp}                                                      
+               * Saved to ${out_task.dita.final} . 
+               *************************************************************************    
+        </echo>
     </target>
     
     <target name="xml_recursed_from_tr_map_with_RelatedFeatureLoop_html" depends="xml_recursed_from_tr_map" description="URL_TASK Pobierz HTML obiektu">
@@ -634,7 +710,7 @@
 
 
 
-    <target name="buildpdf_recursed" depends="install_folders,uuid_check,typeName_check,xpath_check,xpath_value_check,passwordBase64Basic_check,php_session_id_check,check_dita" if="${test_if_dita}">
+    <target name="buildpdf_recursed" depends="install_folders,uuid_check,typeName_check,xpath_check,xpath_value_check,passwordBase64Basic_check,php_session_id_check,mkdir_process_locks,build_recurse_ant_xsl_xpath_filter.xsl,check_dita" if="${test_if_dita}">
         <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>
         <exec executable="${dita.dir}" dir=".">
             <arg value="-i"/>

+ 1 - 0
SE/schema/ant-url_action/get_wfs

@@ -0,0 +1 @@
+../WPS_Functions/get_wfs/

+ 4 - 1
SE/schema/default_db_xml_cache.public/build_ant_universal_by_xsl_match.xsl

@@ -28,6 +28,7 @@
     
     <xsl:param name="parallel" select="false()"/> <!-- if true will run in parallel using java parallel -->
     <xsl:param name="threadCount" select="10"/>
+    <xsl:param name="ant-launcher.jar" required="yes"/>
     
     <xsl:template match="*">
         <xsl:choose>
@@ -50,10 +51,12 @@
                 <xsl:choose>
                     <xsl:when test="$parallel">
                         <java>
-                            <xsl:attribute name="classname" select="'org.apache.tools.ant.Main'"/>
+                            <xsl:attribute name="jar" select="$ant-launcher.jar"/>
+                            <!--<xsl:attribute name="classname" select="'org.apache.tools.ant.Main'"/>-->
                             <xsl:attribute name="maxmemory" select="'5512m'"/> <!-- TODO test if this is working?-->
                             <!--<xsl:attribute name="fork" select="'true'"/>-->
                             <xsl:attribute name="clonevm" select="'false'"/>
+                            <xsl:attribute name="fork" select="'true'"/>
                             <arg value="-buildfile"/>
                             <arg value="{$antfile}"/>
                             <!--<arg value="-DXmx5512m"/>--><!-- TODO test if this is working?-->

Plik diff jest za duży
+ 554 - 269
SE/schema/default_db_xml_cache.public/build_recurse_ant.xsl


+ 299 - 69
SE/schema/default_db_xml_cache.public/build_recurse_ant_merge_dita_from_temp.xsl

@@ -77,10 +77,12 @@
     <xsl:template match="*" mode="root">
         <xsl:param name="loop_xpath"/>
         <xsl:param name="dita.map"/>
+        <xsl:param name="path"/>
         <xsl:element name="{name()}">
             <xsl:copy-of select="@*"/>
             <xsl:apply-templates>
                 <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                <xsl:with-param name="path" select="$path"/>
             </xsl:apply-templates>
         </xsl:element>
     </xsl:template>
@@ -111,11 +113,18 @@
     
     
     
+    <!--<xsl:template match="RelatedFeatureLoop" >
+        <Debug_RelatedFeatureLoop>
+            <xsl:copy-of select="."/>
+        </Debug_RelatedFeatureLoop>
+    </xsl:template>-->
     
     
     <xsl:template match="RelatedFeature">
         <!-- podstawamy dane z xml na podstawie path -->
-        <xsl:param name="loop_xpath" select="'root'"/>
+        <xsl:param name="loop_xpath" select="''"/>
+        <xsl:param name="path" />
+        <xsl:param name="xml_id_from_loop"/>
         <xsl:param name="feature_pos_child"  select="1"/> <!-- pierwsze wyzwolenie narzuca 1 - kolejne sa z related -->
         <!--<xsl:param name="dita_with_id" select="."/>--> <!-- TODO  jest błąd - z RelatedFeatureLoop trzeba wziac mape lokalna obiektu -->
         <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
@@ -126,16 +135,23 @@
                 <xsl:otherwise><xsl:value-of select="1"/></xsl:otherwise><!-- bylo bug @2017-04 position() -->
             </xsl:choose>
         </xsl:variable> 
-        <xsl:variable name="feature_pos_child"><!-- bylo bug @2017-04 position() -->
+        <!--<xsl:variable name="feature_pos_child"><!-\- bylo bug @2017-04 position() -\->
             <xsl:choose>
                 <xsl:when test="@feature_pos"><xsl:value-of select="@feature_pos"/></xsl:when>
                 <xsl:otherwise><xsl:value-of select="$feature_pos_child"/></xsl:otherwise>
             </xsl:choose>
-        </xsl:variable>
+        </xsl:variable>-->
         
         <xsl:message>#129 xml_position=<xsl:value-of select="@xml_position"/> while position()=<xsl:value-of select="position()"/></xsl:message>
+        <xsl:comment>#137 xml_id=<xsl:value-of select="$xml_id"/> ;   </xsl:comment>
         <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
-        <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
+        <xsl:variable name="loop_xpath" select="concat($loop_xpath,'/',$xml_id,'.',$feature_pos_child)"/> <!-- loop path too long ,'.',$featureID_name  -->
+        <xsl:variable name="path">
+            <xsl:choose>
+                <xsl:when test=" string-length($path) &lt; 1"/>
+                <xsl:otherwise><xsl:value-of select="concat($path,'/',$xml_id,'.',$feature_pos_child)"/></xsl:otherwise> <!-- loop path too long ,'.',$featureID_name -->
+            </xsl:choose>
+        </xsl:variable>
         <xsl:message>#26 odpalam $RelatedFeaturePos=<xsl:value-of select="$RelatedFeaturePos"/>; $feature_pos_child=<xsl:value-of select="$feature_pos_child"/>; loop_xpath=<xsl:value-of select="$loop_xpath"/>.dita.xml.vals.dita;</xsl:message>
         <!--<debug26>
             Will try to put file=<xsl:value-of select="concat($uuid,'.',$loop_xpath,$featureID_name,'.',$RelatedFeaturePos,'.dita.xml.vals.dita')"/>;
@@ -143,23 +159,24 @@
         <!--<xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.dita.xml.vals.dita'))"/>-->
         <xsl:variable name="dita_fragment">
             <xsl:choose>
-                <xsl:when test=" doc-available(concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))">
-                    <xsl:message>#97 INFO Related leaf xml file <xsl:value-of select="concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita')"/></xsl:message>
-                    <xsl:copy-of select="doc(concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))"/>
+                <xsl:when test=" doc-available(concat($temp,'/',$loop_xpath,'.dita.xml.vals.dita'))"> <!-- bylo   doc-available(concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))-->
+                    <xsl:message>#97 INFO Related leaf xml file <xsl:value-of select="concat($temp,'/',$loop_xpath,'.dita.xml.vals.dita')"/></xsl:message>
+                    <xsl:copy-of select="doc(concat($temp,'/',$loop_xpath,'.dita.xml.vals.dita'))"/>
                 </xsl:when>
                 <xsl:otherwise>
-                    <!--<xsl:comment>#78 NO!! INFO  Related leaf xml file <xsl:value-of select="concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita')"/>;</xsl:comment>-->
-                    <xsl:message>#78 NO!! INFO  Related leaf xml file <xsl:value-of select="concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita')"/></xsl:message>
+                    <xsl:comment>#78 NO!! INFO  Related leaf xml file <xsl:value-of select="concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita')"/>;</xsl:comment>
+                    <xsl:message>#78 NO!!! INFO  Related leaf xml file <xsl:value-of select="concat($temp,'/',$loop_xpath,'.dita.xml.vals.dita')"/></xsl:message>
                 </xsl:otherwise>
             </xsl:choose>
         </xsl:variable>
         
         <xsl:choose>
-            <xsl:when test=" doc-available(concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))">
-                <xsl:comment>#97 INFO  Related leaf xml file <xsl:value-of select="concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita')"/>;</xsl:comment>
+            <xsl:when test=" doc-available(concat($temp,'/',$loop_xpath,'.dita.xml.vals.dita'))">
+                <xsl:comment>#97 INFO  Related leaf xml file <xsl:value-of select="concat($temp,'/',$loop_xpath,'.dita.xml.vals.dita')"/>;
+                 next to find $loop_xpath = <xsl:value-of select="$loop_xpath"/> ; </xsl:comment>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:comment>#78 NO!! INFO  Related leaf xml file <xsl:value-of select="concat($temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita')"/>;</xsl:comment>
+                <xsl:comment>#78z NO!! INFO  Related leaf xml file <xsl:value-of select="concat($temp,'/',$loop_xpath,'.dita.xml.vals.dita')"/>;</xsl:comment>
             </xsl:otherwise>
         </xsl:choose>
         <!--<xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))"/>-->
@@ -172,97 +189,206 @@
             <xsl:copy-of select="$dita_fragment"/>
         </debug_RelatedFeature>-->
         <!--<RelatedFeatureRoot>-->
+        <!--<debug_current_RelatedFeature>
+            <xsl:attribute name="xml_id" select="$xml_id"/>
+            <xsl:copy-of select="."/>
+        </debug_current_RelatedFeature>-->
                 <xsl:for-each select="$dita_fragment">
                     <xsl:apply-templates mode="RelatedFeature" select="$dita_fragment/RelatedFeatureRoot/*">
                         <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
                         <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
                         <xsl:with-param name="dita.map" select="$dita.map"/>
+                        <xsl:with-param name="path" select="$path"/>
+                        <xsl:with-param name="xml_id_from_loop" select="$xml_id_from_loop"/>
                     </xsl:apply-templates>
                 </xsl:for-each>
         <!--</RelatedFeatureRoot>-->
     </xsl:template>
     
     
+    
     <xsl:template match="RelatedFeatureLoop" mode="RelatedFeatureChild">
         <!-- podstawamy dane z xml na podstawie path -->
-        <xsl:param name="path" select="$temp"/> <!-- budowa sciezki do wchodzenia do struktur - domyslnie zaczyna sie od $temp-->
+        <xsl:param name="loop_xpath" required="yes"/> <!-- zmiana od 2017-04 - dobudowujemy do loop-path -->
+        <xsl:param name="path"/> <!-- budowa sciezki do wchodzenia do struktur - domyslnie zaczyna sie od $temp-->
         <xsl:param name="feature_pos_child"  select="1"/>
+        <xsl:param name="xml_id_from_loop" />
         <!--<xsl:param name="dita_with_id" required="yes"/>-->
-        <xsl:if test="$with_RelatedFeatureLoop">
-                    <xsl:variable name="xml_id" select="@xml_id"/>
-                    <xsl:variable name="RelatedFeaturePos" select="position()"/>
-                    <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
-                    <xsl:variable name="featureID_prefix" select="substring-before(@typeName,':')"/>
-                    <xsl:variable name="system_cache__appinfo:loop_id" select="@system_cache__appinfo:loop_id"/>
-                    <xsl:variable name="path">
-                        <xsl:value-of select="concat($path,'/',$xml_id,'.',$uuid,'.',$feature_pos_child)"/> 
-                    </xsl:variable>
-                    <xsl:message>#157 RelatedFeatureLoop $path=<xsl:value-of select="$path"/>; $xml_id=<xsl:value-of select="$xml_id"/>; $RelatedFeaturePos=<xsl:value-of select="$RelatedFeaturePos"/>; $feature_pos_child=<xsl:value-of select="$feature_pos_child"/>;</xsl:message>
-                    <!--<debug26>
+        <xsl:variable name="xml_id" select="@xml_id"/>
+        <xsl:variable name="RelatedFeaturePos" select="position()"/>
+        <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
+        <xsl:variable name="featureID_prefix" select="substring-before(@typeName,':')"/>
+        <xsl:variable name="system_cache__appinfo:loop_id" select="@system_cache__appinfo:loop_id"/>
+        <xsl:variable name="feature_pos_parent" select="@feature_pos_parent"/>
+        <xsl:choose>
+            <xsl:when test=" string-length($path) &lt; 1">
+                <xsl:comment>#218 standardowe pierwsze RelatedFeatureLoop</xsl:comment>
+                <xsl:variable name="path">
+                    <xsl:choose><!-- z innego wyzwolenia RelatedFeatureLoop nie dopisujemy do $temp - tylko raz -->
+                        <xsl:when test=" string-length($path) &lt; 1">
+                            <xsl:value-of select="concat($temp,$loop_xpath)"/>
+                        </xsl:when>
+                        <xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:choose>
+                    <xsl:when test="$with_RelatedFeatureLoop">
+                       
+                        <!--<xsl:variable name="path">
+                        <xsl:value-of select="concat($path,'/',$xml_id,'.',$uuid,'.',$feature_pos_child)"/> <!-\- bylo przed 2017-04 concat($path,'/',$xml_id,'.',$uuid,'.',$feature_pos_child) -\->
+                    </xsl:variable>-->
+                        <xsl:variable name="path" select="concat($path,'/',$xml_id,'.',$feature_pos_child)"/> <!-- loop path too long ,'.',$featureID_name -->
+                        <xsl:comment>#157 $path = <xsl:value-of select="$path"/> ; </xsl:comment>
+                        <xsl:comment>#180 loop $xml_id=<xsl:value-of select="$xml_id"/>; $featureID_name= <xsl:value-of select="$featureID_name"/>;  $feature_pos_child=<xsl:value-of select="$feature_pos_child"/>; $RelatedFeaturePos=<xsl:value-of select="$RelatedFeaturePos"/>;  </xsl:comment>
+                        <xsl:message>#157 RelatedFeatureLoop $path=<xsl:value-of select="$path"/>; $xml_id=<xsl:value-of select="$xml_id"/>; $RelatedFeaturePos=<xsl:value-of select="$RelatedFeaturePos"/>; $feature_pos_child=<xsl:value-of select="$feature_pos_child"/>;
+                            $loop_xpath= <xsl:value-of select="$loop_xpath"/> ;
+                        </xsl:message>
+                        <!--<debug26>
                         Will try to put file=<xsl:value-of select="concat($uuid,'.',$loop_xpath,$featureID_name,'.',$RelatedFeaturePos,'.dita.xml.vals.dita')"/>;
                     </debug26>-->
-                    <!--<xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.dita.xml.vals.dita'))"/>-->
-            <xsl:comment>#174 look in <xsl:value-of select="concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'_out_task_dita_final.dita.xml')"/>;</xsl:comment>
-                    <xsl:variable name="dita_fragment">
-                        <xsl:choose>
-                            <xsl:when test=" doc-available(concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'_out_task_dita_final.dita.xml'))">
-                                <xsl:message>#156 INFO Related leaf xml file <xsl:value-of select="concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'_out_task_dita_final.dita.xml')"/></xsl:message>
-                                <xsl:copy-of select="doc(concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'_out_task_dita_final.dita.xml'))"/>
-                            </xsl:when>
-                            <xsl:otherwise>
-                                <!--<xsl:comment>#156 INFO no Related leaf xml file <xsl:value-of select="concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'.out_task.dita.final.xml')"/>;</xsl:comment>-->
-                                <xsl:message>#156 INFO no Related leaf xml file <xsl:value-of select="concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'_out_task_dita_final.dita.xml')"/></xsl:message>
-                            </xsl:otherwise>
-                        </xsl:choose>
-                    </xsl:variable>
-                    <xsl:variable name="dita_with_id" >
-                        <xsl:choose>
-                            <!--<xsl:when test="doc-available(concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$featureID_name,'.with_id.xml'))">
+                        <!--<xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.dita.xml.vals.dita'))"/>-->
+                        <xsl:variable name="file_loook_dita_fragment" select="concat($path,'/',$uuid,'_out_task_dita_final.dita.xml')"/>
+                        <xsl:comment>#156x look in <xsl:value-of select="$file_loook_dita_fragment"/>;</xsl:comment> <!-- bylo przed 2017-04 concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'_out_task_dita_final.dita.xml')-->
+                        <xsl:variable name="dita_fragment">
+                            <xsl:choose>
+                                <xsl:when test=" doc-available($file_loook_dita_fragment)">
+                                    <xsl:message>#156A INFO Related leaf xml file <xsl:value-of select="$file_loook_dita_fragment"/></xsl:message>
+                                    <xsl:copy-of select="doc($file_loook_dita_fragment)"/>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <!--<xsl:comment>#156 INFO no Related leaf xml file <xsl:value-of select="concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'.out_task.dita.final.xml')"/>;</xsl:comment>-->
+                                    <xsl:message>#156 NONONONO INFO  Related leaf xml file <xsl:value-of select="$file_loook_dita_fragment"/></xsl:message>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:variable>
+                        <xsl:variable name="dita_with_id" >
+                            <xsl:choose>
+                                <!--<xsl:when test="doc-available(concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$featureID_name,'.with_id.xml'))">
                                 <xsl:message>#189 we load get $dita_fragment for <xsl:value-of select="$featureID_name"/>; </xsl:message>
                                 <xsl:copy-of select="doc(concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$featureID_name,'.with_id.xml'))"/>
                             </xsl:when>-->
-                            <xsl:when test="doc-available(concat($simpleSchema_dir,'/',$featureID_prefix,'/',$featureID_name,'.xml'))">
-                                <xsl:message>#189 we load from simpleSchema_dir get $dita_fragment for <xsl:value-of select="$featureID_name"/>; </xsl:message>
-                                <xsl:copy-of select="doc(concat($simpleSchema_dir,'/',$featureID_prefix,'/',$featureID_name,'.xml'))"/>
+                                <xsl:when test="doc-available(concat($simpleSchema_dir,'/',$featureID_prefix,'/',$featureID_name,'.xml'))">
+                                    <xsl:message>#189 we load from simpleSchema_dir get $dita_fragment for <xsl:value-of select="$featureID_name"/>; </xsl:message>
+                                    <xsl:copy-of select="doc(concat($simpleSchema_dir,'/',$featureID_prefix,'/',$featureID_name,'.xml'))"/>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:message terminate="yes">#205 brak mapy dla pozadanego obiektu $featureID_name = <xsl:value-of select="$featureID_name"/>; </xsl:message>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:variable>
+                        
+                        
+                        <xsl:choose>
+                            <xsl:when test=" doc-available($file_loook_dita_fragment)">
+                                <xsl:comment>#156A INFO  RelatedLoop leaf xml file <xsl:value-of select="$file_loook_dita_fragment"/>;</xsl:comment>
                             </xsl:when>
                             <xsl:otherwise>
-                                <xsl:message terminate="yes">#205 brak mapy dla pozadanego obiektu $featureID_name = <xsl:value-of select="$featureID_name"/>; </xsl:message>
+                                <xsl:comment>#156 NO!! INFO  RelatedLoop leaf xml file <xsl:value-of select="$file_loook_dita_fragment"/>;</xsl:comment>
                             </xsl:otherwise>
                         </xsl:choose>
-                    </xsl:variable>
-                    <!--<Loop_dita_with_id>
+                        <!--<Loop_dita_with_id>
                         <xsl:copy-of select="$dita_with_id"/>
                     </Loop_dita_with_id>-->
-                    <!--<Loop_dita_fragment>
+                        <!--<Loop_dita_fragment>
                         <xsl:copy-of select="$dita_fragment"/>
                     </Loop_dita_fragment>-->
-                    <xsl:comment>#180 loop $xml_id=<xsl:value-of select="$xml_id"/>; $feature_pos_child=<xsl:value-of select="$feature_pos_child"/>; $RelatedFeaturePos=<xsl:value-of select="$RelatedFeaturePos"/>; $dita_fragment(empty)=<xsl:value-of select="empty($dita_fragment)"/> empty($dita_with_id)=<xsl:value-of select="empty($dita_with_id)"/>; </xsl:comment>
-                    <xsl:for-each select="$dita_fragment">
+                        <xsl:comment>#180 loop $xml_id=<xsl:value-of select="$xml_id"/>; $feature_pos_child=<xsl:value-of select="$feature_pos_child"/>; $RelatedFeaturePos=<xsl:value-of select="$RelatedFeaturePos"/>; $dita_fragment(empty)=<xsl:value-of select="empty($dita_fragment)"/> empty($dita_with_id)=<xsl:value-of select="empty($dita_with_id)"/>; </xsl:comment>
                         <xsl:for-each select="$dita_fragment">
-                            <xsl:apply-templates mode="RelatedFeatureLoop" select="$dita_fragment/RelatedFeatureRoot">
-                                <xsl:with-param name="dita_with_id" select="$dita_with_id"/>
-                                <xsl:with-param name="xml_id" select="$xml_id"/>
-                                <xsl:with-param name="path" select="$path"/>
-                                <!--<xsl:with-param name="system_cache__appinfo:loop_id" select="$system_cache__appinfo:loop_id"/>-->
-                            </xsl:apply-templates>
+                            <xsl:for-each select="$dita_fragment">
+                                <xsl:apply-templates mode="RelatedFeatureLoop" select="$dita_fragment/RelatedFeatureRoot">
+                                    <xsl:with-param name="dita_with_id" select="$dita_with_id"/>
+                                    <xsl:with-param name="xml_id" select="$xml_id"/>
+                                    <xsl:with-param name="path" select="$path"/>
+                                    <!--<xsl:with-param name="system_cache__appinfo:loop_id" select="$system_cache__appinfo:loop_id"/>-->
+                                </xsl:apply-templates>
+                            </xsl:for-each>
                         </xsl:for-each>
-                    </xsl:for-each>
-                    <!--<xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))"/>-->
-                    <!--<xsl:variable name="dita_fragment">
+                        <!--<xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))"/>-->
+                        <!--<xsl:variable name="dita_fragment">
                         <xsl:call-template name="get_childs_rows">
                             <xsl:with-param name="element-filename" select="concat($uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.')"/>
                         </xsl:call-template>
                     </xsl:variable>-->
-                    <!--<debug_RelatedFeature>
+                        <!--<debug_RelatedFeature>
                         <xsl:copy-of select="$dita_fragment"/>
                     </debug_RelatedFeature>-->
-        </xsl:if>
+                        
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <!-- trzeba skopiowac, aby bylo co parsowac i wstawiac zaglebienia tutaj na wyzwoleniu finalnym $with_RelatedFeatureLoop (bez dzieci i filtrow)-->
+                        <xsl:element name="{name()}">
+                            <xsl:attribute name="DEBUG294" select="1"/>
+                            <xsl:copy-of select="@*"/>
+                        </xsl:element>
+                        <!--<xsl:copy-of select="."/>-->
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:variable name="path">
+                    <xsl:choose><!-- z innego wyzwolenia RelatedFeatureLoop nie dopisujemy do $temp - tylko raz -->
+                        <xsl:when test=" string-length($path) &lt; 1">
+                            <xsl:value-of select="concat($temp,$loop_xpath)"/>
+                        </xsl:when>
+                        <xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                
+                <xsl:variable name="path" select="concat($path,'/',$xml_id_from_loop,'.',$feature_pos_parent,'/',$xml_id,'.',$feature_pos_child,'/')"/> <!-- loop path too long ,'.',$featureID_name ;   ,'.',$featureID_name-->
+                <xsl:variable name="file_loook_dita_fragment" select="concat($path,'/',$uuid,'_out_task_dita_final.dita.xml')"/>
+                <xsl:comment>#221 niestandardowe kolejne RelatedFeatureLoop
+                            $xml_id = <xsl:value-of select="$xml_id"/> ;
+                            $xml_id_from_loop = <xsl:value-of select="$xml_id_from_loop"/> ;
+                            ../position() = <xsl:value-of select="../position()"/>;
+                            $feature_pos_child = <xsl:value-of select="$feature_pos_child"/> ;
+                            $RelatedFeaturePos = <xsl:value-of select="$RelatedFeaturePos"/> ;
+                            @$feature_pos_parent = <xsl:value-of select="$feature_pos_parent"/>;
+                            $file_loook_dita_fragment = <xsl:value-of select="$file_loook_dita_fragment"/> ;
+                                  expected path = /Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/default_db/recurse_ant/temp/PROCES_INIT994_0418-2135_p15/d15141e1.1.PROCES_INIT/d15141e32.1.PROCES/d15141e62.2.PROCES/d23949e1.1.PROCES/d23949e32.2.PROCES/d23949e1.1.PROCES/d23949e32.3.PROCES
+                </xsl:comment>
+                <xsl:variable name="dita_fragment">
+                    <xsl:choose>
+                        <xsl:when test=" doc-available($file_loook_dita_fragment)">
+                            <xsl:message>#156A INFO Related leaf xml file <xsl:value-of select="$file_loook_dita_fragment"/></xsl:message>
+                            <xsl:copy-of select="doc($file_loook_dita_fragment)"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <!--<xsl:comment>#156 INFO no Related leaf xml file <xsl:value-of select="concat($temp,'/',$xml_id,'.',$uuid,'.',$feature_pos_child,'/',$uuid,'.out_task.dita.final.xml')"/>;</xsl:comment>-->
+                            <xsl:message>#156 NONONONO INFO  Related leaf xml file <xsl:value-of select="$file_loook_dita_fragment"/></xsl:message>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:variable name="dita_with_id" >
+                    <xsl:choose>
+                        <xsl:when test="doc-available(concat($simpleSchema_dir,'/',$featureID_prefix,'/',$featureID_name,'.xml'))">
+                            <xsl:message>#189 we load from simpleSchema_dir get $dita_fragment for <xsl:value-of select="$featureID_name"/>; </xsl:message>
+                            <xsl:copy-of select="doc(concat($simpleSchema_dir,'/',$featureID_prefix,'/',$featureID_name,'.xml'))"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:message terminate="yes">#205 brak mapy dla pozadanego obiektu $featureID_name = <xsl:value-of select="$featureID_name"/>; </xsl:message>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:comment>#180B loop $xml_id=<xsl:value-of select="$xml_id"/>; $feature_pos_child=<xsl:value-of select="$feature_pos_child"/>; $RelatedFeaturePos=<xsl:value-of select="$RelatedFeaturePos"/>; $dita_fragment(empty)=<xsl:value-of select="empty($dita_fragment)"/> empty($dita_with_id)=<xsl:value-of select="empty($dita_with_id)"/>; </xsl:comment>
+                <xsl:for-each select="$dita_fragment">
+                    <xsl:for-each select="$dita_fragment">
+                        <xsl:apply-templates mode="RelatedFeatureLoop" select="$dita_fragment/RelatedFeatureRoot">
+                            <xsl:with-param name="dita_with_id" select="$dita_with_id"/>
+                            <xsl:with-param name="xml_id" select="$xml_id"/>
+                            <xsl:with-param name="path" select="$path"/>
+                            <!--<xsl:with-param name="system_cache__appinfo:loop_id" select="$system_cache__appinfo:loop_id"/>-->
+                        </xsl:apply-templates>
+                    </xsl:for-each>
+                </xsl:for-each>
+            </xsl:otherwise>
+        </xsl:choose>
     </xsl:template>
     
     <xsl:template match="RelatedFeatureRoot" mode="RelatedFeatureLoop"><!-- zejscie po $dita_with_id z powrotem w czasie przetwarzania loop  -->
         <xsl:param name="path" required="yes"/>
         <xsl:param name="dita_with_id" required="yes"/>
         <xsl:param name="xml_id" required="yes"/>
+        <xsl:param name="xml_id_from_loop" />
         <!--<xsl:param name="system_cache__appinfo:loop_id" required="yes"/>-->
         <!--<dita_with_id>
             <xsl:copy-of select="$dita_with_id"/>
@@ -286,7 +412,67 @@
                         <!--<current>-->
                         <xsl:for-each select="$current/*">
                             <xsl:choose>
-                                <xsl:when test="name()='RelatedFeatureRoot'"/>                                
+                                <xsl:when test="name()='RelatedFeatureRoot'"/>
+                                <xsl:when test="name()='RelatedFeatureLoop'">
+                                    <xsl:variable name="feature_pos_parent" select="@feature_pos_parent"/>
+                                    <xsl:variable name="loop_xml_id" select="@xml_id"/>
+                                    <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
+                                    <xsl:variable name="featureID_prefix" select="substring-before(@typeName,':')"/>
+                                   <!-- <RelatedFeatureLoop_debug330>
+                                        <xsl:attribute name="loop_pos" select="$loop_pos"/>
+                                        <xsl:attribute name="path" select="$path"/>
+                                        <xsl:attribute name="xml_id" select="$xml_id"/>
+                                        <xsl:attribute name="loop_xml_id" select="$loop_xml_id"/>-->
+                                        <!--<xsl:attribute name="path_to_achieve" select="'/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/default_db/recurse_ant/temp/PROCES_INIT994_0418-2135_p15/d15141e1.1.PROCES_INIT/d15141e32.1.PROCES/d15141e62.2.PROCES/d23949e1.1.PROCES/d23949e32.2.PROCES/PROCES_INIT994_0418-2135_p15_out_task_dita_final.dita.xml'"/>-->
+                                        <!--<xsl:attribute name="test_parent_xml_id_from_loop" select="$current/parent::node()/@xml_id"/>-->
+                                            <!--<xsl:variable name="dita_with_id" >
+                                                <xsl:choose>
+                                                    <xsl:when test="doc-available(concat($simpleSchema_dir,'/', substring-before(@typeName,':'),'/', substring-after(@typeName,':'),'.xml'))">
+                                                        <xsl:message>#338 we load from simpleSchema_dir get $dita_fragment for <xsl:value-of select="@typeName"/>; </xsl:message>
+                                                        <xsl:copy-of select="doc(concat($simpleSchema_dir,'/', substring-before(@typeName,':'),'/', substring-after(@typeName,':'),'.xml'))"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xsl:message terminate="yes">#342 brak mapy dla pozadanego obiektu @typeName = <xsl:value-of select="@typeName"/>; </xsl:message>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </xsl:variable>-->
+                                        <xsl:variable name="xml_id_from_loop" select="$current/parent::node()/@xml_id"/> <!-- $dita_with_id/RelatedFeature/@xml_id -->
+                                    <xsl:variable name="file_dita_fragment" select="concat($path,'/',$xml_id_from_loop,'.',$feature_pos_parent,'/',$loop_xml_id,'.',$loop_pos,'/',$uuid,'_out_task_dita_final.dita.xml')"/> <!-- loop path too long ,'.',$featureID_name, / '.',$featureID_name,  -->
+                                    <xsl:variable name="path_after_loop" select="concat($path,'/',$xml_id_from_loop,'.',$feature_pos_parent,'/',$loop_xml_id,'.',$loop_pos)"/> <!-- loop path too long '.',$featureID_name, /  '.',$featureID_name-->
+                                         <!--<xml_id_to_find>
+                                             <xsl:attribute name="xml_id" select="$dita_with_id/RelatedFeature/@xml_id"/>
+                                             <xsl:attribute name="feature_pos_parent" select="$dita_with_id/RelatedFeature/@xml_id"/>
+                                             <xsl:attribute name="xml_id_from_loop" select="$xml_id_from_loop"/>
+                                             <xsl:attribute name="file_dita_fragment" select="$file_dita_fragment"/>
+                                             <xsl:attribute name="path_after_loop" select="$path_after_loop"/>
+                                         </xml_id_to_find>-->
+                                       
+                                            <xsl:variable name="dita_fragment">
+                                                <xsl:choose>
+                                                    <xsl:when test=" doc-available($file_dita_fragment)">
+                                                        <xsl:message>#221 INFO Related leaf xml file <xsl:value-of select="$file_dita_fragment"/></xsl:message>
+                                                        <xsl:copy-of select="doc($file_dita_fragment)"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xsl:comment>#221 INFO no Related leaf xml file <xsl:value-of select="$file_dita_fragment"/>;</xsl:comment>
+                                                        <xsl:message>#221 INFO no Related leaf xml file <xsl:value-of select="$file_dita_fragment"/></xsl:message>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </xsl:variable>
+                                        <!--<dita_fragment>
+                                            <xsl:copy-of select="$dita_fragment"/>
+                                        </dita_fragment>-->
+                                        <!--<apply_templ>-->
+                                            <xsl:apply-templates mode="RelatedFeature" select="$dita_fragment/RelatedFeatureRoot/*">
+                                                <xsl:with-param name="path" select="$path_after_loop"/>
+                                                <!--<xsl:with-param name="feature_pos_child" select="$loop_pos"/>-->
+                                                <xsl:with-param name="loop_xpath" select="$path_after_loop"/>
+                                                <xsl:with-param name="xml_id_from_loop" select="$xml_id_from_loop"/>
+                                            </xsl:apply-templates>
+                                        <!--</apply_templ>-->
+                                        <!--<content><xsl:copy-of select="."/></content>-->
+                                    <!--</RelatedFeatureLoop_debug330>-->
+                                </xsl:when>
                                 <xsl:otherwise><xsl:copy-of select="." copy-namespaces="no"/></xsl:otherwise>
                             </xsl:choose>
                         </xsl:for-each>
@@ -296,6 +482,7 @@
                                 <xsl:value-of select="concat($path,'/',@xml_id,'.',$uuid,'.',$loop_pos)"/> 
                             </xsl:variable>
                             <!--<xsl:comment>#220 $path=<xsl:value-of select="$path"/>;  </xsl:comment>-->
+                            <!--<debug_findChild><xsl:value-of select="."/></debug_findChild>-->
                             <xsl:variable name="dita_fragment">
                                 <xsl:choose>
                                     <xsl:when test=" doc-available(concat($path,'/',$uuid,'_out_task_dita_final.dita.xml'))">
@@ -317,6 +504,7 @@
                                                     <xsl:with-param name="feature_pos_child"  select="$loop_pos"/>
                                                     <xsl:with-param name="dita_with_id"  select="$dita_with_id"/>
                                                     <xsl:with-param name="xml_id" select="@xml_id"/>
+                                                    <xsl:with-param name="xml_id_from_loop" select="$current/parent::node()/@xml_id"/>
                                      </xsl:apply-templates>
                                 <!--</child_recurs>-->
                             <!-- cofniecie sie do wlasciwego dita_with_id -->
@@ -343,31 +531,55 @@
     <xsl:template mode="RelatedFeature" match="*">
         <xsl:param name="loop_xpath" required="yes"/>
         <xsl:param name="dita.map"/>
+        <xsl:param name="path"/>
+        <xsl:param name="xml_id_from_loop"/>
         <!--<xsl:param name="dita_with_id" required="yes"/>-->
         <!--<xsl:element name="{name()}">-->
             <!--<xsl:copy-of select="@*"/>-->
             <!--<xsl:apply-templates select="@*"/>-->
             <xsl:message>#94 ustalam $feature_pos_child=<xsl:value-of select="position()"/>; dla <xsl:value-of select="name()"/></xsl:message>
+            <xsl:comment>#94 ustalam $feature_pos_child=<xsl:value-of select="position()"/>; dla <xsl:value-of select="name()"/></xsl:comment>
             <xsl:apply-templates mode="RelatedFeatureChild" select=".">
                 <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
                 <xsl:with-param name="feature_pos_child" select="position()"/>
                 <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
                 <xsl:with-param name="dita.map" select="$dita.map"/>
+                <xsl:with-param name="path" select="$path"/>
+                <xsl:with-param name="xml_id_from_loop" select="$xml_id_from_loop"/>
             </xsl:apply-templates>
         <!--</xsl:element>-->
     </xsl:template>
     
+    
+    
+    
     <xsl:template mode="RelatedFeatureChild" match="*">
         <xsl:param name="loop_xpath" required="yes"/>
+        <xsl:param name="path"/>
+        <xsl:param name="xml_id_from_loop"/>
         <xsl:param name="feature_pos_child" required="yes"/>
         <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
         <!--<xsl:param name="dita_with_id" required="yes"/>-->
         <xsl:choose>
+            <!--<xsl:when test="$with_RelatedFeatureLoop and name()=RelatedFeatureLoop">
+                <DEBUG406_will_call_RelatedFeatureChild>
+                    <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
+                    <xsl:attribute name="feature_pos_child" select="$feature_pos_child"/>
+                    <xsl:copy-of select="."/>
+                </DEBUG406_will_call_RelatedFeatureChild>
+                <!-\-<xsl:apply-templates mode="RelatedFeatureChild" select=".">
+                    <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                    <xsl:with-param name="feature_pos_child" select="$loop_xpath"/>
+                    <xsl:with-param name="dita.map" select="$dita.map"/>
+                </xsl:apply-templates>-\->
+            </xsl:when>-->
             <xsl:when test="$dita.map">
                 <xsl:apply-templates mode="RelatedFeatureChild">
                     <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
                     <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
                     <xsl:with-param name="dita.map" select="$dita.map"/>
+                    <xsl:with-param name="path" select="$path"/>
+                    <xsl:with-param name="xml_id_from_loop" select="$xml_id_from_loop"/>
                     <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
                 </xsl:apply-templates>
             </xsl:when>
@@ -376,12 +588,15 @@
                     <!--<xsl:copy-of select="namespace::node()"/>-->
                     <!--<xsl:copy-of select="@*"/>-->
                     <xsl:apply-templates select="@*"/>
-                    <xsl:apply-templates mode="RelatedFeatureChild">
-                        <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-                        <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
-                        <xsl:with-param name="dita.map" select="$dita.map"/>
-                        <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
-                    </xsl:apply-templates>
+                    <!--<xsl:attribute name="feature_pos_child" select="$feature_pos_child"/>-->
+                            <xsl:apply-templates mode="RelatedFeatureChild">
+                                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                                <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
+                                <xsl:with-param name="dita.map" select="$dita.map"/>
+                                <xsl:with-param name="path" select="$path"/>
+                                <xsl:with-param name="xml_id_from_loop" select="$xml_id_from_loop"/>
+                                <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
+                            </xsl:apply-templates>
                 </xsl:element>
             </xsl:otherwise>
         </xsl:choose>
@@ -391,37 +606,52 @@
         <xsl:param name="loop_xpath" required="yes"/>
         <xsl:param name="feature_pos_child" required="yes"/>
         <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
+        <xsl:param name="path"/>
+        <xsl:param name="xml_id_from_loop"/>
         <!--<xsl:param name="dita_with_id"  required="yes"/>-->
         <xsl:apply-templates select=".">
             <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
             <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
             <xsl:with-param name="dita.map" select="$dita.map"/> <!-- bylo 1 -->
+            <xsl:with-param name="path" select="$path"/>
+            <xsl:with-param name="xml_id_from_loop" select="$xml_id_from_loop"/>
             <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
         </xsl:apply-templates>
     </xsl:template>
     
+    
+    
+    
     <xsl:template match="*" >
         <xsl:param name="loop_xpath"/>
         <xsl:param name="feature_pos_child" required="yes"/>
         <xsl:param name="dita.map"/> <!-- if set we will output many files in topics -->
         <!--<xsl:param name="dita_with_id" required="yes"/>-->
+        <xsl:param name="path"/>
+        <xsl:param name="xml_id_from_loop" />
+        
         <xsl:choose>
             <xsl:when test="$dita.map">
                 <xsl:apply-templates>
                     <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
                     <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
                     <xsl:with-param name="dita.map" select="$dita.map"/> <!-- if set we will output many files in topics -->
+                    <xsl:with-param name="path" select="$path"/>
+                    <xsl:with-param name="xml_id_from_loop" select="$xml_id_from_loop"/>
                     <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
                 </xsl:apply-templates>
             </xsl:when>
             <xsl:otherwise>
-                <xsl:element name="{name()}" >
+                <xsl:element name="{name()}">
                     <!--<xsl:copy-of select="@*"/>-->
                     <xsl:apply-templates select="@*"/>
+                    <!--<xsl:attribute name="DEBUG480" select="1"/>-->
                     <xsl:apply-templates>
                         <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
                         <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
                         <xsl:with-param name="dita.map" select="$dita.map"/> <!-- if set we will output many files in topics -->
+                        <xsl:with-param name="path" select="$path"/>
+                        <xsl:with-param name="xml_id_from_loop" select="$xml_id_from_loop"/>
                         <!--<xsl:with-param name="dita_with_id" select="$dita_with_id"/>-->
                     </xsl:apply-templates>
                 </xsl:element>

+ 177 - 0
SE/schema/default_db_xml_cache.public/build_recurse_ant_xsl_xpath_filter.xsl

@@ -0,0 +1,177 @@
+<?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"
+                exclude-result-prefixes="xs"
+                version="2.0">
+   <xsl:output indent="yes"/>
+   <xsl:strip-space elements="*"/>
+ 
+   <xsl:param name="xpath_query" required="yes"/>
+   <xsl:param name="default_db_xml_cache.public" required="yes"/>
+ 
+   <xsl:template match="xsl:stylesheet">
+      <xsl:element name="{name()}">
+         <xsl:copy-of select="namespace::node()"/>
+         <xsl:copy-of select="@*"/>
+         <xsl:apply-templates/>
+         <!-- default suppress/ignore template -->
+         <xsl:element name="xsl:template" >
+            <xsl:attribute name="match" select="'*'"/>
+            <xsl:message>#20 generated ignore xpath element</xsl:message>
+            <xsl:element name="xsl:message">
+              #22 ignored element : 
+               <xsl:element name="xsl:value-of">
+                     <xsl:attribute name="select" select="'name()'"/>
+               </xsl:element>
+               <xsl:element name="xsl:copy-of">
+                  <xsl:attribute name="select" select="'@*'"/>
+               </xsl:element>
+            </xsl:element>
+         </xsl:element>
+         <xsl:element name="xsl:template" >
+            <xsl:attribute name="match" select="'RelatedFeatureLoop'"/>
+            <xsl:attribute name="mode" select="'place_subant'"/>
+            <xsl:element name="xsl:message">
+              #32 ignored element : 
+               <xsl:element name="xsl:value-of">
+                  <xsl:attribute name="select" select="'name()'"/>
+               </xsl:element>
+               <xsl:element name="xsl:copy-of">
+                  <xsl:attribute name="select" select="'@*'"/>
+               </xsl:element>
+            </xsl:element>
+         </xsl:element>
+         <xsl:element name="xsl:template" >
+            <xsl:attribute name="match" select="'RelatedFeature'"/>
+            <xsl:attribute name="mode" select="'place_subant'"/>
+            <xsl:element name="xsl:message">
+              #42 ignored element : 
+               <xsl:element name="xsl:value-of">
+                  <xsl:attribute name="select" select="'name()'"/>
+               </xsl:element>
+               <xsl:element name="xsl:copy-of">
+                  <xsl:attribute name="select" select="'@*'"/>
+               </xsl:element>
+            </xsl:element>
+         </xsl:element>
+         <xsl:element name="xsl:template" >
+            <xsl:attribute name="match" select="'RelatedFeature'"/>
+            <xsl:attribute name="mode" select="'ant_target'"/>
+            <xsl:element name="xsl:message">
+               #52 ignored element : 
+               <xsl:element name="xsl:value-of">
+                  <xsl:attribute name="select" select="'name()'"/>
+               </xsl:element>
+               <xsl:element name="xsl:copy-of">
+                  <xsl:attribute name="select" select="'@*'"/>
+               </xsl:element>
+            </xsl:element>
+         </xsl:element>
+         <xsl:element name="xsl:template" >
+            <xsl:attribute name="match" select="'RelatedFeatureLoop'"/>
+            <xsl:attribute name="mode" select="'after_first_ant_assing_vars_childs'"/>
+            <xsl:element name="xsl:message">
+               #62 ignored element : 
+               <xsl:element name="xsl:value-of">
+                  <xsl:attribute name="select" select="'name()'"/>
+               </xsl:element>
+               <xsl:element name="xsl:copy-of">
+                  <xsl:attribute name="select" select="'@*'"/>
+               </xsl:element>
+            </xsl:element>
+         </xsl:element>
+         <xsl:element name="xsl:template" >
+            <xsl:attribute name="match" select="'RelatedFeature'"/>
+            <xsl:attribute name="mode" select="'after_first_ant_assing_vars_childs'"/>
+            <xsl:element name="xsl:message">
+               #71 ignored element : 
+               <xsl:element name="xsl:value-of">
+                  <xsl:attribute name="select" select="'name()'"/>
+               </xsl:element>
+               <xsl:element name="xsl:copy-of">
+                  <xsl:attribute name="select" select="'@*'"/>
+               </xsl:element>
+            </xsl:element>
+         </xsl:element>
+         
+         <xsl:element name="xsl:template" >
+            <xsl:attribute name="match" select="'RelatedFeature'"/>
+            <xsl:attribute name="mode" select="'after_first_ant_assing_vars'"/>
+            <xsl:element name="xsl:message">
+               #83 ignored element : 
+               <xsl:element name="xsl:value-of">
+                  <xsl:attribute name="select" select="'name()'"/>
+               </xsl:element>
+               <xsl:element name="xsl:copy-of">
+                  <xsl:attribute name="select" select="'@*'"/>
+               </xsl:element>
+            </xsl:element>
+         </xsl:element>
+      </xsl:element>
+   </xsl:template>
+   
+   
+ <xsl:template match="*">
+    <xsl:element name="{name()}">
+       <xsl:copy-of select="@*"/>
+       <xsl:apply-templates/>
+    </xsl:element>
+ </xsl:template>
+ 
+   <xsl:template match="xsl:include">
+      <xsl:element name="{name()}">
+         <xsl:apply-templates mode="apply_public_path" select="@*"/>
+      </xsl:element>
+   </xsl:template>
+   
+   <xsl:template mode="apply_public_path" match="@href">
+      <xsl:attribute name="href" select="concat($default_db_xml_cache.public,'/',.)"/>
+   </xsl:template>
+   
+   <xsl:template mode="apply_public_path" match="@*">
+      <xsl:copy-of select="."/>
+   </xsl:template>
+   
+ 
+   <xsl:template match="xsl:template">
+      <xsl:choose>
+         <xsl:when test=" ( @match='*' and not(@mode) )
+               or (  contains(@match,'RelatedFeature') and @mode='place_subant' )
+               or (  contains(@match,'RelatedFeature') and @mode='ant_target' )
+               or (  contains(@match,'RelatedFeature') and @mode='after_first_ant_assing_vars_childs' )
+               or (  contains(@match,'RelatedFeature') and @mode='after_first_ant_assing_vars' )
+                           ">
+            <xsl:element name="{name()}">
+               <xsl:apply-templates select="@*" mode="apply_xpath_filter"/>
+               <xsl:comment>#60 generated xpath filter</xsl:comment>
+               <xsl:copy-of select="*" copy-namespaces="no"/>
+            </xsl:element>
+         </xsl:when>
+         <xsl:otherwise><xsl:copy-of select="." copy-namespaces="no"/></xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+   
+   <xsl:template mode="apply_xpath_filter" match="@match">
+      <!--<xsl:choose>
+         <xsl:when test=" contains(.,'[')">
+            <xsl:variable name="no_brackets_match" select=" substring-before(.,'[')"/>
+            <xsl:variable name="no_brackets_2" select=" substring-after(.,'[')"/>
+            <xsl:variable name="no_brackets_in" select=" substring-before($no_brackets_2,']')"/>
+            <xsl:variable name="xpath_query_no_brackets" select="replace($xpath_query,'[\[\]]','')"/>
+            <xsl:attribute name="match" select="concat($no_brackets_match,'[ (',$no_brackets_in,') and (',$xpath_query_no_brackets,')]')"/>
+         </xsl:when>
+         <xsl:otherwise>
+            <xsl:attribute name="match" select="concat(.,'[child::node()',$xpath_query,']')"/>
+         </xsl:otherwise>
+      </xsl:choose>-->
+      <xsl:attribute name="match" select="concat(.,'[child::node()',$xpath_query,']')"/>
+   </xsl:template>
+   
+   <xsl:template mode="apply_xpath_filter" match="@*">
+      <xsl:copy-of select="."/>
+   </xsl:template>
+   
+   
+   
+ 
+</xsl:stylesheet>

+ 262 - 70
SE/schema/default_db_xml_cache.public/builds_to_ant.xsl

@@ -13,13 +13,21 @@
     <xsl:param name="default_antfile"/>
     <!--<xsl:param name="loop_xpath" required="yes"/>-->
     <xsl:param name="loop_xpath_real" required="yes"/>
+    <xsl:param name="loop_path_recurs" required="yes"/>
     <xsl:param name="xpath_query" required="yes"/>
     <xsl:param name="featureID_name_dita" required="yes"/>
     <xsl:param name="xpath_query_test.xml"/>
     <!--<xsl:param name="recurse_ant_basedir" required="yes"/>-->
     <!--<xsl:param name="temp_current" required="yes"/>-->
-    <xsl:param name="ant-launcher.jar"/>
-    
+    <xsl:param name="ant-launcher.jar" required="yes"/>
+    <xsl:param name="build_check_java_process_count.xml" required="yes"/>
+    <xsl:param name="parallel_java_process_max" required="yes"/>
+    <xsl:param name="loop_xpath" /> <!-- required="yes" , added at @2017-04-14 to concat $temp in exec --> 
+    <xsl:param name="feature_pos"/>
+    <xsl:param name="feature_pos_parent"/> <!-- do wykluczenia bledow z przejsciem przez loop jak jest wiecej elementow Proces_tree -->
+    <xsl:param name="process_locks"/>
+    <xsl:param name="uuid" required="yes"/>
+    <xsl:param name="debug" select="1"/>
     
     <xsl:variable name="xpath_query_test">
         <xsl:choose>
@@ -51,10 +59,41 @@
             xmlns:ogc="http://www.opengis.net/ogc"
             xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
             basedir="../."
-            name="builds_to_ant_proj{$loop_xpath_real}"
-            default="builds_to_ant{$loop_xpath_real}">
+            name="builds_to_ant_proj{$loop_path_recurs}{$loop_xpath_real}"
+            default="builds_to_ant{$loop_path_recurs}{$loop_xpath_real}">
+            
+            <property name="build_check_java_process_count.xml"  value="{$build_check_java_process_count.xml}"/>
+            <property name="parallel_java_process_max" value="{$parallel_java_process_max}"/>
+            
+            <tempfile prefix=".builds_to_ant_set_parallel_java_process_max" suffix=".xml" destdir="{$temp}" >
+                <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
+            </tempfile>
+            
+            <property name="xpath_query" value="{$xpath_query}"/>
+            
+            <xsl:element name="target">
+                <xsl:attribute name="name" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
+                <ant antfile="{$build_check_java_process_count.xml}">
+                    <xsl:attribute name="output" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                    <property name="builds_to_ant_set_parallel_java_process_max">
+                        <xsl:attribute name="value" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                    </property>
+                    <property name="parallel_java_process_max" value="{$parallel_java_process_max}"/>
+                    <property name="process_locks" value="{$process_locks}"/>
+                </ant>
+                <loadfile>
+                    <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max_loadfile',$loop_path_recurs,$loop_xpath_real)"/>
+                    <xsl:attribute name="srcfile" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                </loadfile>
+                <!--<delete verbose="false">
+                    <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                </delete>-->
+            </xsl:element>
+            
+            
             <xsl:element name="target">
-                <xsl:attribute name="name" select="concat('builds_to_ant',$loop_xpath_real)"/>
+                <xsl:attribute name="name" select="concat('builds_to_ant',$loop_path_recurs,$loop_xpath_real)"/>
+                <xsl:attribute name="depends" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
                 <xsl:variable name="last_slash">
                     <xsl:call-template name="last_slash">
                         <xsl:with-param name="string" select="$temp"/>
@@ -67,63 +106,90 @@
                         <echo> $xpath_query_test NOT OK - bypassed by xpath_query filter </echo>
                     </xsl:when>
                     <xsl:when test="1=1"> <!-- $last_slash='temp' -->
-                        <xsl:message> FIRST LEVEL ANT is executed in PARALLEL </xsl:message>
-                        <echo>
+                        <xsl:if test="$debug &gt; 1"><xsl:message> FIRST LEVEL ANT is executed in PARALLEL </xsl:message></xsl:if>
+                        <xsl:if test="$debug &gt; 1"><echo>
+                            ######98 PARALLEL STARTING CURRENT LEAF BUILDING BY RelatedFeature #######
+                            # $temp = <xsl:value-of select="$temp"/> ;
+                            # builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
+                            # $xpath_query = <xsl:value-of select="$xpath_query"/>;
+                            # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
+                            # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
                             #
-                            #    
-                            builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
-                            $xpath_query=<xsl:value-of select="$xpath_query"/>;
-                            $xpath_query_test/xpath_query_test=<xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
-                            $featureID_name_dita<xsl:value-of select="$featureID_name_dita"/>;
-                            #
-                            #
-                        </echo>
-                        <parallel threadCount="4"  failonany="true"> <!-- threadCount="4"  -->
+                            ################################################################
+                        </echo></xsl:if>
+                        <!--<tempfile suffix=".xml" destdir="{$process_locks}" deleteonexit="yes" createfile="yes">
+                            <xsl:attribute name="property" select="concat('builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real)"/>
+                        </tempfile>-->
+                        <parallel  failonany="true">
+                            <xsl:attribute name="threadCount" select="concat('${builds_to_ant_set_parallel_java_process_max_loadfile',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                            <!-- threadCount="4"  -->
                             <xsl:for-each select="tokenize(.,';')">
+                                <!-- is also possible to run ordinary ant task! -->
+                                <!--<echo message="executing pos:{position()} antfile: {$temp}/{$loop_xpath}/{.}/build.xml "/>--> 
+                                <!--<ant antfile="{$temp}/{$loop_xpath}/{.}/build.xml" dir="." inheritall="false">
+                                    <property name="parallel_pos" value="{position()}"/>
+                                </ant>--> <!-- CHANGED from ${temp}/{.} -->
                                 <java>
                                     <xsl:attribute name="jar" select="$ant-launcher.jar"/>
                                     <!--<xsl:attribute name="classname" select="'org.apache.tools.ant.Main'"/>-->
                                     <!--<xsl:attribute name="dir" select="'${basedir}'"/>-->
                                     <xsl:attribute name="fork" select="'true'"/>
-                                    <xsl:attribute name="clonevm" select="'true'"/>
+                                    <xsl:attribute name="clonevm" select="'false'"/>
                                     <xsl:attribute name="failonerror" select="'true'"/>
                                     <!--<xsl:attribute name="append" select="'false'"/>-->
                                     <!--<xsl:attribute name="resultproperty" select="concat(.,'_resprop')"/>-->
                                     <!--<xsl:attribute name="output" select="concat($temp,'/',.,'_out.log')"/>-->
                                     <arg value="-buildfile"/>
-                                    <arg value="{$temp}/{.}"/>
+                                    <arg value="{$temp}/{$loop_xpath}/{.}/build.xml"/>
                                 </java>
                             </xsl:for-each>
                         </parallel>
-                        <echo>#
+                        <!--<delete>
+                            <xsl:attribute name="file" select="concat('${builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                        </delete>-->
+                        <xsl:if test="$debug &gt; 1"><echo>
+                            #######98B PARALLEL FINISHED CURRENT LEAF BUILDING BY RelatedFeature #######
+                            # $temp = <xsl:value-of select="$temp"/> ;
+                            # builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
+                            # $xpath_query = <xsl:value-of select="$xpath_query"/>;
+                            # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
+                            # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
                             #
-                            #
-                            #
-                            #94 i run all PARALLEL TASKS - should wait some time!
-                            #
-                            #
-                            #
-                            #</echo>
+                            ################################################################
+                         </echo></xsl:if>
                     </xsl:when>
                     <xsl:otherwise>
-                        <xsl:message> SECOND AND NEXT LEVEL ANT is executed in normal </xsl:message>
+                        <xsl:if test="$debug &gt; 1"><xsl:message> SECOND AND NEXT LEVEL ANT is executed in normal </xsl:message></xsl:if>
+                        <xsl:if test="$debug &gt; 1"><echo>
+                            ######98 NOT PARALLEL STARTING CURRENT LEAF BUILDING BY RelatedFeature #######
+                            # $temp = <xsl:value-of select="$temp"/> ;
+                            # builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
+                            # $xpath_query = <xsl:value-of select="$xpath_query"/>;
+                            # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
+                            # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
+                            #
+                            ################################################################
+                        </echo></xsl:if>
                         <xsl:for-each select="tokenize(.,';')">
-                            <echo>
-                                #
-                                #    
-                                #
-                                #
-                                builds_to_ant - za chwile uruchomie antfile (NOT PARALLEL) $last_slash=<xsl:value-of select="$last_slash"/>; $loop_xpath_real=<xsl:value-of select="$loop_xpath_real"/>; temp/<xsl:value-of select="."/>;
-                                $xpath_query=<xsl:value-of select="$xpath_query"/>;
-                                $featureID_name_dita<xsl:value-of select="$featureID_name_dita"/>;
-                                #
-                                #
-                            </echo>
-                            <ant antfile="{$temp}/{.}" dir="."/>
+                            <echo>#####155 Running antfile: <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'/build.xml')"/></echo>
+                            <ant antfile="{$temp}/{$loop_xpath}/{.}/build.xml" dir="."/><!-- bylo przed 2017-04-14 <ant antfile="{$temp}/{.}" dir="."/>-->
                         </xsl:for-each>
+                        <xsl:if test="$debug &gt; 1"><echo>
+                            #######98B NOT PARALLEL FINISHED CURRENT LEAF BUILDING BY RelatedFeature #######
+                            # $temp = <xsl:value-of select="$temp"/> ;
+                            # builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
+                            # $xpath_query = <xsl:value-of select="$xpath_query"/>;
+                            # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
+                            # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
+                            #
+                            ################################################################
+                        </echo></xsl:if>
                     </xsl:otherwise>
                 </xsl:choose>
             </xsl:element>
+            <delete verbose="false">
+                <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+            </delete>
         </project>
     </xsl:template>
     
@@ -137,9 +203,41 @@
             xmlns:ogc="http://www.opengis.net/ogc"
             xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
             basedir="../."
-            name="builds_to_ant_proj{$loop_xpath_real}"
-            default="builds_to_ant{$loop_xpath_real}">
-            <target name="builds_to_ant{$loop_xpath_real}">
+            name="builds_to_ant_proj{$loop_path_recurs}{$loop_xpath_real}"
+            default="builds_to_ant{$loop_path_recurs}{$loop_xpath_real}">
+            
+            
+            <property name="build_check_java_process_count.xml"  value="{$build_check_java_process_count.xml}"/>
+            <property name="parallel_java_process_max" value="{$parallel_java_process_max}"/>
+            
+            <tempfile prefix=".builds_to_ant_set_parallel_java_process_max" suffix=".xml" destdir="{$temp}" >
+                <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
+            </tempfile>
+            
+            <property name="xpath_query" value="{$xpath_query}"/>
+            
+            <xsl:element name="target">
+                <xsl:attribute name="name" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
+                <ant antfile="{$build_check_java_process_count.xml}">
+                    <xsl:attribute name="output" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                    <property name="builds_to_ant_set_parallel_java_process_max">
+                        <xsl:attribute name="value" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                    </property>
+                    <property name="parallel_java_process_max" value="{$parallel_java_process_max}"/>
+                    <property name="process_locks" value="{$process_locks}"/>
+                </ant>
+                <loadfile>
+                    <xsl:attribute name="property" select="concat('builds_to_ant_set_parallel_java_process_max_loadfile',$loop_path_recurs,$loop_xpath_real)"/>
+                    <xsl:attribute name="srcfile" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                </loadfile>
+                <!--<delete verbose="false">
+                    <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                </delete>-->
+            </xsl:element>
+            
+            
+            <target name="builds_to_ant{$loop_path_recurs}{$loop_xpath_real}">
+                <xsl:attribute name="depends" select="concat('builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real)"/>
                 <xsl:comment> default_antfile: <xsl:value-of select="$default_antfile"/> ; </xsl:comment>
                 <!-- robimy na paraler  -->
                 <xsl:choose>
@@ -147,25 +245,36 @@
                         <xsl:message> $xpath_query_test NOT OK - bypassed by xpath_query filter </xsl:message>
                         <echo> $xpath_query_test NOT OK - bypassed by xpath_query filter </echo>
                     </xsl:when>
-                    <xsl:when test="1=2"> <!--  error brak klasy Error: Could not find or load main class org.apache.tools.ant.Main -->
-                        <echo>
-                            #
-                            #    
-                            #
-                            #
-                            builds_to_ant - PARALLEL RUN  za chwile uruchomie antfile  LOOP exec <xsl:value-of select="concat($temp,'/',.)"/>/build_root.xml ;
-                            $xpath_query=<xsl:value-of select="$xpath_query"/>;
-                            $xpath_query_test/xpath_query_test=<xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
-                            $featureID_name_dita<xsl:value-of select="$featureID_name_dita"/>;
-                            #
-                            #
-                        </echo>
-                        <parallel threadCount="4" failonany="true">
+                    <xsl:when test="1=1"> <!--  error brak klasy Error: Could not find or load main class org.apache.tools.ant.Main -->
+                        <xsl:if test="$debug &gt; 1"><echo>
+                            ######234 PARALLEL STARTING CURRENT  BUILDING BY RelatedFeatureLoop #######
+                            # $temp = <xsl:value-of select="$temp"/> ;
+                            # builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
+                            # $xpath_query = <xsl:value-of select="$xpath_query"/>;
+                            # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
+                            # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
+                            # $feature_pos_parent= <xsl:value-of select="$feature_pos_parent"/>;  $feature_pos= <xsl:value-of select="$feature_pos"/>;
+                            ################################################################
+                        </echo></xsl:if>
+                        <!--<tempfile suffix=".xml" destdir="{$process_locks}" deleteonexit="yes" createfile="yes">
+                            <xsl:attribute name="property" select="concat('builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real)"/>
+                        </tempfile>-->
+                        <parallel failonany="false"> <!-- we tried to retry lowe -->
+                            <xsl:attribute name="threadCount" select="concat('${builds_to_ant_set_parallel_java_process_max_loadfile',$loop_path_recurs,$loop_xpath_real,'}')"/>
                             <xsl:for-each select="tokenize(.,';')">
+                                <!-- could be exec also in parallel task !!! -->
+                                <!--<exec executable="/opt/local/bin/ant" dir="{$temp}" failifexecutionfails="true">
+                                    <xsl:element name="arg">
+                                        <xsl:attribute name="line" select="concat('-f ',$temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>
+                                    </xsl:element>
+                                    <xsl:element name="arg">
+                                        <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
+                                    </xsl:element>
+                                </exec>-->
                                 <java>
                                     <xsl:attribute name="jar" select="$ant-launcher.jar"/>
                                     <!--<xsl:attribute name="classname" select="'org.apache.tools.ant.Main'"/>-->
-                                    <xsl:attribute name="dir" select="concat($temp,'/',.)"/>
+                                    <xsl:attribute name="dir" select="concat($temp,'/',$loop_xpath,'/',.)"/>
                                     <xsl:attribute name="fork" select="'true'"/>
                                     <xsl:attribute name="clonevm" select="'false'"/>
                                     <xsl:attribute name="newenvironment" select="'true'"/>
@@ -173,34 +282,117 @@
                                     <!--<xsl:attribute name="resultproperty" select="concat(.,'_resprop')"/>-->
                                     <!--<xsl:attribute name="output" select="concat(.,'_out.log')"/>-->
                                     <arg value="-buildfile"/>
-                                    <arg value="{$temp}/{.}/build_root.xml"/>
+                                    <arg value="{$temp}/{$loop_xpath}/{.}/build_root.xml"/>
+                                    <xsl:element name="arg">
+                                        <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
+                                    </xsl:element>
                                 </java>
                             </xsl:for-each>
                         </parallel>
+                        
+                        
+                        
+                        
+                        
+                        <!--<delete>
+                            <xsl:attribute name="file" select="concat('${builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real,'}')"/>
+                        </delete>-->
+                        <xsl:if test="$debug &gt; 1"><echo>
+                            #######257 NOT PARALLEL FINISHED CURRENT LEAF BUILDING BY RelatedFeatureLoop #######
+                            # $temp = <xsl:value-of select="$temp"/> ;
+                            # builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
+                            # $xpath_query = <xsl:value-of select="$xpath_query"/>;
+                            # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
+                            # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
+                            #
+                            ################################################################
+                        </echo></xsl:if>
                     </xsl:when>
                     <xsl:otherwise>
+                        <xsl:if test="$debug &gt; 1"><echo>
+                            ######270 DISABLED PARALLEL STARTING CURRENT  BUILDING BY RelatedFeatureLoop #######
+                            # $temp = <xsl:value-of select="$temp"/> ;
+                            # builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
+                            # $xpath_query = <xsl:value-of select="$xpath_query"/>;
+                            # $xpath_query_test/xpath_query_test = <xsl:value-of select="$xpath_query_test/xpath_query_test"/>;
+                            # $featureID_name_dita = <xsl:value-of select="$featureID_name_dita"/>;
+                            #
+                            ################################################################
+                        </echo></xsl:if>
                         <xsl:for-each select="tokenize(.,';')">
-                            <echo>
-                                #
-                                #    
-                                #
-                                #
-                                builds_to_ant - za chwile uruchomie antfile  LOOP exec temp/<xsl:value-of select="."/>;
-                                $xpath_query=<xsl:value-of select="$xpath_query"/>;
-                                $featureID_name_dita<xsl:value-of select="$featureID_name_dita"/>;
-                                #
-                                #
-                            </echo>
+                            
+                            <xsl:if test="$debug &gt; 1"><echo>#####281 Running exec antfile: <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>
+                                  #####    $feature_pos_parent= <xsl:value-of select="$feature_pos_parent"/>;  $feature_pos= <xsl:value-of select="$feature_pos"/>;
+                                  #####
+                            </echo></xsl:if>
+                            <!-- TODO DEBUG OFF LOOP -->
                             <exec executable="/opt/local/bin/ant" dir="{$temp}" failifexecutionfails="true">
                                 <xsl:element name="arg">
-                                    <xsl:attribute name="line" select="concat('-f ',$temp,'/',.,'/build_root.xml')"/>
+                                    <xsl:attribute name="line" select="concat('-f ',$temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>
+                                </xsl:element>
+                                <xsl:element name="arg">
+                                    <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
                                 </xsl:element>
                             </exec>
                             <!--<ant antfile="{.}/build_root.xml" dir="{$temp}" inheritall="false" usenativebasedir="true" />-->
                         </xsl:for-each>
                     </xsl:otherwise>
                 </xsl:choose>
+                
+                <echo>#285  VERYFING CORRECT CHILD EXEC IF FAILED RETRY IT </echo>
+                <xsl:for-each select="tokenize(.,';')">
+                    <echo>#285 VERYFING <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>  (.test_if_exec_child_ant.xml + {$uuid}_out_task_dita_final.dita.xml )  </echo>
+                    <loadfile property="Verify_numbers_file_{position()}" srcFile="{$temp}/{$loop_xpath}/{.}/.test_if_exec_child_ant.xml"/>
+                    <condition property="Verify_{position()}" taskname="Retry_{position()}">
+                        <or>
+                            <available file="{$temp}/{$loop_xpath}/{.}/{$uuid}_out_task_dita_final.dita.xml"/> <!-- todo zrobic sprawdzenie czy bylo warto sciagac podwezel -->
+                            <xsl:element name="contains">
+                                <xsl:attribute name="string" select="concat('${Verify_numbers_file_',position(),'}')"/>
+                                <xsl:attribute name="substring" select="'numberMatched=&quot;0&quot;'"/>
+                            </xsl:element>
+                        </or>
+                    </condition>
+                </xsl:for-each>
+                <xsl:for-each select="tokenize(.,';')">
+                    <antcall target="Retry_{position()}"/>
+                    <antcall target="Confirm_{position()}"/>
+                </xsl:for-each>
             </target>
+            
+            <!-- retries tasks-->
+            <xsl:for-each select="tokenize(.,';')">
+                <target name="Retry_{position()}">
+                    <xsl:attribute name="unless" select="concat('${Verify_',position(),'}')"/>
+                    <echo>
+                        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx #350  FIXING BAD RELATEDLOOP EXECUTION for <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'build_root.xml')"/>
+                    </echo>
+                    <delete includeEmptyDirs="true">
+                        <fileset dir="{$temp}/{$loop_xpath}/{.}">
+                            <include name="*"/>
+                            <exclude name="build_root.xml"/>
+                        </fileset>
+                    </delete>
+                    <exec executable="/opt/local/bin/ant" dir="{$temp}" failifexecutionfails="true">
+                                    <xsl:element name="arg">
+                                        <xsl:attribute name="line" select="concat('-f ',$temp,'/',$loop_xpath,'/',.,'/build_root.xml')"/>
+                                    </xsl:element>
+                                    <xsl:element name="arg">
+                                        <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
+                                    </xsl:element>
+                     </exec>
+                </target>
+            </xsl:for-each>
+            <!-- confirm ok tasks -->
+            <xsl:for-each select="tokenize(.,';')">
+                <target name="Confirm_{position()}">
+                    <xsl:attribute name="if" select="concat('${Verify_',position(),'}')"/>
+                    <echo> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx #350 #380  CONFIRMED RELATEDLOOP EXECUTION for <xsl:value-of select="concat($temp,'/',$loop_xpath,'/',.,'build_root.xml')"/></echo>
+                </target>
+            </xsl:for-each>
+            
+            <delete>
+                <xsl:attribute name="file" select="concat('${builds_to_ant_set_parallel_java_process_max',$loop_path_recurs,$loop_xpath_real,'}')"/>
+            </delete>
         </project>
     </xsl:template>
     

+ 31 - 0
SE/schema/default_db_xml_cache.public/default_db/CRM_PROCES/CRM_PRZYPADEK.xsl

@@ -0,0 +1,31 @@
+<?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"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:template mode="task_resources_info" match="CRM_PRZYPADEK">
+        <xsl:choose>
+            <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='STANOWISKO' and contains(FORM_TREAT,'X')">
+                <p>Stanowisko odpowiedzialne</p>
+            </xsl:when>
+            <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='STANOWISKO' and contains(FORM_TREAT,'R')">
+                <p>Stanowisko posiada uprawnienie do kontrolowania procedury</p>
+            </xsl:when>
+            <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='KOMORKA' and contains(FORM_TREAT,'R') and contains(FORM_TREAT,'W') and contains(FORM_TREAT,'C')">
+                <p>Wprowadź informację do formularza (nowego rekordu lub zedytuj istniejący)</p>
+            </xsl:when>
+            <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='KOMORKA' and contains(FORM_TREAT,'R') and contains(FORM_TREAT,'W') ">
+                <p>Wprowadź informację do formularza: </p>
+            </xsl:when>
+            <xsl:when test="../CRM_LISTA_ZASOBOW/TYPE='KOMORKA' and contains(FORM_TREAT,'C') and contains(FORM_TREAT,'R') ">
+                <p>Wprowadź informację do formularza: (do nowego rekordu) </p>
+            </xsl:when>
+            <xsl:otherwise>
+                <p>Wprowadz inforamcję: (<xsl:value-of select="FORM_TREAT"/>)</p>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+</xsl:stylesheet>

+ 467 - 0
SE/schema/default_db_xml_cache.public/default_db/CRM_PROCES/PROCES_INIT_tree_to_dita.xsl

@@ -0,0 +1,467 @@
+<?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:import href="../../escaped_html_to_xml.xsl"/>
+    <xsl:import href="../../dita_enter_to_ph.xsl"/>-->
+    <!--<xsl:import href="../../system_cache__appinfo/postprocess.xsl"/>-->
+    <xsl:include href="CRM_PRZYPADEK.xsl"/>
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:param name="PROCES_INIT_tree.ditamap" select="'PROCES_INIT_tree.ditamap'"/> <!-- file behind will be created dita files -->
+   <!-- <xsl:param name="temp" required="yes"/>
+    <xsl:param name="uuid" required="yes"/>-->
+    
+    <xsl:param name="only_benefit_info" select="0"/>
+    <!-- do stworzenia ditamap na podstawie danych w CRM_PROCES -->
+    
+    
+    <!--<xsl:import href="../default_db_xml_cache.public/escaped_html_to_xml.xsl"/>-->
+    <!--<xsl:import href="../../dita_enter_to_ph.xsl"/>-->
+    
+    
+    
+    
+    
+    <xsl:template mode="postprocess_root_PROCES_INIT" match="RelatedFeatureRoot">
+        <xsl:comment>postprocess_root_PROCES_INIT</xsl:comment>
+            <xsl:apply-templates mode="postprocess_images"/>
+            <xsl:for-each-group select="//(CRM_IMAGE_CRM_PROCES|CRM_IMAGE_CRM_LISTA_ZASOBOW|CRM_IMAGE_CRM_WSKAZNIK)" group-by="ID">
+                <xsl:apply-templates mode="postprocess_images_unique" select="."/>
+            </xsl:for-each-group>
+    </xsl:template>
+    
+        
+    
+    
+    <xsl:template match="CRM_IMAGE_CRM_PROCES" mode="postprocess_images">
+        <xsl:variable name="ext" select="substring-after(TYPE,'/')"/>
+        <base64_to_image srcfile="{$temp}/{$uuid}/{ID}_image.base64.{$ext}" dstfile="{$temp}/{$uuid}/{ID}_image.{$ext}" />
+    </xsl:template>
+    
+    <xsl:template match="*" mode="postprocess_images">
+        <xsl:apply-templates mode="postprocess_images"/>
+    </xsl:template>
+    
+    <xsl:template mode="postprocess_images" match="text()|comment()"/>
+    
+    <!--<xsl:template match="RelatedFeatureRoot" mode="task">
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>-->
+    <!--<xsl:template match="RelatedFeatureRoot">
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>-->
+    
+    <xsl:template match="PROCES_TREE">
+        <map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:map.xsd">
+            <title>
+                <xsl:value-of select="DESC"/>
+            </title>
+            <xsl:apply-templates mode="ditamap"/>
+        </map>
+        <!--<xsl:result-document href="{$temp}/{$uuid}/build_image.xml" omit-xml-declaration="yes">
+            
+        </xsl:result-document>-->
+        <!--<build_image>
+            <xsl:variable>
+                
+            </xsl:variable>
+        </build_image>-->
+    </xsl:template>
+    
+    
+        
+        
+    
+    
+    
+    <xsl:template match="PROCES_GROUP_2|PROCES_GROUP_1" mode="ditamap">
+        <topichead>
+            <topicmeta>
+                <navtitle> {<xsl:value-of select="ID"/>}
+                    <!--<xsl:apply-templates select="DESC" mode="system_cache__appinfo:extract_text"/>-->
+                    <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                            <xsl:with-param name="html" select="DESC"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                </navtitle>
+                <shortdesc>
+                    <!--<xsl:apply-templates select="OPIS" mode="system_cache__appinfo:extract_text"/>-->
+                    <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                            <xsl:with-param name="html" select="OPIS"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                </shortdesc>
+            </topicmeta>
+            <!--<taskbody>
+                <example>
+                    <xsl:apply-templates mode="example"/>
+                </example>
+            </taskbody>-->
+            <xsl:apply-templates mode="ditamap"/>
+        </topichead>
+    </xsl:template>
+    
+    <xsl:template match="CRM_IMAGE_CRM_PROCES|CRM_IMAGE_CRM_PROCES|CRM_IMAGE_CRM_LISTA_ZASOBOW|CRM_IMAGE_CRM_WSKAZNIK" mode="example">
+        <xsl:variable name="ext" select="substring-after(TYPE,'/')"/>
+        <xsl:choose>
+            <xsl:when test="number(WIDTH) &gt; 600">
+                <image href="{ID}_image.{$ext}" width="600"></image>
+            </xsl:when>
+            <xsl:otherwise>
+                <image href="{ID}_image.{$ext}" width="{WIDTH}"></image>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:template>
+    
+    <xsl:template match="*|text()|comment()" mode="example"/>
+        
+    
+    
+    <xsl:template match="PROCES_INIT" mode="ditamap">
+        <topicref href="{ID}_topic.dita">
+            <xsl:result-document href="{$temp}/{$uuid}/{ID}_topic.dita">
+                <xsl:apply-templates select="."/>
+            </xsl:result-document>
+        </topicref>
+    </xsl:template>
+    
+   
+    <xsl:template match="PROCES_INIT">
+        <task id="task_{ID}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:task.xsd">
+            <title>{<b><xsl:value-of select="ID"/></b>}
+                <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                    <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:with-param name="html" select="DESC"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                <!--<xsl:value-of select="DESC"/>-->
+            </title>
+            <shortdesc><!--<xsl:value-of select="OPIS"/>-->
+                <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                    <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:with-param name="html" select="OPIS"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+            </shortdesc>
+            <prolog>
+                <author><xsl:value-of select="A_RECORD_CREATE_AUTHOR"/> w <xsl:value-of select="A_RECORD_CREATE_DATE"/></author>
+                <!--<change-historylist>
+                    <change-item>
+                        <change-completed>
+                            <xsl:value-of select="A_RECORD_UPDATE_DATE"/> <xsl:value-of select="A_RECORD_UPDATE_AUTHOR"/>
+                        </change-completed>
+                    </change-item>
+                </change-historylist>-->
+            </prolog>
+            <taskbody>
+                <!--<context>
+                    <p></p>
+                </context>-->
+                <xsl:choose>
+                    <xsl:when test="CRM_WSKAZNIK">
+                        <postreq>zasoby:
+                            <ol>
+                                <li/>
+                                <xsl:apply-templates mode="task_resources_info"/>
+                            </ol>
+                        </postreq>
+                    </xsl:when>
+                </xsl:choose>
+                <!--<steps>
+                    <step>
+                        <cmd>zasoby:</cmd>
+                        <xsl:apply-templates mode="task_resources_info"/>
+                    </step>
+                    <xsl:apply-templates mode="task_body"/>
+                </steps>-->
+            </taskbody>
+            <xsl:apply-templates mode="task"/>
+        </task>
+    </xsl:template>
+    
+    
+    <!-- to ignore -->
+    <xsl:template match="*" mode="task"/>
+    <xsl:template match="*" />
+    
+    <xsl:template match="CRM_IMAGE_CRM_PROCES|CRM_IMAGE_CRM_LISTA_ZASOBOW|CRM_IMAGE_CRM_WSKAZNIK" mode="postprocess_images_unique">
+        <xsl:variable name="ext" select="substring-after(TYPE,'/')"/>
+             <xsl:result-document href="{$temp}/{$uuid}/{ID}_image.base64.{$ext}" omit-xml-declaration="yes">
+                <xsl:value-of select="IMAGE/text()"/>
+            </xsl:result-document>
+    </xsl:template>
+    
+    
+    <!--<xsl:template mode="task_body" match="PROCES">
+        <step>
+            <cmd>{<b><xsl:value-of select="ID"/></b>} <b><xsl:value-of select="DESC"/></b> <ph><xsl:value-of select="OPIS"/></ph></cmd>
+            <!-\-<xsl:if test="GOTO"> TODO maintain goto another process
+                <substeps>
+                    <xsl:apply-templates mode="substep"/>
+                </substeps>
+            </xsl:if>-\->
+        </step>
+    </xsl:template>-->
+    <xsl:template mode="task" match="PROCES">
+        <xsl:choose>
+            <xsl:when test="$only_benefit_info">
+                <xsl:apply-templates mode="task"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <task id="task_{ID}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:task.xsd">
+                    <title>{<b><xsl:value-of select="ID"/></b>}
+                        <!--<xsl:value-of select="DESC"/>-->
+                        <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                            <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                                <xsl:with-param name="html" select="DESC"/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                    </title>
+                    <shortdesc><!--<xsl:value-of select="OPIS"/>-->
+                        <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                            <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                                <xsl:with-param name="html" select="OPIS"/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                    </shortdesc>
+                    <prolog>
+                        <author><xsl:value-of select="A_RECORD_CREATE_AUTHOR"/></author>
+                        <!--<change-historylist>
+                            <change-item>
+                                <change-completed>
+                                    <xsl:value-of select="A_RECORD_UPDATE_DATE"/> <xsl:value-of select="A_RECORD_UPDATE_AUTHOR"/>
+                                </change-completed>
+                            </change-item>
+                        </change-historylist>-->
+                    </prolog>
+                    <taskbody>
+                            <example>
+                                <xsl:apply-templates mode="example"/>
+                            </example>
+                        <xsl:choose>
+                            <xsl:when test="CRM_WSKAZNIK">
+                                <postreq>zasoby:
+                                    <ol>
+                                        <li/>
+                                        <xsl:apply-templates mode="task_resources_info"/>
+                                    </ol>
+                                </postreq>
+                            </xsl:when>
+                        </xsl:choose>
+                        <!--<context>
+                    <p></p>
+                </context>-->
+                        <!--<steps>
+                    <step>
+                        <cmd>zasoby:</cmd>
+                        <xsl:apply-templates mode="task_resources_info"/>
+                    </step>
+                    <xsl:apply-templates mode="task_body"/>
+                </steps>-->
+                    </taskbody>
+                    <xsl:apply-templates mode="task"/>
+                </task>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template mode="task" match="PROCES_BENEFIT_INFO">
+        <xsl:choose>
+            <xsl:when test="$only_benefit_info">
+                <xsl:choose>
+                    <xsl:when test="OPIS/text()">
+                        <task id="task_{ID}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:task.xsd">
+                            <title>{<b><xsl:value-of select="ID"/></b>} <ph> KORZYŚCI: </ph>
+                                <!--<xsl:value-of select="DESC"/>-->
+                                <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                                    <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                                        <xsl:with-param name="html" select="DESC"/>
+                                    </xsl:call-template>
+                                </xsl:variable>
+                                <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                            </title>
+                            <!--<shortdesc><!-\-<xsl:value-of select="OPIS"/>-\-> 
+                                <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                                    <xsl:with-param name="html" select="OPIS"/>
+                                </xsl:call-template>
+                            </shortdesc>-->
+                            <prolog>
+                                <author><xsl:value-of select="A_RECORD_CREATE_AUTHOR"/></author>
+                                <!--<change-historylist>
+                                    <change-item>
+                                        <change-completed>
+                                            <xsl:value-of select="A_RECORD_UPDATE_DATE"/> <xsl:value-of select="A_RECORD_UPDATE_AUTHOR"/>
+                                        </change-completed>
+                                    </change-item>
+                                </change-historylist>-->
+                            </prolog>
+                            <taskbody>
+                                <example>
+                                    <example>
+                                        <xsl:apply-templates mode="example"/>
+                                    </example>
+                                    <note>
+                                        <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                                            <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                                                <xsl:with-param name="html" select="OPIS"/>
+                                            </xsl:call-template>
+                                        </xsl:variable>
+                                        <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                                    </note>
+                                </example>
+                                <xsl:choose>
+                                    <xsl:when test="CRM_WSKAZNIK">
+                                        <postreq>zasoby:
+                                            <ol>
+                                                <li/>
+                                                <xsl:apply-templates mode="task_resources_info"/>
+                                            </ol>
+                                        </postreq>
+                                    </xsl:when>
+                                </xsl:choose>
+                                <!--<context>
+                    <p></p>
+                </context>-->
+                                <!--<steps>
+                    <step>
+                        <cmd>zasoby:</cmd>
+                        <xsl:apply-templates mode="task_resources_info"/>
+                    </step>
+                    <xsl:apply-templates mode="task_body"/>
+                </steps>-->
+                            </taskbody>
+                            <xsl:apply-templates mode="task"/>
+                        </task>
+                    </xsl:when>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise/>
+        </xsl:choose>
+    </xsl:template>
+    
+    <!--<xsl:template mode="task" match="PROCES">
+        <substep>
+            <xsl:choose>
+                <xsl:when test="PROCES">
+                    <cmd/>
+                    <info>
+                        <ol>
+                            <li>{<xsl:value-of select="ID"/>}<b><xsl:value-of select="DESC"/></b><ph><xsl:value-of select="OPIS"/></ph></li>
+                            <xsl:apply-templates mode="ol"/>
+                        </ol>
+                    </info>
+                </xsl:when>
+                <xsl:otherwise>
+                    <cmd><b><xsl:value-of select="DESC"/></b><ph><xsl:value-of select="OPIS"/></ph></cmd>
+                </xsl:otherwise>
+            </xsl:choose>
+        </substep>
+    </xsl:template>-->
+    
+    <!--<xsl:template mode="substep" match="PROCES">
+        <substep>
+            <xsl:choose>
+                <xsl:when test="PROCES">
+                    <cmd/>
+                    <info>
+                        <ol>
+                            <li>{<xsl:value-of select="ID"/>}<b><xsl:value-of select="DESC"/></b><ph><xsl:value-of select="OPIS"/></ph></li>
+                            <xsl:apply-templates mode="ol"/>
+                        </ol>
+                    </info>
+                </xsl:when>
+                <xsl:otherwise>
+                    <cmd><b><xsl:value-of select="DESC"/></b><ph><xsl:value-of select="OPIS"/></ph></cmd>
+                </xsl:otherwise>
+            </xsl:choose>
+        </substep>
+    </xsl:template>-->
+    
+    
+    <!--<xsl:template mode="ol" match="PROCES">
+        <ol>
+            <li>{<xsl:value-of select="ID"/>}<b><xsl:value-of select="DESC"/></b><ph><xsl:value-of select="OPIS"/></ph></li>
+            <xsl:apply-templates mode="ol"/>
+        </ol>
+    </xsl:template>-->
+
+
+    <xsl:template mode="task_resources_info" match="CRM_WSKAZNIK[not(A_STATUS='DELETED')]">
+        <li>
+            <xsl:apply-templates mode="task_resources_info">
+                 <xsl:sort select="SORT_PRIO"/>
+            </xsl:apply-templates>
+            <xsl:if test="OPIS_ZASOB/text()">
+             <p>
+                <note> 
+                    <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:with-param name="html" select="OPIS_ZASOB"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                </note>
+            </p></xsl:if>
+        </li>
+    </xsl:template>
+    
+    
+    
+    <xsl:template mode="task_resources_info" match="CRM_LISTA_ZASOBOW">
+        <xsl:comment>#432 match="CRM_LISTA_ZASOBOW" mode="task_resources_info" </xsl:comment>
+                <xsl:choose>
+                    <xsl:when test="TYPE='KOMORKA'">
+                        <p>
+                            <codeblock>[<xsl:value-of select="ID"/>]<b><xsl:apply-templates mode="dita_content_clean" select="system_cache__appinfo:escaped_html_to_xml(DESC[1])"/></b>; 
+                                <xsl:if test=" string-length(OPIS[1]) &gt;0">
+                                    <xsl:call-template name="escaped_html_to_xml_and_surrounded_enter">
+                                        <xsl:with-param name="enter_surround_to" select="'ph'"/>
+                                        <xsl:with-param name="html" select="OPIS[1]"/>
+                                    </xsl:call-template>
+                                </xsl:if>
+                                <xsl:if test="not(DESC/text()=DESC_PL/text())"><ph> <xsl:value-of select="DESC_PL"/></ph></xsl:if>
+                            </codeblock>
+                        </p>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <p>[<xsl:value-of select="ID"/>]<b><xsl:apply-templates mode="dita_content_clean" select="system_cache__appinfo:escaped_html_to_xml(DESC[1])"/></b>; 
+                            <xsl:if test=" string-length(OPIS[1]) &gt;0">
+                                <xsl:call-template name="escaped_html_to_xml_and_surrounded_enter">
+                                    <xsl:with-param name="enter_surround_to" select="'ph'"/>
+                                    <xsl:with-param name="html" select="OPIS[1]"/>
+                                </xsl:call-template>
+                            </xsl:if>
+                            <xsl:if test="not(DESC/text()=DESC_PL/text())"><ph> <xsl:value-of select="DESC_PL"/></ph></xsl:if>
+                        </p>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <!--<xsl:apply-templates mode="ol"/>-->
+    </xsl:template>
+
+    <xsl:template mode="task_resources_info" match="*|text()|comment()"/>
+
+    <xsl:template mode="task" match="text()|comment()"/>
+    
+    
+</xsl:stylesheet>

+ 334 - 0
SE/schema/default_db_xml_cache.public/default_db/IN7_MK_BAZA_DYSTRYBUCJI/IN7_MK_BAZA_DYSTRYBUCJI_tree_to_dita.xsl

@@ -0,0 +1,334 @@
+<?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"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:gml="http://www.opengis.net/gml"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+   <!-- <xsl:import href="../../escaped_html_to_xml.xsl"/>
+    <xsl:import href="../../dita_enter_to_ph.xsl"/>-->
+    <!--<xsl:import href="../../system_cache__appinfo/postprocess.xsl"/>-->
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    
+    
+    <xsl:template mode="postprocess_root_IN7_MK_BAZA_DYSTRYBUCJI" match="RelatedFeatureRoot">
+        <xsl:comment>postprocess_root_IN7_MK_BAZA_DYSTRYBUCJI</xsl:comment>
+            <xsl:for-each-group select="//(INWESTYCJA_BUDOWA_SIECI|IN7_MK_BAZA_DYSTRYBUCJI)" group-by="ID">
+                <xsl:comment>#24 mam <xsl:value-of select="ID"/></xsl:comment>
+                <xsl:apply-templates mode="postprocess_gml_geometry_image_unique" select="."/>
+                <xsl:apply-templates mode="postprocess_gml_geometry_image" select="."/>
+            </xsl:for-each-group>
+            <xsl:for-each-group select="//(Rozdzielcza_rurociag_wsg84)" group-by="ID">
+                <xsl:comment>#28 mam <xsl:value-of select="ID"/></xsl:comment>
+                <xsl:apply-templates mode="postprocess_gml_geometry_image_unique" select="."/>
+                <xsl:apply-templates mode="postprocess_gml_geometry_image" select="."/>
+            </xsl:for-each-group>
+    </xsl:template>
+    
+    
+    <xsl:template match="INWESTYCJA_BUDOWA_SIECI|IN7_MK_BAZA_DYSTRYBUCJI" mode="postprocess_gml_geometry_image">
+        <xsl:variable name="ext" select="substring-after(TYPE,'/')"/>
+        <gml_to_image srcfile="{$temp}/{$uuid}/{ID}_{local-name()}.gml" dstfile="{$temp}/{$uuid}/{ID}_{local-name()}.png" />
+    </xsl:template>
+    
+    <xsl:template match="Rozdzielcza_rurociag_wsg84" mode="postprocess_gml_geometry_image">
+        <xsl:variable name="ext" select="substring-after(TYPE,'/')"/>
+        <gml_to_image srcfile="{$temp}/{$uuid}/{ID}_{local-name()}.gml" dstfile="{$temp}/{$uuid}/{ID}_{local-name()}.png" />
+    </xsl:template>
+    
+    <xsl:template match="*" mode="postprocess_gml_geometry_image">
+        <!--<xsl:apply-templates mode="postprocess_gml_geometry_image"/>-->
+    </xsl:template>
+    
+    <xsl:template match="INWESTYCJA_BUDOWA_SIECI|IN7_MK_BAZA_DYSTRYBUCJI" mode="ditamap_root">
+        <map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:map.xsd">
+            <title>
+                <xsl:value-of select="M_DIST_DESC"/>
+            </title>
+            <xsl:apply-templates mode="ditamap" select="."/>
+        </map>
+        
+    </xsl:template>
+    
+        
+        
+    
+    
+    
+    <!--<xsl:template match="INWESTYCJA_BUDOWA_SIECI|IN7_MK_BAZA_DYSTRYBUCJI" mode="ditamap">
+        <topichead>
+            <topicmeta>
+                <navtitle> {<xsl:value-of select="ID"/>}
+                    <!-\-<xsl:apply-templates select="DESC" mode="system_cache__appinfo:extract_text"/>-\->
+                    <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                            <xsl:with-param name="html" select="M_DIST_DESC"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                </navtitle>
+                <shortdesc>
+                    <!-\-<xsl:apply-templates select="OPIS" mode="system_cache__appinfo:extract_text"/>-\->
+                    <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                            <xsl:with-param name="html" select="M_DIST_DESC"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                </shortdesc>
+            </topicmeta>
+            <!-\-<taskbody>
+                <example>
+                    <xsl:apply-templates mode="example"/>
+                </example>
+            </taskbody>-\->
+            <xsl:apply-templates mode="ditamap"/>
+        </topichead>
+    </xsl:template>-->
+    
+    
+    
+    <xsl:template match="IN7_MK_BAZA_DYSTRYBUCJI">
+        <topic id="topic_IN7_MK_BAZA_DYSTRYBUCJI_{ID}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title><ph>Sprawa nr </ph> <xsl:value-of select="P_ID"/> <ph>-</ph> 
+                <xsl:value-of select="ID"/>
+                związana z <xsl:value-of select="M_DISTRIBUTOR"/>
+            </title>
+            <prolog>
+                <author><xsl:value-of select="A_RECORD_CREATE_AUTHOR"/> w <xsl:value-of select="A_RECORD_CREATE_DATE"/></author>
+            </prolog>
+            <body><!--<xsl:value-of select="OPIS"/>-->
+                <!--<xsl:variable name="system_cache__appinfo:escaped_html_to_xml">-->
+                  <p> <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:with-param name="html" select="M_DIST_DESC"/>
+                    </xsl:call-template>
+                  </p> 
+                <!--</xsl:variable>-->
+                <!--<xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>-->
+                <xsl:apply-templates mode="gml_geometry_image" select="."/>
+                <xsl:apply-templates mode="gml_geometry_image" />
+                <xsl:apply-templates mode="infrastructure_raport"  select="."/>
+            </body>
+        </topic>
+    </xsl:template>
+    
+    <xsl:template match="IN7_DZIENNIK_KORESP">
+        <topic id="topic_IN7_DZIENNIK_KORESP_{ID}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title><ph>Pismo nr </ph> <xsl:value-of select="ID_PROJECT"/> <ph>-</ph> 
+                <xsl:value-of select="ID"/>
+                <ph>z dnia </ph> <xsl:value-of select="K_DATA_OTRZYMANEJ_KORESP"/>
+            </title>
+            <prolog>
+                <author><xsl:value-of select="A_RECORD_CREATE_AUTHOR"/> w <xsl:value-of select="A_RECORD_CREATE_DATE"/></author>
+                <!--<change-historylist>
+                    <change-item>
+                        <change-completed>
+                            <xsl:value-of select="A_RECORD_UPDATE_DATE"/> <xsl:value-of select="A_RECORD_UPDATE_AUTHOR"/>
+                        </change-completed>
+                    </change-item>
+                </change-historylist>-->
+            </prolog>
+            <body>
+                <simpletable id="simpletable_uym_ps1_zy">
+                    <strow>
+                        <stentry>
+                            
+                            <p>Nadawca:</p><ph/>
+                            <p /><ph/>
+                            <p /><ph/>
+                            <p><ph/> <xsl:value-of select="BILLING_OWNER/kod"/>  <xsl:value-of select="BILLING_OWNER/miasto"/><ph> ul.</ph> <xsl:value-of select="BILLING_OWNER/ulica"/><ph> </ph> <xsl:value-of select="BILLING_OWNER/numer_dom"/></p>
+                            <p><ph>nip:</ph> <xsl:value-of select="BILLING_OWNER/nip"/><ph> regon:</ph> <xsl:value-of select="BILLING_OWNER/regon"/></p>
+                            <p><ph>email:</ph> <xsl:value-of select="BILLING_OWNER/BILLING_OWNER_EMAIL"/> <ph> tel:</ph> <xsl:value-of select="BILLING_OWNER/tel"/> </p>
+                            <p><ph>nr r-ku:</ph> <xsl:value-of select="BILLING_OWNER/nr_rach"/></p>
+                        </stentry>
+                        <stentry>
+                            <p>Odbiorca:</p><ph/>
+                            <p>
+                                <xsl:value-of select="K_OD_KOGO"/>
+                            </p><ph/>
+                            <p ><xsl:value-of select="OD_KOGO_ADRES"/></p><ph/>
+                            <p ><xsl:value-of select="K_NR_OTRZYM_KORESP"/></p><ph/>
+                        </stentry>
+                    </strow>
+                </simpletable>
+                <p><b>Temat: <ph/><ph ><xsl:value-of select="K_ZAWARTOS"/></ph></b></p>
+                <!--<p>Tresc: </p>
+                <bodydiv xpath="K_ZAWARTOSC_HTML"/>
+                <p> Miejsca na podpisy<simpletable frame="all" relcolwidth="1.0* 1.0*"
+                    id="simpletable_ejm_j2r_cz">
+                    <strow>
+                        <stentry/> 
+                        <stentry>Podpis(*)</stentry>
+                    </strow>
+                    <strow>
+                        <stentry/>
+                        <stentry>
+                            <codeblock>            
+                            </codeblock>
+                        </stentry>
+                    </strow>
+                </simpletable></p>-->
+                <!--<RelatedFeature xpath="ADM_ACCOUNT" xpath_value="../L_APPOITMENT_USER" typeName="p5_default_db:ADMIN_USERS"><!-\- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -\->
+                    <p><simpletable frame="all" relcolwidth="1.0* 1.0*" id="simpletable_b2r_ldr_cz_adma">
+                        <strow>
+                            <stentry>Referent odpowiedzialny za dokument</stentry>
+                            <stentry xpath="ADM_NAME"/>
+                        </strow>
+                        <strow>
+                            <stentry>Kontakty</stentry>
+                            <stentry><ph xpath="EMAIL_LOCAL_ACCOUNT_ADDRESS" xpath_token_filter=" " xpath_token="1"/><ph> </ph><ph xpath="ADM_PHONE"/></stentry>
+                        </strow>
+                    </simpletable>
+                    </p>
+                </RelatedFeature>-->
+                <!--<RelatedFeature xpath="ID" xpath_value="../ID_PROJECT" typeName="p5_default_db:IN7_MK_BAZA_DYSTRYBUCJI">
+                    <RelatedFeature xpath="ADM_ACCOUNT" xpath_value="../L_APPOITMENT_USER" typeName="p5_default_db:ADMIN_USERS"><!-\- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -\->
+                        <p><simpletable frame="all" relcolwidth="1.0* 1.0*" id="simpletable_b2r_ldr_cz_ref_spr">
+                            <strow>
+                                <stentry>Referent odpowiedzialny za sprawę</stentry>
+                                <stentry xpath="ADM_NAME"/>
+                            </strow>
+                            <strow>
+                                <stentry>Kontakty</stentry>
+                                <stentry><ph xpath="EMAIL_LOCAL_ACCOUNT_ADDRESS" xpath_token_filter=" " xpath_token="1"/><ph> </ph><ph xpath="ADM_PHONE"/></stentry>
+                            </strow>
+                        </simpletable>
+                        </p>
+                    </RelatedFeature>
+                </RelatedFeature>-->
+                <!--<p><b>Powiazane elementy (inne dokumenty w sprawie)</b></p>
+                <p>
+                    <table>
+                        <tgroup cols="3">
+                            <thead>
+                                <row>
+                                    <entry>ID</entry>
+                                    <entry>Data</entry>
+                                    <entry>Temat</entry>
+                                </row>
+                            </thead>
+                            <tbody>
+                                <row>
+                                    <entry/>
+                                    <entry/>
+                                    <entry/>
+                                </row>
+                                <RelatedFeature xpath="ID_PROJECT" xpath_value="../ID_PROJECT" typeName="p5_default_db:IN7_DZIENNIK_KORESP" xpath_query="[position()&lt;3]">  <!-\- test sciagniecia powiazanych pism do sprawy -\->
+                                    <row>
+                                        <entry xpath="ID" />
+                                        <entry xpath="K_DATA_OTRZYMANEJ_KORESP"/>
+                                        <entry xpath="K_ZAWARTOS"/>
+                                    </row>
+                                </RelatedFeature>
+                            </tbody>
+                        </tgroup>
+                    </table>
+                </p> 
+                <p/>
+                <p/>
+                <p><sup>wygenerowano przez procesy5.pl</sup></p>-->
+            </body>
+        </topic>
+    </xsl:template>
+    
+    <xsl:template mode="infrastructure_raport" match="*"></xsl:template>
+    
+    <xsl:template mode="infrastructure_raport" match="IN7_MK_BAZA_DYSTRYBUCJI">
+        <xsl:for-each-group select="*[Dlugosc]" group-by="local-name()">
+            <p>Dla warstwy <xsl:value-of select="local-name()"/>
+                Długość: <xsl:value-of select="sum(Dlugosc)"/>
+                Wg oferty nr 0  z dnia 0 cena Y 
+                wykonano X + rysunek
+                do wykonania Y + rysunek
+                do odbioru Z + rysunek
+                do wytyczenia ... + rysunek
+                do obmiaru powykonawczego ... + rysunek
+                
+            </p>
+        </xsl:for-each-group>
+        
+    </xsl:template>    
+    
+    
+    <xsl:template match="INWESTYCJA_BUDOWA_SIECI|IN7_MK_BAZA_DYSTRYBUCJI|IN7_DZIENNIK_KORESP" mode="ditamap">
+        <topicref href="{ID}_{local-name()}_topic.dita">
+            <xsl:result-document href="{$temp}/{$uuid}/{ID}_{local-name()}_topic.dita">
+                <xsl:apply-templates select="."/>
+            </xsl:result-document>
+            <xsl:apply-templates mode="ditamap"/>
+        </topicref>
+    </xsl:template>
+    
+    
+    <xsl:template mode="gml_geometry_image" match="*|text()|comment()"/>
+    
+    
+    <xsl:template mode="gml_geometry_image" match="Rozdzielcza_rurociag_wsg84">
+        <xsl:choose>
+            <xsl:when test="the_geom/text()">
+                <xsl:comment>Tu bedzie image z <xsl:value-of select="local-name()"/> <xsl:value-of select="the_geom"/></xsl:comment>
+                <p> wspolrzedne do przetworzenia <codeblock><xsl:value-of select="the_geom/text()"/></codeblock></p>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template match="Rozdzielcza_rurociag_wsg84" mode="postprocess_gml_geometry_image_unique">
+        <xsl:choose>
+            <xsl:when test="the_geom/text()">
+                <xsl:result-document href="{$temp}/{$uuid}/{ID}_{local-name()}.gml" >
+                    <the_geom>
+                        <xsl:attribute name="local-name" select="local-name()"/>
+                        <xsl:value-of select="the_geom"/>
+                    </the_geom>
+                </xsl:result-document>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    
+    <xsl:template mode="gml_geometry_image" match="INWESTYCJA_BUDOWA_SIECI|IN7_MK_BAZA_DYSTRYBUCJI">
+        <xsl:choose>
+            <xsl:when test="the_geom/text()">
+                <xsl:comment>Tu bedzie image z <xsl:value-of select="the_geom"/></xsl:comment>
+                <p> wspolrzedne do przetworzenia <codeblock><xsl:value-of select="the_geom/text()"/></codeblock></p>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template match="INWESTYCJA_BUDOWA_SIECI|IN7_MK_BAZA_DYSTRYBUCJI" mode="postprocess_gml_geometry_image_unique">
+        <xsl:choose>
+            <xsl:when test="the_geom/text()">
+                <xsl:result-document href="{$temp}/{$uuid}/{ID}_{local-name()}.gml" >
+                    <the_geom>
+                        <xsl:attribute name="local-name" select="local-name()"/>
+                        <xsl:value-of select="the_geom"/>
+                    </the_geom>
+                </xsl:result-document>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template match="*|text()|comment()" mode="gml_geometry_image_unique"/>
+        
+    
+    
+    
+    
+    
+    
+    
+    
+</xsl:stylesheet>

+ 16 - 0
SE/schema/default_db_xml_cache.public/default_db/extract_text.xsl

@@ -0,0 +1,16 @@
+<?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:template mode="system_cache__appinfo:extract_text" match="text()">
+        <xsl:copy-of select="."/>        
+    </xsl:template>
+    <xsl:template mode="system_cache__appinfo:extract_text" match="*">
+        <xsl:apply-templates mode="system_cache__appinfo:extract_text"/>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 40 - 0
SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.xsl

@@ -0,0 +1,40 @@
+<?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:import href="../escaped_html_to_xml.xsl"/>
+    <xsl:import href="../dita_enter_to_ph.xsl"/>
+    <xsl:include href="extract_text.xsl"/>
+    
+    <xsl:include href="CRM_PROCES/PROCES_INIT_tree_to_dita.xsl"/>
+    <xsl:include href="IN7_MK_BAZA_DYSTRYBUCJI/IN7_MK_BAZA_DYSTRYBUCJI_tree_to_dita.xsl"/>
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="temp" required="yes"/>
+    <xsl:param name="uuid" required="yes"/>
+    
+    <xsl:template mode="postprocess" match="RelatedFeatureRoot">
+        <postprocess_dita>
+            <xsl:comment>#25 match RelatedFeatureRoot</xsl:comment>
+            <xsl:apply-templates select="." mode="postprocess_root_IN7_MK_BAZA_DYSTRYBUCJI"/>
+            <xsl:apply-templates select="." mode="postprocess_root_PROCES_INIT"/>
+        </postprocess_dita>
+    </xsl:template>
+    
+    <xsl:template match="RelatedFeatureRoot">
+        <xsl:comment>#29 match RelatedFeatureRoot</xsl:comment>
+        <xsl:apply-templates mode="ditamap_root"/>
+    </xsl:template>
+    
+    <xsl:template mode="ditamap" match="*"/>
+    
+</xsl:stylesheet>

+ 49 - 0
SE/schema/default_db_xml_cache.public/system_cache__appinfo/postprocess.xsl

@@ -0,0 +1,49 @@
+<?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="temp"  required="yes"/>
+    <xsl:param name="uuid" required="yes"/>
+    
+    <xsl:template mode="system_cache__appinfo:postprocess" match="postprocess_dita">
+        <project basedir="{$temp}" name="project_for_{local-name()}" default="default">
+            <target name="default">
+                <xsl:apply-templates mode="system_cache__appinfo:postprocess"/>
+            </target>
+        </project>
+    </xsl:template>
+    
+    
+    
+    <xsl:template mode="system_cache__appinfo:postprocess" match="base64_to_image">
+        <xsl:choose>
+            <xsl:when test="@srcfile and @dstfile">
+                <exec executable="base64">
+                    <arg line="-i {@srcfile}"/>
+                    <arg line="-o {@dstfile}"/>
+                    <arg line="-D"/>
+                </exec>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="yes">#29 Not set @srcfile or @dstfile</xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__appinfo:postprocess" match="gml_to_image">
+        <xsl:choose>
+            <xsl:when test="@srcfile and @dstfile">
+                <echo>TODO convert gml 2 png for <xsl:value-of select="@srcfile"/> to <xsl:value-of select="@dstfile"/> </echo>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="yes">#29 Not set @srcfile or @dstfile</xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 47 - 3
SE/schema/default_db_xml_cache.public/xpath_query_check_create_xsl.xsl

@@ -7,14 +7,40 @@
 <xsl:output indent="yes"/>
 <xsl:strip-space elements="*"/>
 <xsl:param name="xpath_query" required="yes"/>
-        
-        
+               
         
     <xsl:template name="xpath_query_check_create_xsl">
        <xsl:element name="xsl:stylesheet" inherit-namespaces="yes"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:xs="http://www.w3.org/2001/XMLSchema">    
            <xsl:attribute name="version" select="'2.0'"/>
+           <xsl:element name="xsl:param">
+               <xsl:attribute name="name" select="'input'"/>
+           </xsl:element>
+           
+           <xsl:element name="xsl:template">
+               <xsl:attribute name="name" select="'input'"/>
+               
+               <xsl:element name="xsl:choose">
+                    <xsl:element name="xsl:when">
+                        <xsl:attribute name="test" select="'doc-available($input)'"/>
+                        <xsl:element name="xsl:variable">
+                            <xsl:attribute name="name" select="'input_file'"/>
+                            <xsl:attribute name="select" select="'doc($input)'"/>
+                        </xsl:element>
+                        <xsl:element name="xsl:apply-templates">
+                            <xsl:attribute name="select" select="'$input_file'"/>
+                        </xsl:element>
+                    </xsl:element>
+                   <xsl:element name="xsl:otherwise">
+                       <xsl:element name="xsl:message">
+                           #14 in xpath_query.xsl NOTICE ERROR SYSTEM PROBLEM!!!  for file <xsl:element name="xsl:value-of"><xsl:attribute name="select" select="'$input'"/></xsl:element>
+                       </xsl:element>
+                       <xpath_query_test>OK</xpath_query_test>
+                   </xsl:element>
+               </xsl:element>
+           </xsl:element>
+           
            <!--<xsl:element name="xsl:param">
                <xsl:attribute name="name" select="'featureID_name_dita'"/>
                <xsl:attribute name="required" select="'yes'"/>
@@ -31,10 +57,28 @@
                    <xsl:attribute name="select" select="'$featureID_name_dita'"/>
                </xsl:element>
            </xsl:element>-->
-           
+           <!--<xsl:element name="xsl:template">
+               <xsl:attribute name="match" select="'*'"/>
+               <xsl:element name="xsl:message">xpath_query_check_create_xsl: #38 (input node)
+                   <xsl:element name="xsl:copy-of">
+                       <xsl:attribute name="select" select="'.'"/>
+                   </xsl:element>
+               </xsl:element>
+               <xsl:element name="xsl:choose">
+                   <xsl:element name="xsl:when">
+                       <xsl:attribute name="test" select="concat('.',$xpath_query)"/>
+                       <xpath_query_test>OK</xpath_query_test></xsl:element>
+                   <xsl:element name="xsl:otherwise"><xpath_query_test>NOT_EXPECTED</xpath_query_test></xsl:element>
+               </xsl:element>
+           </xsl:element>-->
            <xsl:element name="xsl:template">
                <xsl:attribute name="match" select="'*'"/>
                <xsl:attribute name="mode" select="'xpath_query_test'"/>
+               <xsl:element name="xsl:message">xpath_query_check_create_xsl: #38 (input node)
+                   <xsl:element name="xsl:copy-of">
+                       <xsl:attribute name="select" select="'.'"/>
+                   </xsl:element>
+               </xsl:element>
                <xsl:element name="xsl:choose">
                    <xsl:element name="xsl:when">
                        <xsl:attribute name="test" select="concat('.',$xpath_query)"/>

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików