فهرست منبع

podmiana , todo wykorzystanie filtra [xpath_query] na razie tylko wynik w dzieciach do przetworzenia w loop i related

a.binder 9 سال پیش
والد
کامیت
4c3bbc99c3

+ 56 - 4
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/etykieta/build.xml

@@ -51,10 +51,17 @@
     <property name="typeName" value="${typeName}"/> <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP - be careful not to give it in apostrophs like 'p5_default_db:IN7_DZIENNIK_KORESP' - it wont work! -->
     <property name="typeName" value="${typeName}"/> <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP - be careful not to give it in apostrophs like 'p5_default_db:IN7_DZIENNIK_KORESP' - it wont work! -->
     <property name="xpath" value="${xpath}"/> <!-- to be set initially like as key to search ID  -->
     <property name="xpath" value="${xpath}"/> <!-- to be set initially like as key to search ID  -->
     <property name="xpath_value" value="${xpath_value}"/> <!-- to be set initially like 1000 (to search ID=1000, if ID we get by featureID  -->
     <property name="xpath_value" value="${xpath_value}"/> <!-- to be set initially like 1000 (to search ID=1000, if ID we get by featureID  -->
+    <property name="xpath_query" value="${xpath_query}"/> <!-- limit input by example: xpath_query="[position()&lt;3] limit RelatedFeatures; [not(local-name()='PROCES_INIT')] - to limit tree level -->
+    
+    
+    <property name="ignore_maxOccurs_0" value="1"/> <!-- When element has maxOccurs=0 do not try to retrieve him to limit tree -->
     
     
     <property name="loop_path_recurs" value=""/>  <!-- w przypadku podania, system powinien w tym katalogu zapisywac wynik xml dzialania, azeby odbudowac rekursywne drzewo - zapisujemy po system_cache__appinfo:id np bedzie ${temp}/${uuid}_CRM_PROCES___d14e4479-1_PROCES_BEN/  -->
     <property name="loop_path_recurs" value=""/>  <!-- w przypadku podania, system powinien w tym katalogu zapisywac wynik xml dzialania, azeby odbudowac rekursywne drzewo - zapisujemy po system_cache__appinfo:id np bedzie ${temp}/${uuid}_CRM_PROCES___d14e4479-1_PROCES_BEN/  -->
     <property name="temp_name" value="temp"/> <!-- temp files-->
     <property name="temp_name" value="temp"/> <!-- temp files-->
     <property name="temp" value="${basedir}/${temp_name}${loop_path_recurs}"/> <!-- temp files-->
     <property name="temp" value="${basedir}/${temp_name}${loop_path_recurs}"/> <!-- temp files-->
+    
+    <property name="xpath_query.xsl" value="${basedir}/${temp_name}/${uuid}.xpath_query.xsl"/>
+    <property name="empty.xml" value="${basedir}/${temp_name}/${uuid}.empty.xml"/>
     <!-- variables to first transform of doc for then get related features -->
     <!-- 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 -->
     <!--<property name="default_db_xml_cache.public" value="../../../default_db_xml_cache.public"/>--> <!-- katalog z xsl z projektu src-xmlschema.git -->
     
     
@@ -215,7 +222,6 @@
         
         
         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.dita}.with_id.xml"/>
         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.dita}.with_id.xml"/>
         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
-        <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
         <condition property="test_if_dita" taskname="check_dita" >
         <condition property="test_if_dita" taskname="check_dita" >
             <available file="${main_build_recurse_ant.dita}"/>  
             <available file="${main_build_recurse_ant.dita}"/>  
         </condition>
         </condition>
@@ -251,7 +257,7 @@
                                     
                                     
                         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.tr_map_sed}.with_id.xml"/>
                         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.tr_map_sed}.with_id.xml"/>
                         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
                         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
-                        <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
+                        
                         
                         
                         <condition property="test_if_tr_map" taskname="check_tr_map" >
                         <condition property="test_if_tr_map" taskname="check_tr_map" >
                             <available file="${main_build_recurse_ant.dita}"/>  
                             <available file="${main_build_recurse_ant.dita}"/>  
@@ -371,6 +377,8 @@
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <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="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="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="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     </target>
     
     
     <target name="check_default_db_xml_cache.public_default" depends="set_default_db_xml_cache.public_local" unless="${set_default_db_xml_cache.public_local}">
     <target name="check_default_db_xml_cache.public_default" depends="set_default_db_xml_cache.public_local" unless="${set_default_db_xml_cache.public_local}">
@@ -379,6 +387,8 @@
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <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="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="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="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     </target>
     
     
     
     
@@ -418,9 +428,47 @@
         <echo>&lt;br&gt;Skasowano pliki tymczasowe&lt;/br&gt;</echo>         
         <echo>&lt;br&gt;Skasowano pliki tymczasowe&lt;/br&gt;</echo>         
         <echo message="OUTPUT__END"/>
         <echo message="OUTPUT__END"/>
     </target>
     </target>
-
+    
+    
+    <target name="xpath_query.xsl_check" description="to generate xpath_query.xsl if it is set">
+        <condition taskname="xpath_query.xsl" property="xpath_query_set">
+            <or>
+                <equals arg1="${xpath_query}" arg2=""/>
+                <equals arg1="${xpath_query}" arg2="$${xpath_query}"/>
+            </or>
+        </condition>
+    </target>
+    
+    <target name="xpath_query.xsl" depends="xpath_query.xsl_check" unless="${xpath_query_set}" description="to generate xpath_query.xsl if it is set">
+        <echoxml file="${empty.xml}">
+            <empty>empty</empty>
+        </echoxml>
+        <xslt basedir="./" style="${xpath_query_check_create_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${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}"/>
+        </xslt>
+    </target>
+    
+    <target name="xpath_query.xsl_fail" depends="xpath_query.xsl_check" if="${xpath_query_set}" description="to generate xpath_query.xsl if it is set">
+        <echoxml file="${empty.xml}">
+            <empty>empty</empty>
+        </echoxml>
+        <xslt basedir="./" style="${xpath_query_check_create_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${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]"/>
+        </xslt>
+    </target>
+    
     <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
     <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
-    <target name="build_recurse_ant.xml" depends="php_session_id_check,main_build_recurse_ant.dita_with_id,main_build_recurse_ant.tr_map_with_id">
+    <target name="build_recurse_ant.xml" depends="php_session_id_check,xpath_query.xsl,xpath_query.xsl_fail,main_build_recurse_ant.dita_with_id,main_build_recurse_ant.tr_map_with_id">
         <!-- build do wytworzenia pierwszego przetworzenia zagniezdzen -->
         <!-- build do wytworzenia pierwszego przetworzenia zagniezdzen -->
         <property name="loop_xpath"  value="root"/>
         <property name="loop_xpath"  value="root"/>
         <property name="build_recurse_ant.xml" value="${temp}/${uuid_tested}.build_${loop_xpath}.xml"/>
         <property name="build_recurse_ant.xml" value="${temp}/${uuid_tested}.build_${loop_xpath}.xml"/>
@@ -456,6 +504,10 @@
             <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
             <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
             <param name="cookie_curl_option" expression="${php_session_id_tested}"/>
             <param name="cookie_curl_option" expression="${php_session_id_tested}"/>
             <param name="loop_path_recurs" expression="${loop_path_recurs}"/>
             <param name="loop_path_recurs" expression="${loop_path_recurs}"/>
+            <param name="ignore_maxOccurs_0" expression="${ignore_maxOccurs_0}"/>
+            <param name="xpath_query" expression="${xpath_query}"/>
+            <param name="xpath_query.xsl" expression="${xpath_query.xsl}"/>
+            <param name="empty.xml" expression="${empty.xml}"/>
 
 
         </xslt>
         </xslt>
         <!--<import file="${build_recurse_ant.xml}"/>-->
         <!--<import file="${build_recurse_ant.xml}"/>-->

+ 58 - 5
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<project basedir="." name="PRINT_TEMPLATE" default="buildpdf_recursed"  >
+<project basedir="." name="PRINT_TEMPLATE" default="buildpdf_recursed"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" >
     <description>
     <description>
         Pismo
         Pismo
     </description>
     </description>
@@ -51,10 +52,17 @@
     <property name="typeName" value="${typeName}"/> <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP - be careful not to give it in apostrophs like 'p5_default_db:IN7_DZIENNIK_KORESP' - it wont work! -->
     <property name="typeName" value="${typeName}"/> <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP - be careful not to give it in apostrophs like 'p5_default_db:IN7_DZIENNIK_KORESP' - it wont work! -->
     <property name="xpath" value="${xpath}"/> <!-- to be set initially like as key to search ID  -->
     <property name="xpath" value="${xpath}"/> <!-- to be set initially like as key to search ID  -->
     <property name="xpath_value" value="${xpath_value}"/> <!-- to be set initially like 1000 (to search ID=1000, if ID we get by featureID  -->
     <property name="xpath_value" value="${xpath_value}"/> <!-- to be set initially like 1000 (to search ID=1000, if ID we get by featureID  -->
+    <property name="xpath_query" value="${xpath_query}"/> <!-- limit input by example: xpath_query="[position()&lt;3] limit RelatedFeatures; [not(local-name()='PROCES_INIT')] - to limit tree level -->
+    
+    
+    <property name="ignore_maxOccurs_0" value="1"/> <!-- When element has maxOccurs=0 do not try to retrieve him to limit tree -->
     
     
     <property name="loop_path_recurs" value=""/>  <!-- w przypadku podania, system powinien w tym katalogu zapisywac wynik xml dzialania, azeby odbudowac rekursywne drzewo - zapisujemy po system_cache__appinfo:id np bedzie ${temp}/${uuid}_CRM_PROCES___d14e4479-1_PROCES_BEN/  -->
     <property name="loop_path_recurs" value=""/>  <!-- w przypadku podania, system powinien w tym katalogu zapisywac wynik xml dzialania, azeby odbudowac rekursywne drzewo - zapisujemy po system_cache__appinfo:id np bedzie ${temp}/${uuid}_CRM_PROCES___d14e4479-1_PROCES_BEN/  -->
     <property name="temp_name" value="temp"/> <!-- temp files-->
     <property name="temp_name" value="temp"/> <!-- temp files-->
     <property name="temp" value="${basedir}/${temp_name}${loop_path_recurs}"/> <!-- temp files-->
     <property name="temp" value="${basedir}/${temp_name}${loop_path_recurs}"/> <!-- temp files-->
+    
+    <property name="xpath_query.xsl" value="${basedir}/${temp_name}/${uuid}.xpath_query.xsl"/>
+    <property name="empty.xml" value="${basedir}/${temp_name}/${uuid}.empty.xml"/>
     <!-- variables to first transform of doc for then get related features -->
     <!-- 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 -->
     <!--<property name="default_db_xml_cache.public" value="../../../default_db_xml_cache.public"/>--> <!-- katalog z xsl z projektu src-xmlschema.git -->
     
     
@@ -215,7 +223,6 @@
         
         
         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.dita}.with_id.xml"/>
         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.dita}.with_id.xml"/>
         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
-        <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
         <condition property="test_if_dita" taskname="check_dita" >
         <condition property="test_if_dita" taskname="check_dita" >
             <available file="${main_build_recurse_ant.dita}"/>  
             <available file="${main_build_recurse_ant.dita}"/>  
         </condition>
         </condition>
@@ -251,7 +258,7 @@
                                     
                                     
                         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.tr_map_sed}.with_id.xml"/>
                         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.tr_map_sed}.with_id.xml"/>
                         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
                         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
-                        <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
+                        
                         
                         
                         <condition property="test_if_tr_map" taskname="check_tr_map" >
                         <condition property="test_if_tr_map" taskname="check_tr_map" >
                             <available file="${main_build_recurse_ant.dita}"/>  
                             <available file="${main_build_recurse_ant.dita}"/>  
@@ -371,6 +378,8 @@
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <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="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="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="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     </target>
     
     
     <target name="check_default_db_xml_cache.public_default" depends="set_default_db_xml_cache.public_local" unless="${set_default_db_xml_cache.public_local}">
     <target name="check_default_db_xml_cache.public_default" depends="set_default_db_xml_cache.public_local" unless="${set_default_db_xml_cache.public_local}">
@@ -379,6 +388,8 @@
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <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="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="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="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     </target>
     
     
     
     
@@ -418,9 +429,47 @@
         <echo>&lt;br&gt;Skasowano pliki tymczasowe&lt;/br&gt;</echo>         
         <echo>&lt;br&gt;Skasowano pliki tymczasowe&lt;/br&gt;</echo>         
         <echo message="OUTPUT__END"/>
         <echo message="OUTPUT__END"/>
     </target>
     </target>
-
+    
+    
+    <target name="xpath_query.xsl_check" description="to generate xpath_query.xsl if it is set">
+        <condition taskname="xpath_query.xsl" property="xpath_query_set">
+            <or>
+                <equals arg1="${xpath_query}" arg2=""/>
+                <equals arg1="${xpath_query}" arg2="$${xpath_query}"/>
+            </or>
+        </condition>
+    </target>
+    
+    <target name="xpath_query.xsl" depends="xpath_query.xsl_check" unless="${xpath_query_set}" description="to generate xpath_query.xsl if it is set">
+        <echoxml file="${empty.xml}">
+            <empty>empty</empty>
+        </echoxml>
+        <xslt basedir="./" style="${xpath_query_check_create_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${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}"/>
+        </xslt>
+    </target>
+    
+    <target name="xpath_query.xsl_fail" depends="xpath_query.xsl_check" if="${xpath_query_set}" description="to generate xpath_query.xsl if it is set">
+        <echoxml file="${empty.xml}">
+            <empty>empty</empty>
+        </echoxml>
+        <xslt basedir="./" style="${xpath_query_check_create_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${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]"/>
+        </xslt>
+    </target>
+    
     <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
     <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
-    <target name="build_recurse_ant.xml" depends="php_session_id_check,main_build_recurse_ant.dita_with_id,main_build_recurse_ant.tr_map_with_id">
+    <target name="build_recurse_ant.xml" depends="php_session_id_check,xpath_query.xsl,xpath_query.xsl_fail,main_build_recurse_ant.dita_with_id,main_build_recurse_ant.tr_map_with_id">
         <!-- build do wytworzenia pierwszego przetworzenia zagniezdzen -->
         <!-- build do wytworzenia pierwszego przetworzenia zagniezdzen -->
         <property name="loop_xpath"  value="root"/>
         <property name="loop_xpath"  value="root"/>
         <property name="build_recurse_ant.xml" value="${temp}/${uuid_tested}.build_${loop_xpath}.xml"/>
         <property name="build_recurse_ant.xml" value="${temp}/${uuid_tested}.build_${loop_xpath}.xml"/>
@@ -456,6 +505,10 @@
             <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
             <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
             <param name="cookie_curl_option" expression="${php_session_id_tested}"/>
             <param name="cookie_curl_option" expression="${php_session_id_tested}"/>
             <param name="loop_path_recurs" expression="${loop_path_recurs}"/>
             <param name="loop_path_recurs" expression="${loop_path_recurs}"/>
+            <param name="ignore_maxOccurs_0" expression="${ignore_maxOccurs_0}"/>
+            <param name="xpath_query" expression="${xpath_query}"/>
+            <param name="xpath_query.xsl" expression="${xpath_query.xsl}"/>
+            <param name="empty.xml" expression="${empty.xml}"/>
 
 
         </xslt>
         </xslt>
         <!--<import file="${build_recurse_ant.xml}"/>-->
         <!--<import file="${build_recurse_ant.xml}"/>-->

+ 56 - 4
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/umowa/build.xml

@@ -51,10 +51,17 @@
     <property name="typeName" value="${typeName}"/> <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP - be careful not to give it in apostrophs like 'p5_default_db:IN7_DZIENNIK_KORESP' - it wont work! -->
     <property name="typeName" value="${typeName}"/> <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP - be careful not to give it in apostrophs like 'p5_default_db:IN7_DZIENNIK_KORESP' - it wont work! -->
     <property name="xpath" value="${xpath}"/> <!-- to be set initially like as key to search ID  -->
     <property name="xpath" value="${xpath}"/> <!-- to be set initially like as key to search ID  -->
     <property name="xpath_value" value="${xpath_value}"/> <!-- to be set initially like 1000 (to search ID=1000, if ID we get by featureID  -->
     <property name="xpath_value" value="${xpath_value}"/> <!-- to be set initially like 1000 (to search ID=1000, if ID we get by featureID  -->
+    <property name="xpath_query" value="${xpath_query}"/> <!-- limit input by example: xpath_query="[position()&lt;3] limit RelatedFeatures; [not(local-name()='PROCES_INIT')] - to limit tree level -->
+    
+    
+    <property name="ignore_maxOccurs_0" value="1"/> <!-- When element has maxOccurs=0 do not try to retrieve him to limit tree -->
     
     
     <property name="loop_path_recurs" value=""/>  <!-- w przypadku podania, system powinien w tym katalogu zapisywac wynik xml dzialania, azeby odbudowac rekursywne drzewo - zapisujemy po system_cache__appinfo:id np bedzie ${temp}/${uuid}_CRM_PROCES___d14e4479-1_PROCES_BEN/  -->
     <property name="loop_path_recurs" value=""/>  <!-- w przypadku podania, system powinien w tym katalogu zapisywac wynik xml dzialania, azeby odbudowac rekursywne drzewo - zapisujemy po system_cache__appinfo:id np bedzie ${temp}/${uuid}_CRM_PROCES___d14e4479-1_PROCES_BEN/  -->
     <property name="temp_name" value="temp"/> <!-- temp files-->
     <property name="temp_name" value="temp"/> <!-- temp files-->
     <property name="temp" value="${basedir}/${temp_name}${loop_path_recurs}"/> <!-- temp files-->
     <property name="temp" value="${basedir}/${temp_name}${loop_path_recurs}"/> <!-- temp files-->
+    
+    <property name="xpath_query.xsl" value="${basedir}/${temp_name}/${uuid}.xpath_query.xsl"/>
+    <property name="empty.xml" value="${basedir}/${temp_name}/${uuid}.empty.xml"/>
     <!-- variables to first transform of doc for then get related features -->
     <!-- 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 -->
     <!--<property name="default_db_xml_cache.public" value="../../../default_db_xml_cache.public"/>--> <!-- katalog z xsl z projektu src-xmlschema.git -->
     
     
@@ -215,7 +222,6 @@
         
         
         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.dita}.with_id.xml"/>
         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.dita}.with_id.xml"/>
         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
-        <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
         <condition property="test_if_dita" taskname="check_dita" >
         <condition property="test_if_dita" taskname="check_dita" >
             <available file="${main_build_recurse_ant.dita}"/>  
             <available file="${main_build_recurse_ant.dita}"/>  
         </condition>
         </condition>
@@ -251,7 +257,7 @@
                                     
                                     
                         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.tr_map_sed}.with_id.xml"/>
                         <property name="main_build_recurse_ant.dita_with_id" value="${temp}/${main_build_recurse_ant.tr_map_sed}.with_id.xml"/>
                         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
                         <property name="main_build_recurse_ant.dita_with_id.xsl" value="${default_db_xml_cache.public}/main_build_recurse_ant.dita_with_id.xsl"/>
-                        <property name="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
+                        
                         
                         
                         <condition property="test_if_tr_map" taskname="check_tr_map" >
                         <condition property="test_if_tr_map" taskname="check_tr_map" >
                             <available file="${main_build_recurse_ant.dita}"/>  
                             <available file="${main_build_recurse_ant.dita}"/>  
@@ -371,6 +377,8 @@
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <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="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="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="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     </target>
     
     
     <target name="check_default_db_xml_cache.public_default" depends="set_default_db_xml_cache.public_local" unless="${set_default_db_xml_cache.public_local}">
     <target name="check_default_db_xml_cache.public_default" depends="set_default_db_xml_cache.public_local" unless="${set_default_db_xml_cache.public_local}">
@@ -379,6 +387,8 @@
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <property name="build_recurse_ant.xsl" value="${default_db_xml_cache.public}/build_recurse_ant.xsl"/>
         <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="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="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="recurse_ant_to_html.xsl" value="${default_db_xml_cache.public}/recurse_ant_to_html.xsl"/>
     </target>
     </target>
     
     
     
     
@@ -418,9 +428,47 @@
         <echo>&lt;br&gt;Skasowano pliki tymczasowe&lt;/br&gt;</echo>         
         <echo>&lt;br&gt;Skasowano pliki tymczasowe&lt;/br&gt;</echo>         
         <echo message="OUTPUT__END"/>
         <echo message="OUTPUT__END"/>
     </target>
     </target>
-
+    
+    
+    <target name="xpath_query.xsl_check" description="to generate xpath_query.xsl if it is set">
+        <condition taskname="xpath_query.xsl" property="xpath_query_set">
+            <or>
+                <equals arg1="${xpath_query}" arg2=""/>
+                <equals arg1="${xpath_query}" arg2="$${xpath_query}"/>
+            </or>
+        </condition>
+    </target>
+    
+    <target name="xpath_query.xsl" depends="xpath_query.xsl_check" unless="${xpath_query_set}" description="to generate xpath_query.xsl if it is set">
+        <echoxml file="${empty.xml}">
+            <empty>empty</empty>
+        </echoxml>
+        <xslt basedir="./" style="${xpath_query_check_create_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${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}"/>
+        </xslt>
+    </target>
+    
+    <target name="xpath_query.xsl_fail" depends="xpath_query.xsl_check" if="${xpath_query_set}" description="to generate xpath_query.xsl if it is set">
+        <echoxml file="${empty.xml}">
+            <empty>empty</empty>
+        </echoxml>
+        <xslt basedir="./" style="${xpath_query_check_create_xsl.xsl}" in="${empty.xml}"  destdir="./" out="${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]"/>
+        </xslt>
+    </target>
+    
     <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
     <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
-    <target name="build_recurse_ant.xml" depends="php_session_id_check,main_build_recurse_ant.dita_with_id,main_build_recurse_ant.tr_map_with_id">
+    <target name="build_recurse_ant.xml" depends="php_session_id_check,xpath_query.xsl,xpath_query.xsl_fail,main_build_recurse_ant.dita_with_id,main_build_recurse_ant.tr_map_with_id">
         <!-- build do wytworzenia pierwszego przetworzenia zagniezdzen -->
         <!-- build do wytworzenia pierwszego przetworzenia zagniezdzen -->
         <property name="loop_xpath"  value="root"/>
         <property name="loop_xpath"  value="root"/>
         <property name="build_recurse_ant.xml" value="${temp}/${uuid_tested}.build_${loop_xpath}.xml"/>
         <property name="build_recurse_ant.xml" value="${temp}/${uuid_tested}.build_${loop_xpath}.xml"/>
@@ -456,6 +504,10 @@
             <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
             <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
             <param name="cookie_curl_option" expression="${php_session_id_tested}"/>
             <param name="cookie_curl_option" expression="${php_session_id_tested}"/>
             <param name="loop_path_recurs" expression="${loop_path_recurs}"/>
             <param name="loop_path_recurs" expression="${loop_path_recurs}"/>
+            <param name="ignore_maxOccurs_0" expression="${ignore_maxOccurs_0}"/>
+            <param name="xpath_query" expression="${xpath_query}"/>
+            <param name="xpath_query.xsl" expression="${xpath_query.xsl}"/>
+            <param name="empty.xml" expression="${empty.xml}"/>
 
 
         </xslt>
         </xslt>
         <!--<import file="${build_recurse_ant.xml}"/>-->
         <!--<import file="${build_recurse_ant.xml}"/>-->

+ 240 - 48
SE/schema/default_db_xml_cache.public/build_recurse_ant.xsl

@@ -55,6 +55,12 @@
     <xsl:param name="builds_to_ant.xsl" required="yes"/>
     <xsl:param name="builds_to_ant.xsl" required="yes"/>
     <xsl:param name="cookie_curl_option" required="yes"/>
     <xsl:param name="cookie_curl_option" required="yes"/>
     <xsl:param name="loop_path_recurs" required="yes" /> <!-- loop path dla gromadzenia plikow dla RelatedFeatureLoop do przetworzen w rekurencji - domysmnie pusty, potem sie dobudowuje po wyzwoleniu anta w glab -->
     <xsl:param name="loop_path_recurs" required="yes" /> <!-- loop path dla gromadzenia plikow dla RelatedFeatureLoop do przetworzen w rekurencji - domysmnie pusty, potem sie dobudowuje po wyzwoleniu anta w glab -->
+    <xsl:param name="ignore_maxOccurs_0" select="false()"/>
+    <xsl:param name="xpath_query"/>
+    <xsl:param name="xpath_query.xsl" required="yes"/>
+    <xsl:param name="empty.xml" required="yes"/>
+    
+    
     <!-- second step fist loop - with data -->
     <!-- second step fist loop - with data -->
     <!--<xsl:param name="wfs_output.xml"/>--> <!-- to be set in second step by ant build generated by this style to fill by its data childs -->
     <!--<xsl:param name="wfs_output.xml"/>--> <!-- to be set in second step by ant build generated by this style to fill by its data childs -->
     
     
@@ -132,7 +138,6 @@
                 </xsl:variable> 
                 </xsl:variable> 
                 <xsl:variable name="xpath_value_dita">
                 <xsl:variable name="xpath_value_dita">
                     <xsl:choose>
                     <xsl:choose>
-                        
                         <xsl:when test="@xpath_value">
                         <xsl:when test="@xpath_value">
                             <!--<xsl:variable name="xpath_value_tokens" select="tokenize(@xpath_value,'/')"/>-->
                             <!--<xsl:variable name="xpath_value_tokens" select="tokenize(@xpath_value,'/')"/>-->
                             <!--<xsl:value-of select="'todo zapytanie xpath do przetworzenia'"/>-->
                             <!--<xsl:value-of select="'todo zapytanie xpath do przetworzenia'"/>-->
@@ -201,12 +206,32 @@
                         <xsl:attribute name="value" select="$loop_path_recurs"/>
                         <xsl:attribute name="value" select="$loop_path_recurs"/>
                     </xsl:element>
                     </xsl:element>
                     
                     
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'xpath_query'"/>
+                        <xsl:attribute name="value" select="$xpath_query"/>
+                    </xsl:element>
+                    
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'ignore_maxOccurs_0'"/>
+                        <xsl:attribute name="value" select="$ignore_maxOccurs_0"/>
+                    </xsl:element>
+                    
                     <xsl:comment>
                     <xsl:comment>
                         Important variables:
                         Important variables:
                         typeName=<xsl:value-of select="$typeName"/>;
                         typeName=<xsl:value-of select="$typeName"/>;
                         xpath=<xsl:value-of select="$xpath"/>;
                         xpath=<xsl:value-of select="$xpath"/>;
                         xpath_value=<xsl:value-of select="$xpath_value"/>;
                         xpath_value=<xsl:value-of select="$xpath_value"/>;
                         $passwordBase64Basic=<xsl:value-of select="$passwordBase64Basic"/>
                         $passwordBase64Basic=<xsl:value-of select="$passwordBase64Basic"/>
+                          #221
+                        $typeName_dita= <xsl:value-of select="$typeName_dita"/>
+                        $featureID_name_dita= <xsl:value-of select="$featureID_name_dita"/>
+                        $wfs_output= <xsl:value-of select="$wfs_output"/>
+                        $wfs_output.xml= <xsl:value-of select="$wfs_output.xml"/>
+                        $wfs_output.dita= <xsl:value-of select="$wfs_output.dita"/>
+                        $xpath_dita= <xsl:value-of select="$xpath_dita"/>
+                        $xpath_value_dita= <xsl:value-of select="$xpath_value_dita"/>
+                        $ignore_maxOccurs= <xsl:value-of select="$ignore_maxOccurs_0"/> ; @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>
+                        $xpath_query=<xsl:value-of select="$xpath_query"/>;
                     </xsl:comment>
                     </xsl:comment>
                     <xsl:apply-templates mode="ant_target" select=".">
                     <xsl:apply-templates mode="ant_target" select=".">
                         <xsl:with-param name="typeName_dita" select="$typeName_dita"/>
                         <xsl:with-param name="typeName_dita" select="$typeName_dita"/>
@@ -275,6 +300,7 @@
                             <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
                             <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
                             <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
                             <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
                             <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
                             <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
+                            <xsl:with-param name="featureID_name_dita" select="$featureID_name_dita"/>
                             <!--<xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>-->
                             <!--<xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>-->
                         </xsl:apply-templates>
                         </xsl:apply-templates>
                     </xsl:element>
                     </xsl:element>
@@ -329,15 +355,18 @@
                     </xsl:choose>
                     </xsl:choose>
                 </xsl:variable>
                 </xsl:variable>
                 <xsl:comment>
                 <xsl:comment>
-                    RelatedFeatureLoop:
+                    RelatedFeatureLoop: #344
                         $typeName_dita= <xsl:value-of select="$typeName_dita"/>
                         $typeName_dita= <xsl:value-of select="$typeName_dita"/>
                         $featureID_name_dita= <xsl:value-of select="$featureID_name_dita"/>
                         $featureID_name_dita= <xsl:value-of select="$featureID_name_dita"/>
                         $wfs_output= <xsl:value-of select="$wfs_output"/>
                         $wfs_output= <xsl:value-of select="$wfs_output"/>
                         $wfs_output.xml= <xsl:value-of select="$wfs_output.xml"/>
                         $wfs_output.xml= <xsl:value-of select="$wfs_output.xml"/>
                         $wfs_output.dita= <xsl:value-of select="$wfs_output.dita"/>
                         $wfs_output.dita= <xsl:value-of select="$wfs_output.dita"/>
                         $xpath_dita= <xsl:value-of select="$xpath_dita"/>
                         $xpath_dita= <xsl:value-of select="$xpath_dita"/>
-                       $xpath_value_dita= <xsl:value-of select="$xpath_value_dita"/>
+                        $xpath_value_dita= <xsl:value-of select="$xpath_value_dita"/>
+                        $ignore_maxOccurs= <xsl:value-of select="$ignore_maxOccurs_0"/> ; @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>
+                        $xpath_query=<xsl:value-of select="$xpath_query"/>;
                 </xsl:comment>
                 </xsl:comment>
+                
                 <project basedir="{$basedir}" name="get_related_feature{$loop_xpath_real}_{$loop_path_recurs}" default="get_related_feature_run_child_ant{$loop_xpath_real}_{$loop_path_recurs}">
                 <project basedir="{$basedir}" name="get_related_feature{$loop_xpath_real}_{$loop_path_recurs}" default="get_related_feature_run_child_ant{$loop_xpath_real}_{$loop_path_recurs}">
                     <xsl:comment>RelatedFeatureCount:<xsl:value-of select="count(*)"/></xsl:comment>
                     <xsl:comment>RelatedFeatureCount:<xsl:value-of select="count(*)"/></xsl:comment>
                     <echo> ANT Uruchamiam $feature_pos=<xsl:value-of select="$feature_pos"/>; projekt <xsl:value-of select="$loop_xpath_real"/>; </echo>
                     <echo> ANT Uruchamiam $feature_pos=<xsl:value-of select="$feature_pos"/>; projekt <xsl:value-of select="$loop_xpath_real"/>; </echo>
@@ -383,6 +412,17 @@
                     <property name="xpath_value" value="{$xpath_value_dita}"/>
                     <property name="xpath_value" value="{$xpath_value_dita}"/>
 <!--                        DtypeName=p5_default_db:CRM_PROCES -Dxpath=ID -Dxpath_value=5247 -->
 <!--                        DtypeName=p5_default_db:CRM_PROCES -Dxpath=ID -Dxpath_value=5247 -->
                     <property name="loop_path_recurs" value="{$loop_path_recurs}"/>
                     <property name="loop_path_recurs" value="{$loop_path_recurs}"/>
+                    
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'xpath_query'"/>
+                        <xsl:attribute name="value" select="$xpath_query"/>
+                    </xsl:element>
+                    
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'ignore_maxOccurs_0'"/>
+                        <xsl:attribute name="value" select="$ignore_maxOccurs_0"/>
+                    </xsl:element>
+                    
                     <xsl:comment>
                     <xsl:comment>
                         Important variables:
                         Important variables:
                         typeName=<xsl:value-of select="$typeName"/>;
                         typeName=<xsl:value-of select="$typeName"/>;
@@ -418,7 +458,7 @@
                                wiec powinnismy uruchomic ant ten plik w ciemno znajac jego nizsze wezly</xsl:comment>
                                wiec powinnismy uruchomic ant ten plik w ciemno znajac jego nizsze wezly</xsl:comment>
                     <xsl:variable name="featureID_name_child" select="substring-after($typeName,':')"/>
                     <xsl:variable name="featureID_name_child" select="substring-after($typeName,':')"/>
                     <xsl:variable name="loop_xpath_child" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
                     <xsl:variable name="loop_xpath_child" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
-                    <xsl:message>#142 ustalamy $loop_xpath_child=<xsl:value-of select="$loop_xpath_child"/></xsl:message>
+                    <xsl:message>#142 ustalamy $loop_xpath_child=<xsl:value-of select="$loop_xpath_child"/>; maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>; </xsl:message>
                     
                     
                     <!-- warunek dla ograniczenia zapetlenia TODO do optymalizacji aby nie potrzebnie nie robilo zapytania czy jest wezel zaglebiony -->
                     <!-- warunek dla ograniczenia zapetlenia TODO do optymalizacji aby nie potrzebnie nie robilo zapytania czy jest wezel zaglebiony -->
                     
                     
@@ -542,8 +582,47 @@
         <xsl:param name="uuid" required="yes"/>
         <xsl:param name="uuid" required="yes"/>
         <xsl:param name="loop_xpath" required="yes"/>
         <xsl:param name="loop_xpath" required="yes"/>
         <xsl:param name="loop_xpath_real" required="yes"/>
         <xsl:param name="loop_xpath_real" required="yes"/>
+        <xsl:param name="featureID_name_dita" required="yes"/>
+        
+        
+        <echo>#588 testuje czy sciagac node poprzez $xpath_query.xsl to <xsl:value-of select="concat('${builds_to_ant_file_test_xpath_query.xml',$loop_xpath_real,@xml_id,'}')"/></echo> 
+        <xsl:element name="tempfile">
+            <xsl:attribute name="property" select="concat('builds_to_ant_test_featureID_name_dita',$loop_xpath_real,@xml_id)"/>
+            <xsl:attribute name="deleteonexit" select="'no'"/>
+            <xsl:attribute name="destdir" select="$temp"/>
+            <xsl:attribute name="suffix" select="'.xml'"/>
+            <xsl:attribute name="prefix" select="concat('${uuid}.builds_to_ant-loop_test_featureID_name_dita',@xml_id,'-')"/>
+        </xsl:element>
+        
+        <xsl:element name="echoxml">
+            <xsl:attribute name="file" select="concat('${builds_to_ant_test_featureID_name_dita',$loop_xpath_real,@xml_id,'}')"/>
+            <xsl:element name="{$featureID_name_dita}">empty</xsl:element>
+        </xsl:element>
+        
+        <xsl:element name="tempfile">
+            <xsl:attribute name="property" select="concat('builds_to_ant_test_featureID_name_dita_out.xml',$loop_xpath_real,@xml_id)"/>
+            <xsl:attribute name="deleteonexit" select="'no'"/>
+            <xsl:attribute name="destdir" select="$temp"/>
+            <xsl:attribute name="suffix" select="'.xml'"/>
+            <xsl:attribute name="prefix" select="concat('${uuid}.builds_to_ant-loop_test_featureID_name_dita_out',@xml_id,'-')"/>
+        </xsl:element>
+        
+        <xsl:element name="xslt">
+            <xsl:attribute name="basedir" select="'./'"/>
+            <xsl:attribute name="style" select="$xpath_query.xsl"/>
+            <xsl:attribute name="in" select="concat('${builds_to_ant_test_featureID_name_dita',$loop_xpath_real,@xml_id,'}')"/>
+            <xsl:attribute name="destdir" select="'./'"/>
+            <xsl:attribute name="out" select="concat('${builds_to_ant_test_featureID_name_dita_out.xml',$loop_xpath_real,@xml_id,'}')"/>
+            <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="xpath_query_test"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <!--<param name="featureID_name_dita" expression="{$featureID_name_dita}"/>-->
+        </xsl:element>
+        
         <!-- wygenerujemy liste ant -->
         <!-- wygenerujemy liste ant -->
-        <echo> #235 ant szukam fileset id=builds_to_ant w <xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.*.xml')"/> </echo>
+        <echo> #235 @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>; ant szukam fileset id=builds_to_ant w <xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.*.xml')"/> </echo>
         <fileset id="builds_to_ant{$loop_xpath_real}{@xml_id}" dir="{$temp}" includes="{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.*.xml" />
         <fileset id="builds_to_ant{$loop_xpath_real}{@xml_id}" dir="{$temp}" includes="{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.*.xml" />
         <property name="builds_to_ant{$loop_xpath_real}{@xml_id}" refid="builds_to_ant{$loop_xpath_real}{@xml_id}"/>
         <property name="builds_to_ant{$loop_xpath_real}{@xml_id}" refid="builds_to_ant{$loop_xpath_real}{@xml_id}"/>
         <!--<tempfile property="builds_to_ant.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.builds_to_ant-"/>-->
         <!--<tempfile property="builds_to_ant.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.builds_to_ant-"/>-->
@@ -586,6 +665,9 @@
                 <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
                 <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
             </xsl:element>-->
             </xsl:element>-->
             <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
             <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
+            <param name="xpath_query" expression="{$xpath_query}"/> <!-- limit related TODO -->
+            <param name="xpath_query.xsl" expression="{$xpath_query.xsl}"/>
+            <param name="featureID_name_dita" expression="{$featureID_name_dita}"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
         </xsl:element>
         </xsl:element>
         <!--<ant antfile="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>-->
         <!--<ant antfile="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>-->
@@ -601,15 +683,53 @@
         <xsl:param name="loop_xpath_real" required="yes"/>
         <xsl:param name="loop_xpath_real" required="yes"/>
         <xsl:param name="xpath_dita"  required="yes"/>
         <xsl:param name="xpath_dita"  required="yes"/>
         <xsl:param name="xpath_value_dita" required="yes"/>
         <xsl:param name="xpath_value_dita" required="yes"/>
+        <xsl:param name="featureID_name_dita" required="yes"/>
         <!--<xsl:param name="loop_path_recurs" required="yes"/>-->
         <!--<xsl:param name="loop_path_recurs" required="yes"/>-->
         <!-- wygenerujemy liste ant -->
         <!-- wygenerujemy liste ant -->
         
         
         <xsl:comment>
         <xsl:comment>
-            #590 LOOP BEGIN</xsl:comment>
-        <echo> #523 RelatedFeatureLoop ant bede odpalac w podkatalogu:@xml_id=(<xsl:value-of select="@xml_id"/>) 
+            #590 LOOP BEGIN ;  @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>; </xsl:comment>
+        <echo> #523 RelatedFeatureLoop  @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>; ant bede odpalac w podkatalogu:@xml_id=(<xsl:value-of select="@xml_id"/>) 
             <xsl:value-of select="concat($temp,'/',@xml_id,'/',$uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.1.xml')"/> </echo>
             <xsl:value-of select="concat($temp,'/',@xml_id,'/',$uuid,'.build_',$loop_xpath,'_x2f_.',@xml_id,'.',substring-after(@typeName,':'),'.1.xml')"/> </echo>
         <xsl:message>#591 todo executing by exec instead of ant without inheritAll because it's looping!!! </xsl:message>
         <xsl:message>#591 todo executing by exec instead of ant without inheritAll because it's looping!!! </xsl:message>
         
         
+        
+        <echo>testuje czy sciagac node poprzez $xpath_query.xsl to <xsl:value-of select="concat('${builds_to_ant_file_test_xpath_query.xml',$loop_xpath_real,@xml_id,'}')"/></echo> 
+        <xsl:element name="tempfile">
+            <xsl:attribute name="property" select="concat('builds_to_ant_test_featureID_name_dita',$loop_xpath_real,@xml_id)"/>
+            <xsl:attribute name="deleteonexit" select="'no'"/>
+            <xsl:attribute name="destdir" select="$temp"/>
+            <xsl:attribute name="suffix" select="'.xml'"/>
+            <xsl:attribute name="prefix" select="concat('${uuid}.builds_to_ant-loop_test_featureID_name_dita',@xml_id,'-')"/>
+        </xsl:element>
+        
+        <xsl:element name="echoxml">
+            <xsl:attribute name="file" select="concat('${builds_to_ant_test_featureID_name_dita',$loop_xpath_real,@xml_id,'}')"/>
+            <xsl:element name="{$featureID_name_dita}">empty</xsl:element>
+        </xsl:element>
+        
+        <xsl:element name="tempfile">
+            <xsl:attribute name="property" select="concat('builds_to_ant_test_featureID_name_dita_out.xml',$loop_xpath_real,@xml_id)"/>
+            <xsl:attribute name="deleteonexit" select="'no'"/>
+            <xsl:attribute name="destdir" select="$temp"/>
+            <xsl:attribute name="suffix" select="'.xml'"/>
+            <xsl:attribute name="prefix" select="concat('${uuid}.builds_to_ant-loop_test_featureID_name_dita_out',@xml_id,'-')"/>
+        </xsl:element>
+        
+        <xsl:element name="xslt">
+            <xsl:attribute name="basedir" select="'./'"/>
+            <xsl:attribute name="style" select="$xpath_query.xsl"/>
+            <xsl:attribute name="in" select="concat('${builds_to_ant_test_featureID_name_dita',$loop_xpath_real,@xml_id,'}')"/>
+            <xsl:attribute name="destdir" select="'./'"/>
+            <xsl:attribute name="out" select="concat('${builds_to_ant_test_featureID_name_dita_out.xml',$loop_xpath_real,@xml_id,'}')"/>
+            <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="xpath_query_test"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <!--<param name="featureID_name_dita" expression="{$featureID_name_dita}"/>-->
+        </xsl:element>
+        
         <!-- Lista do wyzwolenia dzieci w podkalagach na bazie params-->
         <!-- Lista do wyzwolenia dzieci w podkalagach na bazie params-->
         
         
         
         
@@ -650,11 +770,15 @@
             </factory>
             </factory>
             <param name="temp" expression="{$temp}"/>
             <param name="temp" expression="{$temp}"/>
             <param name="loop_xpath_real" expression="{$loop_xpath_real}{@xml_id}"/>
             <param name="loop_xpath_real" expression="{$loop_xpath_real}{@xml_id}"/>
+            
             <!--<xsl:element name="param">
             <!--<xsl:element name="param">
                 <xsl:attribute name="name" select="'default_antfile'"/>
                 <xsl:attribute name="name" select="'default_antfile'"/>
                 <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
                 <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
             </xsl:element>-->
             </xsl:element>-->
             <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
             <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
+            <param name="xpath_query" expression="{$xpath_query}"/>
+            <param name="xpath_query.xsl" expression="{$xpath_query.xsl}"/>
+            <param name="featureID_name_dita" expression="{$featureID_name_dita}"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
         </xsl:element>
         </xsl:element>
         
         
@@ -688,6 +812,7 @@
         <xsl:param name="loop_xpath_real" required="yes"/>
         <xsl:param name="loop_xpath_real" required="yes"/>
         <xsl:param name="xpath_dita"  required="yes"/>
         <xsl:param name="xpath_dita"  required="yes"/>
         <xsl:param name="xpath_value_dita" required="yes"/>
         <xsl:param name="xpath_value_dita" required="yes"/>
+        <xsl:param name="featureID_name_dita" required="yes"/>
         <!--<xsl:param name="loop_path_recurs" required="yes"/>-->
         <!--<xsl:param name="loop_path_recurs" required="yes"/>-->
         <xsl:apply-templates mode="place_subant">
         <xsl:apply-templates mode="place_subant">
             <xsl:with-param name="uuid" select="$uuid"/>
             <xsl:with-param name="uuid" select="$uuid"/>
@@ -695,6 +820,7 @@
             <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
             <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
             <xsl:with-param name="xpath_dita"  select="$xpath_dita"/>
             <xsl:with-param name="xpath_dita"  select="$xpath_dita"/>
             <xsl:with-param name="xpath_value_dita"  select="$xpath_value_dita"/>
             <xsl:with-param name="xpath_value_dita"  select="$xpath_value_dita"/>
+            <xsl:with-param name="featureID_name_dita" select="$featureID_name_dita"/>
             <!--<xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>-->
             <!--<xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>-->
         </xsl:apply-templates>
         </xsl:apply-templates>
     </xsl:template>
     </xsl:template>
@@ -848,6 +974,10 @@
                                             <param name="cookie_curl_option" expression="{$cookie_curl_option}"/>
                                             <param name="cookie_curl_option" expression="{$cookie_curl_option}"/>
                                             <param name="api_url" expression="{$api_url}"/>
                                             <param name="api_url" expression="{$api_url}"/>
                                             <param name="loop_path_recurs" expression="{$loop_path_recurs}"/>
                                             <param name="loop_path_recurs" expression="{$loop_path_recurs}"/>
+                                            <param name="ignore_maxOccurs_0" expression="{$ignore_maxOccurs_0}"/>
+                                            <param name="xpath_query" expression="{$xpath_query}"/>
+                                            <param name="xpath_query.xsl" expression="{$xpath_query.xsl}"/>
+                                            <param name="empty.xml" expression="{$empty.xml}"/>
                                     </xslt>
                                     </xslt>
                             </xsl:element>
                             </xsl:element>
                         <!-- zapisujemy wynik naszego biezacego przetwarzania dita element nizej do kolejnego przejechania z ant wyniku dla podstawienia danych  -->
                         <!-- zapisujemy wynik naszego biezacego przetwarzania dita element nizej do kolejnego przejechania z ant wyniku dla podstawienia danych  -->
@@ -1098,27 +1228,50 @@
                 <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
                 <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
             </xsl:choose>
             </xsl:choose>
         </xsl:variable>-->
         </xsl:variable>-->
-        <xsl:message>#389  jest okazja do zrobienia bilda $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>;  result-document=<xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'.xml')"/> match=RelatedFeature mode=after_first_ant_assing_vars_childs  </xsl:message>
-        <xsl:result-document href="{$temp}/{$uuid}.build_{$loop_xpath}.{$feature_pos}.xml">
-            <xsl:apply-templates select=".">
-                <xsl:with-param name="typeName" select="@typeName"/>
-                <xsl:with-param name="xpath" select="@xpath"/>
-                <xsl:with-param name="xpath_value" select="@xpath_value"/>
-                <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
-                <xsl:with-param name="input_obj_with_xpath"  select="$input_obj_with_xpath"/>
-                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-                <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
-                <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
-                <xsl:with-param name="feature_pos"   select="$feature_pos"/>
-                <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
-                <!--<xsl:with-param name="wfs_output.xml" />-->
-            </xsl:apply-templates>
-        </xsl:result-document>
-        <xsl:element name="RelatedFeature">
-            <xsl:copy-of select="@*"/>
-            <xsl:attribute name="featureID_name" select="$featureID_name"/>
-            <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
-        </xsl:element>
+        <xsl:variable name="test_xpath_query">
+            <xsl:call-template name="test_xpath_query">
+                <xsl:with-param name="featureID_name_dita" select="$featureID_name"/>
+                <xsl:with-param name="ignore_maxOccurs_0" select="$ignore_maxOccurs_0"/>
+                <xsl:with-param name="system_cache__appinfo:maxOccurs" select="@system_cache__appinfo:maxOccurs"/>
+                <xsl:with-param name="xpath_query" select="$xpath_query"/>
+            </xsl:call-template>
+        </xsl:variable>
+        
+        <xsl:choose>
+            <xsl:when test="$test_xpath_query='1'">
+                <xsl:message>#389  jest okazja do zrobienia bilda $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>;  result-document=<xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'.xml')"/> match=RelatedFeature mode=after_first_ant_assing_vars_childs  </xsl:message>
+                <xsl:result-document href="{$temp}/{$uuid}.build_{$loop_xpath}.{$feature_pos}.xml">
+                    <xsl:apply-templates select=".">
+                        <xsl:with-param name="typeName" select="@typeName"/>
+                        <xsl:with-param name="xpath" select="@xpath"/>
+                        <xsl:with-param name="xpath_value" select="@xpath_value"/>
+                        <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
+                        <xsl:with-param name="input_obj_with_xpath"  select="$input_obj_with_xpath"/>
+                        <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                        <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
+                        <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
+                        <xsl:with-param name="feature_pos"   select="$feature_pos"/>
+                        <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
+                        <!--<xsl:with-param name="wfs_output.xml" />-->
+                    </xsl:apply-templates>
+                </xsl:result-document>
+                <xsl:element name="RelatedFeature">
+                    <xsl:copy-of select="@*"/>
+                    <xsl:attribute name="featureID_name" select="$featureID_name"/>
+                    <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="no">#389b
+                    #
+                    #
+                    #
+                    BYPASSED BY $test_xpath_query=<xsl:value-of select="$test_xpath_query"/>;  jest okazja do zrobienia bilda $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>;  result-document=<xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'.xml')"/> match=RelatedFeature mode=after_first_ant_assing_vars_childs 
+                    #
+                    #</xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+        
     </xsl:template>
     </xsl:template>
     
     
     
     
@@ -1151,26 +1304,47 @@
                 <xsl:otherwise><xsl:value-of select="concat($loop_path_recurs,'/',@xml_id,'.',$uuid,'.',$feature_pos)"/></xsl:otherwise>
                 <xsl:otherwise><xsl:value-of select="concat($loop_path_recurs,'/',@xml_id,'.',$uuid,'.',$feature_pos)"/></xsl:otherwise>
             </xsl:choose>
             </xsl:choose>
         </xsl:variable>
         </xsl:variable>
-        <xsl:result-document href="{$temp}/{@xml_id}.{$uuid}.{$feature_pos}/build_root.xml" >
-            <xsl:apply-templates select=".">
-                <xsl:with-param name="typeName" select="@typeName"/>
-                <xsl:with-param name="xpath" select="@xpath"/>
-                <xsl:with-param name="xpath_value" select="@xpath_value"/>
-                <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
-                <xsl:with-param name="input_obj_with_xpath"  select="$input_obj_with_xpath"/>
-                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-                <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
-                <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
-                <xsl:with-param name="feature_pos"   select="$feature_pos"/>
-                <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
-                <!--<xsl:with-param name="wfs_output.xml" />-->
-            </xsl:apply-templates>
-        </xsl:result-document>
-        <xsl:element name="RelatedFeatureLoop">
-            <xsl:copy-of select="@*"/>
-            <xsl:attribute name="featureID_name" select="$featureID_name"/>
-            <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
-        </xsl:element>
+        <xsl:variable name="test_xpath_query">
+            <xsl:call-template name="test_xpath_query">
+                <xsl:with-param name="featureID_name_dita" select="$featureID_name"/>
+                <xsl:with-param name="ignore_maxOccurs_0" select="$ignore_maxOccurs_0"/>
+                <xsl:with-param name="system_cache__appinfo:maxOccurs" select="@system_cache__appinfo:maxOccurs"/>
+                <xsl:with-param name="xpath_query" select="$xpath_query"/>
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="$test_xpath_query='1'">
+            <xsl:result-document href="{$temp}/{@xml_id}.{$uuid}.{$feature_pos}/build_root.xml" >
+                <xsl:apply-templates select=".">
+                    <xsl:with-param name="typeName" select="@typeName"/>
+                    <xsl:with-param name="xpath" select="@xpath"/>
+                    <xsl:with-param name="xpath_value" select="@xpath_value"/>
+                    <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath"/>-->
+                    <xsl:with-param name="input_obj_with_xpath"  select="$input_obj_with_xpath"/>
+                    <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                    <xsl:with-param name="wfs_output" select="concat($uuid,'.',$loop_xpath)" />
+                    <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
+                    <xsl:with-param name="feature_pos"   select="$feature_pos"/>
+                    <xsl:with-param name="loop_path_recurs" select="$loop_path_recurs"/>
+                    <!--<xsl:with-param name="wfs_output.xml" />-->
+                </xsl:apply-templates>
+            </xsl:result-document>
+            <xsl:element name="RelatedFeatureLoop">
+                <xsl:copy-of select="@*"/>
+                <xsl:attribute name="featureID_name" select="$featureID_name"/>
+                <xsl:attribute name="loop_xpath" select="$loop_xpath"/>
+            </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="no">#1263
+                    #
+                    #
+                    #
+                    BYPASSED BY $test_xpath_query=<xsl:value-of select="$test_xpath_query"/>;  jest okazja do zrobienia bilda $feature_pos=<xsl:value-of select="$feature_pos"/> $xml_id_parent=<xsl:value-of select="$xml_id_parent"/>; $xml_id=<xsl:value-of select="$xml_id"/>;  result-document=<xsl:value-of select="concat($uuid,'.build_',$loop_xpath,'.xml')"/> match=RelatedFeature mode=after_first_ant_assing_vars_childs 
+                    #
+                    #</xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
     </xsl:template>
     </xsl:template>
     
     
     <xsl:template match="text()" mode="after_first_ant_assing_vars_childs"/>
     <xsl:template match="text()" mode="after_first_ant_assing_vars_childs"/>
@@ -1235,4 +1409,22 @@
         </xsl:choose>
         </xsl:choose>
     </xsl:template>
     </xsl:template>
     
     
+    
+    <xsl:template name="test_xpath_query">
+        <!-- to verify if retrieve some node based on user requested tree limit filter -->
+        <xsl:param name="ignore_maxOccurs_0" required="yes"/>
+        <xsl:param name="xpath_query" required="yes"/>
+        <xsl:param name="featureID_name_dita" required="yes"/>
+        <xsl:param name="system_cache__appinfo:maxOccurs" required="yes"/>
+        <xsl:message>#1290 $system_cache__appinfo:maxOccurs=<xsl:value-of select="$system_cache__appinfo:maxOccurs"/>; $featureID_name_dita=<xsl:value-of select="$featureID_name_dita"/>; $xpath_query=<xsl:value-of select="$xpath_query"/>; </xsl:message>
+        <xsl:if test="$ignore_maxOccurs_0"><xsl:message terminate="no">#1344 test igrnore is true()=<xsl:value-of select="$ignore_maxOccurs_0"/>;</xsl:message></xsl:if>
+        <xsl:variable name="TestMaxOccurs">
+            <xsl:choose>
+                <xsl:when test="$system_cache__appinfo:maxOccurs='0' and $ignore_maxOccurs_0"></xsl:when>
+                <xsl:otherwise>1</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:value-of select="$TestMaxOccurs"/>
+    </xsl:template>
+    
 </xsl:stylesheet>
 </xsl:stylesheet>

+ 10 - 0
SE/schema/default_db_xml_cache.public/builds_to_ant.xsl

@@ -13,6 +13,8 @@
     <xsl:param name="default_antfile"/>
     <xsl:param name="default_antfile"/>
     <!--<xsl:param name="loop_xpath" required="yes"/>-->
     <!--<xsl:param name="loop_xpath" required="yes"/>-->
     <xsl:param name="loop_xpath_real" required="yes"/>
     <xsl:param name="loop_xpath_real" required="yes"/>
+    <xsl:param name="xpath_query" required="yes"/>
+    <xsl:param name="featureID_name_dita" required="yes"/>
     
     
     <xsl:template name="last_slash">
     <xsl:template name="last_slash">
         <xsl:param name="string" required="yes"/>
         <xsl:param name="string" required="yes"/>
@@ -50,6 +52,8 @@
                             #
                             #
                             #    
                             #    
                             builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
                             builds_to_ant - uruchomienie ANT w parallel  temp/<xsl:value-of select="."/>;
+                            $xpath_query=<xsl:value-of select="$xpath_query"/>;
+                            $featureID_name_dita<xsl:value-of select="$featureID_name_dita"/>;
                             #
                             #
                             #
                             #
                         </echo>
                         </echo>
@@ -78,6 +82,8 @@
                                 #
                                 #
                                 #
                                 #
                                 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="."/>;
                                 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>
                             </echo>
@@ -112,6 +118,8 @@
                             #
                             #
                             #
                             #
                             builds_to_ant - PARALLEL RUN  za chwile uruchomie antfile  LOOP exec <xsl:value-of select="."/>/build_root.xml ;
                             builds_to_ant - PARALLEL RUN  za chwile uruchomie antfile  LOOP exec <xsl:value-of select="."/>/build_root.xml ;
+                            $xpath_query=<xsl:value-of select="$xpath_query"/>;
+                            $featureID_name_dita<xsl:value-of select="$featureID_name_dita"/>;
                             #
                             #
                             #
                             #
                         </echo>
                         </echo>
@@ -138,6 +146,8 @@
                                 #
                                 #
                                 #
                                 #
                                 builds_to_ant - za chwile uruchomie antfile  LOOP exec temp/<xsl:value-of select="."/>;
                                 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>
                             </echo>

+ 89 - 12
SE/schema/default_db_xml_cache.public/get_all_xsd.xsl

@@ -6,6 +6,14 @@
     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
     xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
     xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
     xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
     
     
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="procesy5_system_schema" select="'../default_db.instance.xml/transformed/procesy5_system_schema.xml'"/>
+    <xsl:param name="procesy5_system_schema_collection_dir" select="'../'"/>
+    <xsl:param name="cache" select="'refresh'"/>
+    <xsl:param name="targetNamespace_DEFAULTS" select="'http://biuro.biall-net.pl/xmlschema_procesy5/default_db'"/>
+    
     <xsl:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
     <xsl:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
     
     
     <xsl:function name="system_cache__appinfo:clean_object_prefix">
     <xsl:function name="system_cache__appinfo:clean_object_prefix">
@@ -52,11 +60,22 @@
     <xsl:template name="system_cache__appinfo:prefixed_object_info">
     <xsl:template name="system_cache__appinfo:prefixed_object_info">
         <xsl:param name="prefixed_object" required="yes"/>
         <xsl:param name="prefixed_object" required="yes"/>
         <xsl:variable name="prefix_token" select="tokenize(system_cache__appinfo:translate_object_escaped_prefix_from_string($prefixed_object),':')"/>
         <xsl:variable name="prefix_token" select="tokenize(system_cache__appinfo:translate_object_escaped_prefix_from_string($prefixed_object),':')"/>
-        <system_cache__appinfo:prefixed_object_info>
-            <xsl:attribute name="prefix" select="$prefix_token[1]"/>
-            <xsl:attribute name="name" select="$prefix_token[2]"/>
-            <xsl:attribute name="element" select="$prefix_token[3]"/>
-        </system_cache__appinfo:prefixed_object_info>
+        <xsl:choose>
+            <xsl:when test=" string-length($prefix_token[3]) &gt; 0">
+                <system_cache__appinfo:prefixed_object_info>
+                    <xsl:attribute name="prefix" select="$prefix_token[1]"/>
+                    <xsl:attribute name="name" select="$prefix_token[2]"/>
+                    <xsl:attribute name="element" select="$prefix_token[3]"/>
+                </system_cache__appinfo:prefixed_object_info>
+            </xsl:when>
+            <xsl:otherwise>
+                <system_cache__appinfo:prefixed_object_info>
+                    <xsl:attribute name="prefix" select="$prefix_token[1]"/>
+                    <xsl:attribute name="name" select="$prefix_token[2]"/>
+                    <xsl:attribute name="element" select="$prefix_token[2]"/>
+                </system_cache__appinfo:prefixed_object_info>
+            </xsl:otherwise>
+        </xsl:choose>
     </xsl:template>
     </xsl:template>
    
    
     <!-- @2016-08 funkcje do wykrywania  prefixow, namespace itp itd... 
     <!-- @2016-08 funkcje do wykrywania  prefixow, namespace itp itd... 
@@ -75,7 +94,7 @@
     <xsl:function name="system_cache__appinfo:targetNamespace_from_prefix">
     <xsl:function name="system_cache__appinfo:targetNamespace_from_prefix">
         <xsl:param name="system_cache__appinfo:vrtfNamespaces" required="yes"/>
         <xsl:param name="system_cache__appinfo:vrtfNamespaces" required="yes"/>
         <xsl:param name="prefix" required="yes"/>
         <xsl:param name="prefix" required="yes"/>
-        <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces/ns[@prefix=$prefix][1]/@uri" xpath-default-namespace=""/>
+        <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces//ns[@prefix=$prefix][1]/@uri" xpath-default-namespace=""/>
     </xsl:function>
     </xsl:function>
     
     
     
     
@@ -103,9 +122,9 @@
     </xsl:template>
     </xsl:template>
     
     
     <xsl:template name="system_cache__appinfo:get_all_xsd">
     <xsl:template name="system_cache__appinfo:get_all_xsd">
-        <xsl:param name="path2collection" select="'../default_objects/'"/> 
+        <xsl:param name="path2collection" select="$procesy5_system_schema_collection_dir"/> 
         <xsl:param name="get_system_schemas"/>
         <xsl:param name="get_system_schemas"/>
-        <xsl:param name="cache" select="'read'"/>
+        <xsl:param name="cache" select="$cache"/>
         <xsl:variable name="element-filename" select="'procesy5_system_schema'"/>
         <xsl:variable name="element-filename" select="'procesy5_system_schema'"/>
         <xsl:choose>
         <xsl:choose>
             <xsl:when test="unparsed-text-available(concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')) and $cache='read'">
             <xsl:when test="unparsed-text-available(concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')) and $cache='read'">
@@ -159,9 +178,9 @@
                       </system_cache__appinfo:get_all_xsd>
                       </system_cache__appinfo:get_all_xsd>
                   </system_cache__appinfo:get_all_xsd_list>
                   </system_cache__appinfo:get_all_xsd_list>
                 </xsl:variable>
                 </xsl:variable>
-                <xsl:result-document href="{concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')}">
+                <!--<xsl:result-document href="{concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')}">
                     <xsl:copy-of select="$procesy5_system_schema"/>
                     <xsl:copy-of select="$procesy5_system_schema"/>
-                </xsl:result-document>
+                </xsl:result-document>-->
                 <xsl:copy-of select="$procesy5_system_schema"></xsl:copy-of>
                 <xsl:copy-of select="$procesy5_system_schema"></xsl:copy-of>
             </xsl:otherwise>
             </xsl:otherwise>
         </xsl:choose>          
         </xsl:choose>          
@@ -170,8 +189,8 @@
     <xsl:template name="system_cache__appinfo:vrtfNamespaces">
     <xsl:template name="system_cache__appinfo:vrtfNamespaces">
         <xsl:variable name="procesy5_system_schema">
         <xsl:variable name="procesy5_system_schema">
             <xsl:call-template name="system_cache__appinfo:get_all_xsd">
             <xsl:call-template name="system_cache__appinfo:get_all_xsd">
-                <xsl:with-param name="path2collection" select="'../'"/>
-                <xsl:with-param name="cache" select="'read'"></xsl:with-param>
+                <xsl:with-param name="path2collection" select="$procesy5_system_schema_collection_dir"/>
+                <xsl:with-param name="cache" select="'read'"/>
             </xsl:call-template>
             </xsl:call-template>
         </xsl:variable>
         </xsl:variable>
         <xsl:for-each select="$procesy5_system_schema//schema/namespace::node()"
         <xsl:for-each select="$procesy5_system_schema//schema/namespace::node()"
@@ -180,6 +199,64 @@
         </xsl:for-each>
         </xsl:for-each>
     </xsl:template>
     </xsl:template>
     
     
+    <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:vrtfNamespaces">
+        <system_cache__appinfo:vrtfNamespaces>
+            <xsl:for-each select="//schema/namespace::node()"
+                xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
+            </xsl:for-each>
+        </system_cache__appinfo:vrtfNamespaces>
+    </xsl:template>
+    
+    
+    <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:element_complexType">
+        <xsl:param name="targetNamespace" select="$targetNamespace_DEFAULTS"/>    
+            <system_cache__appinfo:element_complexType>
+                <xsl:for-each select="get_all_xsd[ substring-before(@system_cache__appinfo:document-uri,'/')!='default_db_xml_cache'  and  substring-before(@system_cache__appinfo:document-uri,'/')!='default_db_xml_cache.public']" xpath-default-namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
+                    <xsl:variable name="get_all_xsd_236" select="."/>
+                    <xsl:comment>
+                        246:detect_resource_type, przetwarzam schemat:<xsl:value-of select="@system_cache__appinfo:document-uri"/>; $targetNamespace:<xsl:value-of select="$targetNamespace"/>;
+                        @targetNamespace:<xsl:value-of select="schema/@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;</xsl:comment>
+                    <xsl:variable name="schema_node_144" select="."/>
+                    <xsl:for-each select="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!--[ @targetNamespace != $targetNamespace ] namespace::node() = $targetNamespace   and @targetNamespace='moj_ogrodek' -->
+                        <xsl:message>239::detect_resource_type przetwarzam schemat:@targetNamespace:<xsl:value-of select="@targetNamespace"/>;</xsl:message>
+                        <xsl:variable name="prefix_83" select="namespace::node()[. = $targetNamespace]/name()"/>
+                        <xsl:variable name="targetNamespace_134" select="@targetNamespace"/>
+                        <xsl:variable name="prefix_134" select="namespace::node()[. = $targetNamespace_134][1]/name()"/><!-- np. test_objects -->
+                        <xsl:if test="not(@targetNamespace) or not($prefix_134) ">
+                            <xsl:message terminate="yes">#394 ERROR - schema error - set @targetNamespace and prefix for shema file:<xsl:value-of select="../@system_cache__appinfo:document-uri-full"/> ; </xsl:message>
+                        </xsl:if>
+                        <xsl:if test="count(.//node()[(local-name()='element' or local-name()='complexType' or local-name()='sequence' or local-name()='choice' or local-name()='complexContent' or local-name()='extension' ) and not(@id)])=0">
+                                <xsl:for-each select="(element|complexType)"  xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!-- dla ograniczenia mozna [$prefix_134='test_objects']-->
+                                    <xsl:variable name="complexType_or_element_name186">
+                                        <xsl:choose>
+                                            <xsl:when test="local-name()='element'"><xsl:value-of select="@name"/></xsl:when>
+                                            <xsl:when test="local-name()='complexType'"><xsl:value-of select="@name"/></xsl:when>
+                                            <xsl:otherwise><xsl:message terminate="yes">#391 it should work only for element or complexType</xsl:message></xsl:otherwise>
+                                        </xsl:choose>
+                                    </xsl:variable>
+                                    <xsl:comment>157: buduje plaski obiekt/mape przetwarzania w celu przeszukania relacji @id:<xsl:value-of select="@id"/>; targetNamespace:<xsl:value-of select="$prefix_134"/>; $complexType_or_element_name186:<xsl:value-of select="$complexType_or_element_name186"/>; name:<xsl:value-of select="@name"/>; namespace-uri-for-prefix:<xsl:value-of select="namespace-uri-for-prefix($prefix_134,.)"/></xsl:comment>
+                                    <xsl:message>157: buduje plaski obiekt/mape przetwarzania w celu przeszukania relacji @id:<xsl:value-of select="@id"/>; targetNamespace:<xsl:value-of select="$prefix_134"/>; $complexType_or_element_name186:<xsl:value-of select="$complexType_or_element_name186"/>; name:<xsl:value-of select="@name"/>; namespace-uri-for-prefix:<xsl:value-of select="namespace-uri-for-prefix($prefix_134,.)"/></xsl:message>
+                                    <xsl:choose>
+                                        <xsl:when test="local-name()='element'">
+                                            <build_cache name="build_element">
+                                                <with-param name="element" select="{$prefix_134}:{$complexType_or_element_name186}"/>
+                                            </build_cache>
+                                        </xsl:when>
+                                        <xsl:when test="local-name()='complexType'">
+                                            <build_cache name="build_complexType">
+                                                <with-param name="complexType"
+                                                    select="{$prefix_134}:{$complexType_or_element_name186}"/>
+                                            </build_cache>
+                                        </xsl:when>
+                                    </xsl:choose>
+                              </xsl:for-each>
+                        </xsl:if>
+                    </xsl:for-each>
+                </xsl:for-each>
+            </system_cache__appinfo:element_complexType>
+    </xsl:template>
+    
     
     
     <!-- do aktualizowania pozycji w schemache-->
     <!-- do aktualizowania pozycji w schemache-->
     <xsl:template name="system_cache__appinfo:position">
     <xsl:template name="system_cache__appinfo:position">

+ 68 - 4
SE/schema/default_db_xml_cache.public/main_build_recurse_ant.dita_with_id.xsl

@@ -18,6 +18,8 @@
     <xsl:param name="namespace_prefix"  required="yes"/>
     <xsl:param name="namespace_prefix"  required="yes"/>
     <xsl:param name="detect_resource_type_dir" required="yes"/><!-- do okreslania dziedziczen i weryfikacji ich i uproszczenia poczatkowego dla pracy na bazowych obiektach -->
     <xsl:param name="detect_resource_type_dir" required="yes"/><!-- do okreslania dziedziczen i weryfikacji ich i uproszczenia poczatkowego dla pracy na bazowych obiektach -->
     <xsl:param name="build_complexType_dir" required="yes"/><!-- do okreslenia filtrow wymaganych typow na bazie simpletype -->
     <xsl:param name="build_complexType_dir" required="yes"/><!-- do okreslenia filtrow wymaganych typow na bazie simpletype -->
+    <xsl:param name="p5_tr_map_dir" select="'../default_db.instance.xml/p5_tr_map'"/>
+    <xsl:param name="simpleSchema_dir" select="'../default_db.instance.xml/simpleSchema'"/>
     <!--<xsl:param name="typeName" required="yes"/> - nie dziala to przekazanie tedy - trzeba czekac na _434 --> <!-- do przekazania glownego elementu do wykrycia glownie buildComplexType dla filtrow, w kolejnych zaglebieniach jada po @ref -->
     <!--<xsl:param name="typeName" required="yes"/> - nie dziala to przekazanie tedy - trzeba czekac na _434 --> <!-- do przekazania glownego elementu do wykrycia glownie buildComplexType dla filtrow, w kolejnych zaglebieniach jada po @ref -->
     <xsl:output indent="yes" />
     <xsl:output indent="yes" />
     <xsl:strip-space elements="*"/>
     <xsl:strip-space elements="*"/>
@@ -51,6 +53,34 @@
         <xsl:param name="parent_type" required="yes"/> <!-- parent_type="default_db__x3A__CRM_PROCES:CRM_PROCES"  -->
         <xsl:param name="parent_type" required="yes"/> <!-- parent_type="default_db__x3A__CRM_PROCES:CRM_PROCES"  -->
     </xsl:function>
     </xsl:function>
     
     
+    
+    <xsl:template match="system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_objects_parent_relations" mode="system_cache__resources_tree_generate_xsl_required_occurs_raport:build_simpleSchema_for_recurse_ant">
+        <system_cache__resources_tree_generate_xsl_required_occurs_raport:build_simpleSchema_for_recurse_ant>
+        <xsl:message>#58 i match system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_objects_parent_relations </xsl:message>
+        <xsl:apply-templates mode="system_cache__resources_tree_generate_xsl_required_occurs_raport:build_simpleSchema_for_recurse_ant"/>    
+        </system_cache__resources_tree_generate_xsl_required_occurs_raport:build_simpleSchema_for_recurse_ant>
+    </xsl:template>
+    
+    <xsl:template match="system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type[@local-name='element']" mode="system_cache__resources_tree_generate_xsl_required_occurs_raport:build_simpleSchema_for_recurse_ant">
+        <xsl:message>
+            ######63 i match <xsl:value-of select="@name"/> #### 
+        </xsl:message>
+        <xsl:variable name="prefixed_object_info">
+            <xsl:call-template name="system_cache__appinfo:prefixed_object_info">
+                <xsl:with-param name="prefixed_object" select="@name"/>
+            </xsl:call-template>
+        </xsl:variable>
+        
+        <xsl:variable name="p5_tr_map" select="doc(concat($p5_tr_map_dir,'/',$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@prefix,'/',$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@element,'.xml'))"/>
+        <xsl:result-document href="{$simpleSchema_dir}/{$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@prefix}/{$prefixed_object_info/system_cache__appinfo:prefixed_object_info/@element}.xml">
+            <xsl:apply-templates select="$p5_tr_map"/>
+        </xsl:result-document>
+    </xsl:template>
+    
+    <xsl:template match="system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type[not(@local-name='element')]" mode="system_cache__resources_tree_generate_xsl_required_occurs_raport:build_simpleSchema_for_recurse_ant">
+        <xsl:message>#76 bypassed <xsl:value-of select="@name"/>;</xsl:message>
+    </xsl:template>
+    
     <xsl:template match="p5_tr_map:go_recurse_from_root_by_build_element">
     <xsl:template match="p5_tr_map:go_recurse_from_root_by_build_element">
         <!--<xsl:variable name="detect_resource_type" select=" system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type_from_cache(@system_cache__appinfo:ref)"/>-->
         <!--<xsl:variable name="detect_resource_type" select=" system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type_from_cache(@system_cache__appinfo:ref)"/>-->
         <RelatedFeature>
         <RelatedFeature>
@@ -62,7 +92,7 @@
                 <!-- spokojnie po 434 mozna wykryc @parent_type = default_db__x3A__CRM_PROCES:PROCES - powinno byc childem - jak nie to todo! -->
                 <!-- spokojnie po 434 mozna wykryc @parent_type = default_db__x3A__CRM_PROCES:PROCES - powinno byc childem - jak nie to todo! -->
             <xsl:variable name="prefixed_object_info">
             <xsl:variable name="prefixed_object_info">
                 <xsl:call-template name="system_cache__appinfo:prefixed_object_info">
                 <xsl:call-template name="system_cache__appinfo:prefixed_object_info">
-                    <xsl:with-param name="prefixed_object" select="p5_tr_map:go_recurse_from_root_by_build_element_434/@parent_type"/>
+                    <xsl:with-param name="prefixed_object" select="(p5_tr_map:go_recurse_from_root_by_build_element_434|p5_tr_map:go_recurse_from_root_by_build_element_434er)/@parent_type"/>
                 </xsl:call-template>
                 </xsl:call-template>
             </xsl:variable>
             </xsl:variable>
             
             
@@ -86,10 +116,10 @@
         </RelatedFeature>
         </RelatedFeature>
     </xsl:template>
     </xsl:template>
     
     
-    <xsl:template match="p5_tr_map:go_recurse_from_root_by_build_element_434|p5_tr_map:go_recurse_from_root_by_build_element_434b"><!-- tu wykrywamy nazwe elementu z @parent_type = default_db__x3A__CRM_PROCES:CRM_PROCES -->
+    <xsl:template match="p5_tr_map:go_recurse_from_root_by_build_element_434|p5_tr_map:go_recurse_from_root_by_build_element_434b|p5_tr_map:go_recurse_from_root_by_build_element_434er"><!-- tu wykrywamy nazwe elementu z @parent_type = default_db__x3A__CRM_PROCES:CRM_PROCES -->
         <xsl:param name="build_complexType" required="yes"/>
         <xsl:param name="build_complexType" required="yes"/>
         <!--<xsl:variable name="build_complexType" select="doc(concat($build_complexType_dir,'/element-',system_cache__appinfo:escape_object_prefix_to_string(@parent_type),'.xml'))"/>-->
         <!--<xsl:variable name="build_complexType" select="doc(concat($build_complexType_dir,'/element-',system_cache__appinfo:escape_object_prefix_to_string(@parent_type),'.xml'))"/>-->
-        <xsl:message>#72 434 for <xsl:value-of select="@parent_type"/>; opening=<xsl:value-of select="concat($build_complexType_dir,'/element-',system_cache__appinfo:escape_object_prefix_to_string(@parent_type),'.xml')"/>; </xsl:message>
+        <xsl:message>#72 434 for <xsl:value-of select="@parent_type"/>; <xsl:copy-of select="@*"/></xsl:message>
         <xsl:apply-templates>
         <xsl:apply-templates>
             <xsl:with-param name="build_complexType" select="$build_complexType"/>
             <xsl:with-param name="build_complexType" select="$build_complexType"/>
         </xsl:apply-templates>
         </xsl:apply-templates>
@@ -110,7 +140,7 @@
         </xsl:apply-templates>
         </xsl:apply-templates>
     </xsl:template>
     </xsl:template>
     
     
-    <xsl:template match="p5_tr_map:go_recurse_from_root_by_build_element_4942"><!-- dziedziczenia dodatkowe -->
+    <xsl:template match="p5_tr_map:go_recurse_from_root_by_build_element_4942|p5_tr_map:go_recurse_from_root_by_build_element_4941"><!-- dziedziczenia dodatkowe -->
         <xsl:param name="build_complexType" required="yes"/>
         <xsl:param name="build_complexType" required="yes"/>
         <xsl:apply-templates>
         <xsl:apply-templates>
             <xsl:with-param name="build_complexType" select="$build_complexType"/>
             <xsl:with-param name="build_complexType" select="$build_complexType"/>
@@ -140,6 +170,9 @@
             <xsl:attribute name="xml_id" select="generate-id()"/>
             <xsl:attribute name="xml_id" select="generate-id()"/>
                  <!-- tymczasowe wymuszenie relacji do obiektu glownego na podstawie $detect_resource_type -->
                  <!-- tymczasowe wymuszenie relacji do obiektu glownego na podstawie $detect_resource_type -->
                  <!-- <xsl:attribute name="typeName" select="p5_tr_map:force_local_typeName(@system_cache__appinfo:ref)"/>-->
                  <!-- <xsl:attribute name="typeName" select="p5_tr_map:force_local_typeName(@system_cache__appinfo:ref)"/>-->
+            <xsl:if test="string-length($detect_resource_type//system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type/@system_cache__appinfo:get_default_db_obj_url_table_name) = 0">
+                <xsl:message terminate="yes">#174 Bad not found expected for <xsl:value-of select="@system_cache__appinfo:ref"/>; @system_cache__appinfo:get_default_db_obj_url_table_name ! </xsl:message>
+            </xsl:if>
                  <xsl:attribute name="typeNameRealResource" select="concat($namespace_prefix,':',$detect_resource_type//system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type/@system_cache__appinfo:get_default_db_obj_url_table_name)" />
                  <xsl:attribute name="typeNameRealResource" select="concat($namespace_prefix,':',$detect_resource_type//system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type/@system_cache__appinfo:get_default_db_obj_url_table_name)" />
             <xsl:attribute name="typeName" select="concat($namespace_prefix,':',substring-after(@system_cache__appinfo:ref,':'))"/> 
             <xsl:attribute name="typeName" select="concat($namespace_prefix,':',substring-after(@system_cache__appinfo:ref,':'))"/> 
                 <!--<xsl:attribute name="xpath" select="@flat_relation_cache_name"/>-->
                 <!--<xsl:attribute name="xpath" select="@flat_relation_cache_name"/>-->
@@ -278,6 +311,37 @@
         </xsl:element>
         </xsl:element>
     </xsl:template>
     </xsl:template>
     
     
+    <xsl:template match="p5_tr_map:go_recurse_from_root_by_build_element_477b"> <!-- comment="477b uzyty ComplexType bez @ref w elemencie - symulacja pobrania elementu jak z @ref i musi miec REMOTE_ID" -->
+        <xsl:param name="build_complexType" required="yes"/> <!-- trzeba przekazac jaki element root jest tworzony dla wlasciwego sciagniecia definicji filtru simpleType -->
+        <xsl:variable name="element-name">
+            <xsl:choose>
+                <xsl:when test="@local-name-name"><xsl:value-of select="@local-name-name"/></xsl:when>
+                <xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <!--<xsl:variable name="simpleType" select="doc(concat( $build_complexType_dir,'/',p5_tr_map:force_local_typeName($)))"/>-->
+        
+        <xsl:message>#320 type 477  try to name element <xsl:value-of select="$element-name"/>; TODO maintain @type=ComplexType like the_geom!!! </xsl:message>
+        <xsl:element name="{$element-name}">
+            <xsl:apply-templates select="@*">
+                <xsl:with-param name="element" select="name()"/>
+                <xsl:with-param name="node" select="."/>
+            </xsl:apply-templates>
+            <!--<xsl:copy-of select="@*"/>-->
+            <xsl:choose>
+                <!-- <xsl:when test="@system_cache__appinfo:id">
+                    <xsl:attribute name="xml_id" select="@system_cache__appinfo:id"/>
+                </xsl:when>-->
+                <xsl:when test="1=2"/>
+                <xsl:otherwise>
+                    <xsl:attribute name="xml_id" select="generate-id()"/>
+                </xsl:otherwise>
+            </xsl:choose>
+            <!--<xsl:attribute name="xml_id" select="generate-id()"/>-->
+            <!--<xsl:apply-templates/>-->
+        </xsl:element>
+    </xsl:template>
+    
     <xsl:template match="*">
     <xsl:template match="*">
         <xsl:variable name="element-name">
         <xsl:variable name="element-name">
             <xsl:value-of select="name()"/>
             <xsl:value-of select="name()"/>