Przeglądaj źródła

dzialajacy przyklad dla rozszerzajacych sie struktur

a.binder 9 lat temu
rodzic
commit
0db55eae94

+ 258 - 0
SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/build.xml

@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." name="PRINT_TEMPLATE" default="buildpdf_recursed"  >
+    
+    
+    
+    <!-- Przykładowe wyzwolenie z bash :
+    cat input.xml | /Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/ant -buildfile ild__IN7_DZIENNIK_KORESP.xml
+    na output mamy pdf'a
+    -->
+
+
+    <!-- https://biuro.biall-net.pl/SE/version-git/index.php?_route=UrlAction_Ant&_task=ant&path=default_db.in7_dziennik_koresp/test-druk&namespace=p5_default_db:IN7_DZIENNIK_KORESP&featureID=59682 -->
+    <!-- default procesy5 sample template is  file:/SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-get-wfs-xml/build.xml-->
+    <!-- sample URL which call this exact variables in this ANT build -->
+    <!-- przykladowy URL ktory przekazuje parametry do tego ANT -->
+    <!--https://biuro.biall-net.pl/SE/version-git/index.php?_route=UrlAction_Ant&_task=ant&
+        path=${default_db.in7_dziennik_koresp/test-get-wfs-xml} -  this is the place to keep ant build (directory name with build.xml)  
+        &namespace=p5_default_db:Rozdzielcza_test_bzyk_PE&featureID=123 - this is setting the 
+        <property name="url" value="${url}"/> - to point what is record/table to download
+        <property name="uuid" value="${uuid}"/> it is automatically also set to enable uinque transaction and to allow to save data with user
+        <property name="passwordBase64Basic" value="${passwordBase64Basic}"/> - this is also set - to enable communicate with API -
+        <property name="DwebRootUrl" value="${$webRootUrl}"/> - this is the place where script is localized to easyli to target user GUI by href to generated output      
+    />
+    -->
+    
+    
+    <!---DpasswordBase64Basic="xxxx=="
+        -DtypeName="p5_default_db:IN7_DZIENNIK_KORESP" 
+        -Dxpath=ID -Dxpath_value=1000 
+        -Duuid=1 -DwebRootUrl=somePathDir-->
+    <property name="temp" value="temp"/> <!-- temp files-->
+    <property name="out" value="out"/> <!-- output ready files like pdf -->
+    
+    <property name="uuid" value="${uuid}"/> <!--TODO-->
+    <property name="passwordBase64Basic" value="${passwordBase64Basic}"/>
+    <property name="url" value="${url}"/>
+    <property name="webRootUrl" value="${$webRootUrl}"/>
+
+
+    <property name="api_url" value="https://biuro.biall-net.pl/SE/version-git/wfs-data.php"/>
+    <property name="namespace_prefix" value="p5_default_db"/> <!-- ex: p5_default_db to complete after p5_default_db:IN7_DZIENNIK_KORESP -->
+    <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" value="${xpath_value}"/> <!-- to be set initially like 1000 (to search ID=1000, if ID we get by featureID  -->
+    
+    <!-- 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="build_recurse_ant.xsl" value="build_recurse_ant.xsl"/> <!-- ${default_db_xml_cache.public}/ -->
+    <property name="build_recurse_ant_merge_dita_from_temp.xsl" value="build_recurse_ant_merge_dita_from_temp.xsl"/> <!-- ${default_db_xml_cache.public}/ -->
+    <property name="builds_to_ant.xsl" value="builds_to_ant.xsl"/><!-- ${default_db_xml_cache.public}/ -->
+    
+    <property name="main_build_recurse_ant.dita" value="main_build_recurse_ant.dita"/>
+    <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"/>
+    <!--<tempfile property="uuid" deleteonexit="yes"/>-->
+    <tempfile property="out_task.dita" deleteonexit="no"  destdir="temp"/>
+    <tempfile property="out_task.dita.final" deleteonexit="no"  destdir="temp"/>
+    <!--<tempfile property="wfs_output" deleteonexit="no"  destdir="temp"  suffix=".xml" />-->
+    
+   
+    
+    <target name="install_folders">
+        <mkdir dir="${temp}"/>
+        <mkdir dir="${out}"/>
+        <chmod  dir="${temp}" perm="ugo+rwx"/>
+        <chmod  dir="${out}" perm="ugo+rwx"/>
+    </target>
+
+   
+    <target name="main_build_recurse_ant.dita_with_id">
+        <xslt basedir="./" style="${main_build_recurse_ant.dita_with_id.xsl}" in="${main_build_recurse_ant.dita}"  destdir="./" out="${main_build_recurse_ant.dita_with_id}" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+        </xslt>
+    </target>
+   
+   
+    <target name="clean_temp_dir" description="URL_TASK Target clean_temp_dir">
+        
+        
+        <delete>
+            <fileset dir="${temp}"/>
+        </delete>
+            
+        
+    </target>
+
+    <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
+    <target name="build_recurse_ant.xml" depends="main_build_recurse_ant.dita_with_id">
+        <!-- build do wytworzenia pierwszego przetworzenia zagniezdzen -->
+        
+        <record name="${temp}/ant.log" loglevel="verbose" append="true"/>
+        <property name="loop_xpath"  value="root"/>
+        <property name="build_recurse_ant.xml" value="${temp}/${uuid}.build_${loop_xpath}.xml"/>
+        <!--<delete file="${build_recurse_ant.xml}"/>-->
+        <xslt basedir="./" style="${build_recurse_ant.xsl}" in="${main_build_recurse_ant.dita_with_id}"  destdir="./" out="${build_recurse_ant.xml}"  >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            
+            <param name="build_recurse_ant.xsl" expression="${build_recurse_ant.xsl}"/>
+            <param name="passwordBase64Basic" expression="${passwordBase64Basic}"/>
+            <param name="url" expression="${url}" />
+            <param name="webRootUrl" expression="${webRootUrl}" /> 
+            <param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita_with_id}"/>
+            <param name="uuid" expression="${uuid}"/>
+            
+            <!--<param name="out_task.dita" expression="${out_task.dita}"/>-->
+            <!--<param name="wfs_output" expression=""/>-->
+            
+            <param name="api_url" expression="${api_url}"/>
+            <!--<param name="namespace_prefix" expression="${namespace_prefix}"/>--> 
+            <param name="typeName" expression="${typeName}"/> 
+            <param name="xpath" expression="${xpath}"/> <!-- to be set initially like as key to search ID  -->
+            <param name="xpath_value" expression="${xpath_value}"/> <!-- to be set initially like 1000 (to search ID=1000, if ID we get by featureID  -->
+            <param name="loop_xpath" expression="root"/><!-- xpath sciezki przetwarzania xmla -->
+            <param name="loop_xpath_save" expression="${loop_xpath}"/>
+            <param name="current_leaf.dita" expression="${main_build_recurse_ant.dita_with_id}"/>
+            <param name="basedir" expression="${basedir}"/>
+            <param name="build_recurse_ant.xsl" expression="${build_recurse_ant.xsl}"/>
+            <param name="temp" expression="${temp}"/>
+            <param name="builds_to_ant.xsl" expression="${builds_to_ant.xsl}"/>
+        </xslt>
+        <!--<import file="${build_recurse_ant.xml}"/>-->
+        <ant  antfile="${build_recurse_ant.xml}" dir="."/>
+        <!-- pozbierac wszystkie do kupy xmle  -->
+    </target>
+    
+    <target name="build_recurse_ant_merge_dita_from_temp.xsl" depends="build_recurse_ant.xml" description="z plikow temp/$uuid.* buduje $out_task.dita.final ">
+        <xslt basedir="./" style="${build_recurse_ant_merge_dita_from_temp.xsl}" in="${main_build_recurse_ant.dita_with_id}"  destdir="./" out="${out_task.dita.final}" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <!--<param name="webRootUrl" expression="${webRootUrl}" />--> 
+            <!--<param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita}"/>-->
+            <param name="uuid" expression="${uuid}"/>
+            <param name="basedir" expression="${basedir}"/>
+            <param name="temp" expression="${temp}"/>
+        </xslt>
+        <echo> zapisalem plik gotowy do utworzenia dita do ${out_task.dita}. </echo>
+    </target>
+
+
+    <!--<target name="get_related_feature">
+        <exec executable="curl"  output="${wfs_output}" errorproperty="wfs_error" resultproperty="wfs_result">
+            <arg line="-H 'Authorization: Basic ${passwordBase64Basic}' ${url}"/>
+        </exec>
+        <echo message="curl -H 'Authorization: Basic ${passwordBase64Basic}' '${url}'"/>
+        
+        <echo message="ERROR__START"/>
+        <echo message="${wfs_error}"/>
+        <echo> gues path of pdf is </echo>
+        <exec  executable="bash" dir="." outputproperty="url_of_current_script">
+             <arg value="-c"/>
+             <arg value="echo &quot;${url}&quot; |sed 's/[a-zA-Z0-9]*.php.*//'"/>
+        </exec>
+        <echo message="ERROR__END"/>
+        
+    </target>-->
+
+
+    <target name="buildpdf_recursed" depends="build_recurse_ant_merge_dita_from_temp.xsl">
+       
+        <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>
+        <exec executable="${dita.dir}" dir=".">
+            <arg value="-i"/>
+            <arg value="${out_task.dita.final}" />
+           <!-- <arg value="-t" />
+            <arg value="temp" />-->
+            <arg value="-f" />
+            <arg value="pdf"/>
+            <arg value="-o"/>
+            <arg value="out"/>
+        </exec>
+        <exec  executable="bash" dir="." outputproperty="out_task_file">
+            <arg value="-c"/>
+            <arg value="echo ${out_task.dita.final} |sed 's/^.*\///'"/>
+        </exec>
+        <echo message="OUTPUT__START"/>        
+        <!--<echo> url = ${url} 
+        </echo>-->
+        <!--<echo> passwordBase64Basic = ${passwordBase64Basic} 
+        </echo>-->
+        <!--<echo> $webRootUrl = ${webRootUrl} 
+        </echo>-->
+        <!--<echo> $wfs_output = ${wfs_output} 
+        </echo>-->
+        <echo>
+            &lt;br&gt;Wygenerowano druk pdf - sciagnij go &lt;a href=&quot;${webRootUrl}/out/${out_task_file}.pdf&quot;&gt; &quot;${webRootUrl}/out/${out_task_file}.pdf&lt;/a&gt;&lt;/br&gt; 
+        </echo>
+        <echo>
+            &lt;br&gt;Dodaj do korespondencji (W przygotowaniu)&lt;/br&gt; 
+        </echo>
+        <echo>
+            &lt;br&gt;Wyślij do adresatów emailem (W przygotowaniu)&lt;/br&gt; 
+        </echo>
+        <echo>
+            &lt;br&gt;Umieść swój podpis graficzny (W przygotowaniu)&lt;/br&gt; 
+        </echo>
+        <echo message="OUTPUT__END"/>
+        
+        
+    </target>
+
+
+    <!--<target name="buildpdf" depends="get_related_feature">
+        <xslt basedir="./" style="IN7_DZIENNIK_KORESP.xsl" in="${wfs_output}"  destdir="./" out="${out_task.dita.final}" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <!-\-<attribute name="http://saxon.sf.net/feature/initialMode" value="PROCES_INCLUDE"/>-\->
+                <!-\-<attribute name="http://saxon.sf.net/feature/initialTemplate" value="Types__x3A__xlsx__x3A__main"/>-\->
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="dita_task_template_file_param" expression="main.dita"/>
+        </xslt> 
+        <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>
+        <exec executable="${dita.dir}" dir=".">
+            <arg value="-i"/>
+            <arg value="${out_task.dita}" />
+            <arg value="-f" />
+            <arg value="pdf"/>
+            <arg value="-o"/>
+            <arg value="out"/>
+        </exec>
+        <exec  executable="bash" dir="." outputproperty="out_task_file">
+            <arg value="-c"/>
+            <arg value="echo ${out_task.dita} |sed 's/^.*\///'"/>
+        </exec>
+        <echo message="OUTPUT__START"/>        
+        <!-\-<echo> url = ${url} 
+        </echo>-\->
+        <!-\-<echo> passwordBase64Basic = ${passwordBase64Basic} 
+        </echo>-\->
+        <!-\-<echo> $webRootUrl = ${webRootUrl} 
+        </echo>-\->
+        <!-\-<echo> $wfs_output = ${wfs_output} 
+        </echo>-\->
+        <echo>
+            &lt;br&gt;Wygenerowano druk pdf - sciagnij go &lt;a href=&quot;${webRootUrl}/out/${out_task_file}.pdf&quot;&gt; &quot;${webRootUrl}/out/${out_task_file}.pdf&lt;/a&gt;&lt;/br&gt; 
+        </echo>
+        <echo>
+            &lt;br&gt;Dodaj do korespondencji (W przygotowaniu)&lt;/br&gt; 
+        </echo>
+        <echo>
+            &lt;br&gt;Wyślij do adresatów emailem (W przygotowaniu)&lt;/br&gt; 
+        </echo>
+        <echo>
+            &lt;br&gt;Umieść swój podpis graficzny (W przygotowaniu)&lt;/br&gt; 
+        </echo>
+        <echo message="OUTPUT__END"/>
+    </target>-->
+    
+    
+</project>

+ 693 - 0
SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/build_recurse_ant.xsl

@@ -0,0 +1,693 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:gml="http://www.opengis.net/gml" 
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:wfs="http://www.opengis.net/wfs"
+    xmlns:ogc="http://www.opengis.net/ogc"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output indent="yes" />
+    <xsl:strip-space elements="*"/>
+    
+    <!-- @2017-03-01 modyfikacja dla potrzeb CRM_PROCES_tree - sa bledy-->
+    
+    <xsl:include href="escaped_html_to_xml.xsl"/>
+    <!--
+    <property name="url" value="${url}"/> - to point what is record/table to download
+    <property name="uuid" value="${uuid}"/> it is automatically also set to enable uinque transaction and to allow to save data with user
+    <property name="passwordBase64Basic" value="${passwordBase64Basic}"/> - this is also set - to enable communicate with API -
+    <property name="DwebRootUrl" value="${$webRootUrl}"/> - this is the place where script is localized to easyli to target user GUI by href to generated output   -->
+    
+    <!-- variables to be set first by GUI first_request from executing API (php -> bash)-->
+    <xsl:param name="uuid" required="yes" /> <!-- pewnie bedziemy ignorowac i dzialac na bazie ${'wfs_output'} ktory juz jest tempfilem -->
+    <xsl:param name="passwordBase64Basic" required="yes" />
+    <xsl:param name="url" />
+    <xsl:param name="webRootUrl" /> 
+    <xsl:param name="basedir" required="yes"/> <!-- aktualny katalog gdzie znajduja sie pliki temp -->
+    
+    <!--<xsl:param name="out_task.dita"/>--> <!-- nazwa temp docelowego zrodla do wykonania pliku pdf -->
+    <!--<xsl:param name="current_leaf.dita" required="yes"/>--> <!-- nazwa aktualnego przetowarzenia .dita - najpierw main_build_recurse_ant.dita potem przechodzi w  1.1.root_x2f_IN7_DZIENNIK_KORESP.1.dita.xml -->
+    <!--<xsl:param name="wfs_output" select="concat('temp/wfs_output.',$uuid)"/>-->
+                    <!-- jak parametr jest to znaczy, ze przetwarzamy  -->
+    <xsl:param name="wfs_output" required="no"/> <!-- potem wfs_output.xml jak sciagnie nazwa temp sciagniecia z api xml forsowana przez pierwsze sciagniecie -->
+    <xsl:param name="api_url"  select="'https://biuro.biall-net.pl/SE/version-git/wfs-data.php'"/>
+    <!--<xsl:param name="namespace_prefix" select="'p5_default_db'"/>--> 
+    <xsl:param name="typeName" required="yes" />  <!-- to be set initially ex: p5_default_db:IN7_DZIENNIK_KORESP  -->
+    <xsl:param name="xpath" required="yes" />  <!-- to be set initially ex: ID  -->
+    <xsl:param name="xpath_value" required="yes" />  <!-- to be set ex: 1000 -->
+    <xsl:param name="loop_xpath" required="yes"/> <!-- sciezka do zapisywania xmli w przetwarzaniu plikow default root -->
+    <xsl:param name="loop_xpath_save" required="yes"/> <!-- przekazany z template  match="RelatedFeature" mode="after_first_ant_assing_vars_childs" -->
+    <!-- static project variables as default styles.dita/xsl and names-->
+    <xsl:param name="main_build_recurse_ant.dita" select="'main_build_recurse_ant.dita'"/>
+    
+    <xsl:param name="xml_id_parent" select="@xml_id"/>
+    <xsl:param name="build_recurse_ant.xsl" required="yes"/>
+    <xsl:param name="temp" select="'temp'"/>
+    <xsl:param name="builds_to_ant.xsl" required="yes"/>
+    <!-- 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:template match="*">
+        <xsl:param name="typeName"  select="$typeName" />
+        <xsl:param name="xpath" select="$xpath" />
+        <xsl:param name="xpath_value" select="$xpath_value" />
+        <xsl:param name="loop_xpath" select="$loop_xpath"/>
+        <xsl:param name="loop_xpath_save" select="$loop_xpath_save"/><!-- tutaj zapisal sie build z wezla z parent -->
+        <xsl:param name="input_obj_with_xpath" /> <!-- przekazany z template  match="RelatedFeature" mode="after_first_ant_assing_vars_childs" -->
+        <xsl:param name="feature_pos"  select="1"/> <!-- przekazany z  template  match="RelatedFeature" mode="after_first_ant_assing_vars_childs"-->
+        <xsl:choose>
+            <xsl:when test="name()='RelatedFeature'">
+                <xsl:variable name="RelatedFeatureCount" select="last()"/>
+                <xsl:variable name="RelatedFeaturePos" select="position()"/>
+                <xsl:variable name="featureID_name" select="substring-after($typeName,':')"/>
+                <xsl:message>#58 bylo $loop_xpath=<xsl:value-of select="$loop_xpath"/>; $basedir=<xsl:value-of select="$basedir"/>; </xsl:message>
+                <xsl:variable name="loop_xpath_real" select="$loop_xpath"/>
+                <xsl:variable name="loop_xpath">
+                    <xsl:choose>
+                        <xsl:when test="$loop_xpath='root'">
+                            <xsl:value-of select="concat($loop_xpath,'_x2f_.',@xml_id,'.',$featureID_name)"/>
+                        </xsl:when>
+                        <xsl:otherwise><xsl:value-of select="$loop_xpath"/></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:variable name="typeName_dita" select="@typeName"/>
+                <xsl:variable name="featureID_name_dita" select="substring-after($typeName_dita,':')"/>
+                <xsl:variable name="xml_id" select="@xml_id"/>
+                <!--<xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath,'_x2f_',$featureID_name)"/>-->
+                <xsl:variable name="wfs_output" select="concat($uuid,'.',$loop_xpath)"/>
+                <!--<xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.xml')"/>-->
+                <xsl:variable name="wfs_output.xml" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.xml')"/>
+                <xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.',$feature_pos,'.dita.xml')"/>
+                <!--<xsl:variable name="wfs_output.dita" select="concat($wfs_output,'.',position(),'.','.dita.xml')"/>-->
+                <!-- dane z oczekiwanego template .dita -->
+                <xsl:variable name="xpath_dita" select="@xpath"/>
+                <xsl:variable name="xpath_value_dita">
+                    <xsl:choose>
+                        <xsl:when test="@xpath_value">
+                            <!--<xsl:variable name="xpath_value_tokens" select="tokenize(@xpath_value,'/')"/>-->
+                            <!--<xsl:value-of select="'todo zapytanie xpath do przetworzenia'"/>-->
+                            <!--<xsl:copy-of select="$xpath_value_tokens"></xsl:copy-of>-->
+                            <!--<xsl:message>#67 probuje ustalic dla featureID_name=<xsl:value-of select="$featureID_name"/>; wartosc z @xpath_value=<xsl:value-of select="@xpath_value"/>; $input_obj_with_xpath/node()[@xpath="ID_BILLING_OWNER"] =<xsl:value-of select="$input_obj_with_xpath/node()[@xpath='ID_BILLING_OWNER']"/>; </xsl:message>-->
+                            <xsl:message>#67.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message>
+                            <xsl:variable name="xpath_value_token">
+                                <xsl:for-each select=" tokenize(@xpath_value,'/')">
+                                    <xsl:message>#70 znalazlem dla=<xsl:value-of select="."/>; ; <xsl:value-of select="$input_obj_with_xpath/node()[@xpath=current()]"/></xsl:message>
+                                    <xsl:if test="$input_obj_with_xpath/node()[@xpath=current()]">
+                                        <xsl:copy-of select="$input_obj_with_xpath/node()[@xpath=current()]"/>
+                                    </xsl:if><!-- todo to jest bledne ale dziala tymczasowo-->
+                                </xsl:for-each>
+                            </xsl:variable>
+                            <xsl:message>#73 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message>
+                            <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
+                            <xsl:value-of select="$xpath_value_token"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:value-of select="$xpath_value"/><!-- parametr z template narzuca wartosc -->
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:message>#71 wstawiam projekt $feature_pos=<xsl:value-of select="$feature_pos"/>; $loop_xpath=<xsl:value-of select="$loop_xpath"/>; </xsl:message>
+                <project basedir="../." name="get_related_feature{$loop_xpath_real}" default="get_related_feature_run_child_ant{$loop_xpath_real}">
+                    <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>
+                    <!--<xsl:variable name="typeName" select='replace($typeName,"&quot;","")'/>--><!-- oczyszczenie z apostrofow -->
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'uuid'"/>
+                        <xsl:attribute name="value" select="$uuid"/>
+                    </xsl:element>
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'passwordBase64Basic'"/>
+                        <xsl:attribute name="value" select="$passwordBase64Basic"/>
+                    </xsl:element>
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'url'"/>
+                        <xsl:attribute name="value" select="$url"/>
+                    </xsl:element>
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'webRootUrl'"/>
+                        <xsl:attribute name="value" select="$webRootUrl"/>
+                    </xsl:element>
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'build_recurse_ant.xsl'"/>
+                        <xsl:attribute name="value" select="$build_recurse_ant.xsl"/>
+                    </xsl:element>
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'temp'"/>
+                        <xsl:attribute name="value" select="$temp"/>
+                    </xsl:element>
+                    <xsl:element name="property">
+                        <xsl:attribute name="name" select="'builds_to_ant.xsl'"/>
+                        <xsl:attribute name="value" select="$builds_to_ant.xsl"/>
+                    </xsl:element>
+                    <xsl:comment>
+                        Important variables:
+                        typeName=<xsl:value-of select="$typeName"/>;
+                        xpath=<xsl:value-of select="$xpath"/>;
+                        xpath_value=<xsl:value-of select="$xpath_value"/>;
+                        $passwordBase64Basic=<xsl:value-of select="$passwordBase64Basic"/>
+                    </xsl:comment>
+
+                    <xsl:apply-templates mode="ant_target" select=".">
+                        <xsl:with-param name="typeName_dita" select="$typeName_dita"/>
+                        <xsl:with-param name="featureID_name_dita" select="$featureID_name_dita"/>
+                        <xsl:with-param name="wfs_output" select="$wfs_output"/>
+                        <xsl:with-param name="wfs_output.xml" select="$wfs_output.xml"/>
+                        <xsl:with-param name="wfs_output.dita" select="$wfs_output.dita"/>
+                        <xsl:with-param name="xpath" select="$xpath"/>
+                        <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
+                        <xsl:with-param name="featureID_name" select="$featureID_name"/>
+                        <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
+                        <xsl:with-param name="RelatedFeatureCount" select="$RelatedFeatureCount"/>
+                        <xsl:with-param name="RelatedFeaturePos" select="$RelatedFeaturePos"/>
+                        <xsl:with-param name="typeName" select="$typeName"/>
+                        <xsl:with-param name="xpath_value" select="$xpath_value"/>
+                        <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                        <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
+                        <!--<xsl:with-param name="loop_xpath_save" select="$loop_xpath_save"/>-->
+                        <xsl:with-param name="xml_id" select="$xml_id"/>
+                        <!--<xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>-->
+                        <xsl:with-param name="feature_pos"   select="$feature_pos"/>
+                    </xsl:apply-templates>
+                    <!-- na koniec przetwarzania kazdego z wezlow, podmieniamy xsl biezacy wezel -->
+                    
+                    <xsl:comment>template  match="RelatedFeature" mode="after_first_ant_assing_vars_childs" 
+                                robi result-document href="build_{$loop_xpath}.{$uuid}.xml
+                               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="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:element name="target">
+                        <xsl:attribute name="name" select="concat('get_related_feature_run_child_ant',$loop_xpath_real)"/>
+                        <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos,$loop_xpath_real)"/>
+                    <!--<xsl:choose>
+                        <xsl:when test=".//(RelatedFeature|RelatedFeatureRoot)">
+                            <xsl:for-each select=".//RelatedFeature[ not(child::node()/name()='RelatedFeature')]">
+                                <xsl:variable name="loop_xpath_child_ant" select="concat($loop_xpath_save,'_x2f_.',@xml_id,'.',$featureID_name)"/>
+                                <xsl:message>#148 ustalamy $loop_xpath_child_ant=<xsl:value-of select="$loop_xpath_child_ant"/></xsl:message>
+                               <!-\- <xsl:element name="target">
+                                    <xsl:attribute name="name" select="$loop_xpath_child_ant"/><!-\\-'get_related_feature_run_child_ant'-\\->
+                                    <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>-\->
+                                <!-\-<ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.xml" dir="."/>-\->
+                                <ant antfile="temp/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>
+                                
+                                <!-\-</xsl:element>-\->
+                                <xsl:if test=" position()=last()">
+                                    <xsl:comment>Tu task z related</xsl:comment>
+                                </xsl:if>
+                            </xsl:for-each>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:comment>#135 nie ma wiecej //RelatedFeature</xsl:comment>
+                            <!-\-<xsl:element name="target">
+                                <xsl:attribute name="name" select="'get_related_feature_run_child_ant'"/>
+                                <xsl:attribute name="depends" select="concat('get_related_feature.',$RelatedFeaturePos)"/>
+                            </xsl:element>-\->
+                        </xsl:otherwise>
+                    </xsl:choose>-->
+                        <!-- wstawienie subanta dla biezacych dzieci only -->
+                        <xsl:apply-templates mode="place_subant">
+                            <xsl:with-param name="uuid" select="$uuid"/>
+                            <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                            <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
+                        </xsl:apply-templates>
+                    </xsl:element>
+                    <!-- na koniec przetwarzania danego zaglebienia uruchamiamy calosc ponownie do kolejnego zaglebienia -->
+                    
+                    <!-- task do polaczenia zaglebien -->
+                    
+                    <!-- jak nie ma zaglebien to generujemy pdf i dajemy uzytkownikowi linka  -->
+                </project>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:apply-templates mode="child_nodes"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    
+    <xsl:template mode="place_subant" match="RelatedFeature">
+        <xsl:param name="uuid" required="yes"/>
+        <xsl:param name="loop_xpath" required="yes"/>
+        <xsl:param name="loop_xpath_real" required="yes"/>
+        <!-- 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>
+        <fileset id="builds_to_ant{$loop_xpath_real}" dir="temp" includes="{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.*.xml" />
+        
+        <property name="builds_to_ant{$loop_xpath_real}" refid="builds_to_ant{$loop_xpath_real}"/>
+        <!--<tempfile property="builds_to_ant.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.builds_to_ant-"/>-->
+        <xsl:element name="tempfile">
+            <xsl:attribute name="property" select="concat('builds_to_ant.xml',$loop_xpath_real)"/>
+            <xsl:attribute name="deleteonexit" select="'no'"/>
+            <xsl:attribute name="destdir" select="'temp'"/>
+            <xsl:attribute name="suffix" select="'.xml'"/>
+            <xsl:attribute name="prefix" select="'${uuid}.builds_to_ant-'"/>
+        </xsl:element>
+        <!--<tempfile property="builds_to_ant_file.xml" deleteonexit="no" destdir="temp" suffix=".xml" prefix="${uuid}.build_to_ant_file-"/>-->
+        <xsl:element name="tempfile">
+            <xsl:attribute name="property" select="concat('builds_to_ant_file.xml',$loop_xpath_real)"/>
+            <xsl:attribute name="deleteonexit" select="'no'"/>
+            <xsl:attribute name="destdir" select="'temp'"/>
+            <xsl:attribute name="suffix" select="'.xml'"/>
+            <xsl:attribute name="prefix" select="'${uuid}.build_to_ant_file-'"/>
+        </xsl:element>
+        <echo>#235 ant do: builds_to_ant.xml=${builds_to_ant_file.xml} mode="place_subant" match="RelatedFeature" </echo>
+        <!--<echoxml file="'${builds_to_ant.xml}'"><builds_to_ant>${builds_to_ant}</builds_to_ant></echoxml>-->
+        <xsl:element name="echoxml">
+            <xsl:attribute name="file" select="concat('${builds_to_ant.xml',$loop_xpath_real,'}')"/>
+            <builds_to_ant>${builds_to_ant<xsl:value-of select="$loop_xpath_real"/>}</builds_to_ant>
+        </xsl:element>
+        <xsl:element name="xslt">
+            <xsl:attribute name="basedir" select="'./'"/>
+            <xsl:attribute name="style" select="$builds_to_ant.xsl"/>
+            <xsl:attribute name="in" select="concat('${builds_to_ant.xml',$loop_xpath_real,'}')"/>
+            <xsl:attribute name="destdir" select="'./'"/>
+            <xsl:attribute name="out" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,'}')"/>
+            <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="after_first_ant_assing_vars"/>-->
+            </factory>
+            
+            <param name="temp" expression="{$temp}"/>
+            <param name="loop_xpath_real" expression="{$loop_xpath_real}"/>
+            <!--<xsl:element name="param">
+                <xsl:attribute name="name" select="'default_antfile'"/>
+                <xsl:attribute name="expression" select="concat($temp,'/',$builds_to_ant_file.xml"/>
+            </xsl:element>-->
+            <param name="default_antfile" expression="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml"/>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+        </xsl:element>
+        
+        <!--<ant antfile="{$temp}/{$uuid}.build_{$loop_xpath}_x2f_.{@xml_id}.{ substring-after(@typeName,':') }.1.xml" dir="."/>-->
+        
+        <xsl:element name="ant">
+            <xsl:attribute name="antfile" select="concat('${builds_to_ant_file.xml',$loop_xpath_real,'}')"/>
+        </xsl:element>
+        <!--<ant antfile="{$temp}/${builds_to_ant_file.xml}" dir="."/>-->
+        
+    </xsl:template>
+    <xsl:template mode="place_subant" match="*">
+        <xsl:param name="uuid" required="yes"/>
+        <xsl:param name="loop_xpath" required="yes"/>
+        <xsl:param name="loop_xpath_real" required="yes"/>
+        <xsl:apply-templates mode="place_subant">
+            <xsl:with-param name="uuid" select="$uuid"/>
+            <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+            <xsl:with-param name="loop_xpath_real" select="$loop_xpath_real"/>
+        </xsl:apply-templates>
+    </xsl:template>
+    <xsl:template mode="place_subant" match="text()|comment()"/>
+    
+    <xsl:template mode="child_nodes" match="*">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+
+    
+    <xsl:template match="RelatedFeature"  mode="ant_target" >  
+        <xsl:param name="typeName_dita" required="yes"/>
+        <xsl:param name="featureID_name_dita" required="yes"/>
+        <xsl:param name="wfs_output" required="yes"/>
+        <xsl:param name="wfs_output.xml" required="yes"/>
+        <xsl:param name="wfs_output.dita" required="yes"/>
+        <xsl:param name="xpath_dita" required="yes"/>
+        <xsl:param name="xpath_value_dita" required="yes"/>
+        <xsl:param name="xpath" required="yes"/>
+        <xsl:param name="featureID_name" required="yes"/>
+        <xsl:param name="RelatedFeatureCount" required="yes"/>
+        <xsl:param name="RelatedFeaturePos" required="yes"/>
+        <xsl:param name="typeName"  required="yes"/>
+        <xsl:param name="xpath_value"  required="yes"/>
+        <xsl:param name="loop_xpath"  required="yes"/>
+        <!--<xsl:param name="loop_xpath_save"  required="yes"/>-->
+        <xsl:param name="xml_id"  required="yes"/>
+        <xsl:param name="feature_pos"   required="yes"/>
+        <xsl:param name="loop_xpath_real" required="yes"/>
+        <xsl:choose>
+            <xsl:when test="$wfs_output"/>
+            <xsl:otherwise><xsl:message terminate="yes">Not required param wfs_output - nazwa temp sciagniecia z api xml forsowana przez pierwsze sciagniecie - to set by next parraler step in ant build  </xsl:message></xsl:otherwise>
+        </xsl:choose>
+        <!--  template do przetworzenia dity w celu wykrycia:
+        <RelatedFeature xpath="ID_BILLING_OWNER" typeName="p5_default_db:BILLING_OWNER">
+        <ph>Nadawca:</ph><br/>
+        <ph xpath="name1"/><br/>
+        <ph xpath="name2"/><br/>
+        <ph xpath="miasto"/><br/>
+        <ph xpath="nr_rach"/><br/>
+        <ph xpath="BILLING_OWNER_EMAIL"/><br/>
+      </RelatedFeature>
+      
+      i wyrzucenia z tego pierwszego zadania ANT do otrzymania niezbednego .xml w celu jego podstawienia pod dite
+      w celu pozniejszego ponownego wyzwolenia tego template az do zakonczenia cyklu finalnego.
+      
+      Template powinien budować projekt ant do wyzwolenia z odpowiednimi parametrami dalszymi
+      
+    -->
+             <!-- sprawdzamy czy template pasuje do zadania wyzwolenia czy xpath=xpath_dita oraz czy typeName=typeName_dita-->
+             <xsl:choose>
+                 <xsl:when test="string($xpath_dita)= string($xpath) and string($featureID_name)=string($featureID_name_dita)">
+                     <!-- calculate query to api default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=p5_default_db:IN7_DZIENNIK_KORESP&SRSNAME=EPSG:3003&featureID=IN7_DZIENNIK_KORESP.1000'-->
+                     <!--<property name="OGC_Filter">%26lt;ogc:Filter%26gt;%26lt;ogc:PropertyIsNull%26gt;%26lt;ogc:PropertyName%26gt;the_geom%26lt;/ogc:PropertyName%26gt;%26lt;/ogc:PropertyIsNull%26gt;%26lt;/ogc:Filter%26gt;</property>-->
+                     
+                     <xsl:variable name="OGC_Filter">&amp;Filter=&lt;ogc:Filter&gt;&lt;ogc:PropertyIsEqualTo&gt;&lt;ogc:PropertyName&gt;<xsl:value-of select="$xpath_dita"/>&lt;/ogc:PropertyName&gt;&lt;ogc:Literal&gt;<xsl:value-of select="$xpath_value_dita"/>&lt;/ogc:Literal&gt;&lt;/ogc:PropertyIsEqualTo&gt;&lt;/ogc:Filter&gt;</xsl:variable>
+                     
+                     <xsl:variable name="url">
+                         <!--<xsl:value-of select="$api_url"/>/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=<xsl:value-of select="$typeName_dita"/>&amp;SRSNAME=EPSG:3003&amp;featureID=<xsl:value-of select="$featureID_name_dita"/>.<xsl:value-of select="$xpath_value_dita"/>-->
+                         <xsl:value-of select="$api_url"/>/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=<xsl:value-of select="$typeName_dita"/>&amp;SRSNAME=EPSG:3003<xsl:value-of select="$OGC_Filter"/>
+                     </xsl:variable>
+                            <xsl:element name="target">
+                                <xsl:attribute name="name" select="concat('get_related_feature.',position(),$loop_xpath_real)"/>
+                                <xsl:choose>
+                                    <xsl:when test="$RelatedFeatureCount=$RelatedFeaturePos"/>
+                                    <xsl:otherwise>
+                                        <xsl:attribute name="depends" select="concat('get_related_feature.',position()-1),$loop_xpath_real"/>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                                
+                                <!--<tempfile property="out_task.dita" deleteonexit="no"  destdir="temp"/>-->
+                                    <!--<tempfile property="wfs_output" deleteonexit="no"  destdir="temp"  suffix=".xml" />-->
+                                    <xsl:element name="exec">
+                                        <xsl:attribute name="executable" select="'curl'"/>
+                                        <xsl:attribute name="output"  select="concat('temp/',$wfs_output.xml)"/>
+                                        <xsl:attribute name="errorproperty" select="'wfs_error'"/>
+                                        <xsl:attribute name="resultproperty" select="'wfs_result'"/>
+                                        <xsl:element name="arg">
+                                            <!--<xsl:attribute name="line" select='concat("-H ","&amp;Authorization: Basic ",$passwordBase64Basic," ",$url)'/>-->
+                                            <xsl:attribute name="line">-H 'Authorization: Basic <xsl:value-of select="$passwordBase64Basic"/>' "<xsl:value-of select="$url"/>"</xsl:attribute> 
+                                        </xsl:element>
+                                    </xsl:element>
+                                    <echo message="ERROR__START"/>
+                                    <xsl:element name="echo">
+                                        <xsl:attribute name="message">${wfs_error}</xsl:attribute>
+                                    </xsl:element>
+                                    <echo message="ERROR__END"/>
+                                    <xsl:choose>
+                                        <xsl:when test="position()=last()">
+                                            <xsl:comment>antcall target="build_recurse_ant.<xsl:value-of select="position()+1"/>.xml"</xsl:comment>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                            <antcall target="build_recurse_ant.{position()+1}.xml"/>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
+                                    <echo> related .dita.xml template is: $wfs_output.dita=<xsl:value-of select="$wfs_output.dita"/>; do przetwarzania na podstawie: $wfs_output.xml=<xsl:value-of select="$wfs_output.xml"/>;</echo>
+                                    <xsl:comment> teraz podmieniamy dane z otrzymanego xmla do pliku dita aby potem zrobic polaczony plik  w kolejnym wyzwoleniu ant</xsl:comment>
+                                    <delete file="temp/{$wfs_output.dita}.vals.dita"/>
+                                    <xslt basedir="./" style="{$build_recurse_ant.xsl}" in="temp/{$wfs_output.dita}"  destdir="./" out="temp/{$wfs_output.dita}.vals.dita" >
+                                            <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="after_first_ant_assing_vars"/>
+                                            </factory>
+                                            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+                                            <param name="wfs_output" expression="{$basedir}/temp/{$wfs_output.xml}"/>
+                                            <param name="xpath" expression="{$xpath}" /> <!-- kontrolnie - nie potrzebne -->
+                                            <param name="xpath_value" expression="{$xpath_value}" /> <!-- kontrolnie - nie potrzebne -->
+                                            <param name="loop_xpath" expression="{$loop_xpath}"/>
+                                            <param name="loop_xpath_save" expression="{$loop_xpath_save}"/>
+                                            <param name="typeName" expression="{$typeName}"/><!-- kontrolnie - nie potrzebne -->
+                                            <param name="uuid" expression="{$uuid}"/>
+                                            <param name="basedir" expression="{$basedir}"/>
+                                            <param name="build_recurse_ant.xsl" expression="{$build_recurse_ant.xsl}"/>
+                                            <param name="passwordBase64Basic" expression="{$passwordBase64Basic}"/>
+                                            <param name="feature_pos" expression="{$feature_pos}"/> <!-- aby wsadzic nr wezla do $wfs_output.dita.vals.dita -->
+                                            <param name="build_recurse_ant.xsl" expression="{$build_recurse_ant.xsl}"/>
+                                            <param name="temp" expression="{$temp}"/>
+                                            <param name="builds_to_ant.xsl" expression="{$builds_to_ant.xsl}"/>
+                                    </xslt>
+                            </xsl:element>
+                        <!-- zapisujemy wynik naszego biezacego przetwarzania dita element nizej do kolejnego przejechania z ant wyniku dla podstawienia danych  -->
+                        <!-- blad - result jest po tym template -->
+                        <xsl:message>#276  $feature_pos=<xsl:value-of select="$feature_pos"/>; $xml_id=<xsl:value-of select="$xml_id"/>; writing $wfs_output.dita to <xsl:value-of select="$wfs_output.dita"/>;</xsl:message>
+                             <!-- ten plik moze byc raz bo zawiera tylko mape do przeksztalcenia danego wezla -->
+                            <xsl:result-document href="{$wfs_output.dita}">
+                                <xsl:comment>current $feature_pos=<xsl:value-of select="$feature_pos"/>; $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:comment>
+                                <!--<xsl:copy-of select="."/>-->
+                                <xsl:element name="{name()}">
+                                    <xsl:copy-of select="@*"/>
+                                    <xsl:attribute name="feature_pos" select="$feature_pos"/>
+                                    <xsl:copy-of select="./*" exclude-result-prefixes="#all" copy-namespaces="no"/>
+                                </xsl:element>
+                            </xsl:result-document>
+                            <!--<xsl:choose>
+                                <xsl:when test="$feature_pos=1"><xsl:message>#327 propably first unaviable (<xsl:value-of select="$wfs_output.dita"/>) - writing</xsl:message>
+                                    <xsl:result-document href="{$wfs_output.dita}">
+                                        <xsl:comment>current $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:comment>
+                                        <xsl:copy-of select="."/></xsl:result-document>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:message>#227.1 probably exists file:<xsl:value-of select="$wfs_output.dita"/>; - bypassing </xsl:message>
+                                </xsl:otherwise>
+                            </xsl:choose>-->
+                     </xsl:when>
+                 <xsl:otherwise>
+                     <error>
+                         <xsl:attribute name="xpath" select="$xpath"/>
+                         <xsl:attribute name="xpath_dita" select="$xpath_dita"/>
+                         <xsl:attribute name="xpath_value" select="$xpath_value"/>
+                         <xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>
+                         <xsl:attribute name="typeName" select="$typeName"/>
+                         <xsl:attribute name="typeName_dita" select="$typeName_dita"/>
+                         <xsl:attribute name="featureID_name" select="$featureID_name"/>
+                         <xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>
+                         Current template doesnt fit the requested data - TODO search for another template!
+                     </error>
+                 </xsl:otherwise>
+             </xsl:choose>
+    </xsl:template>
+    
+    
+    
+    <!-- second step from local ant leaf -->
+    
+    
+    <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars">
+        <xsl:param name="loop_xpath" select="$loop_xpath"/>
+        <RelatedFeatureRoot>
+            <xsl:message>#228  try to open $wfs_output=doc(<xsl:value-of select="$wfs_output"/>); @xml_id=<xsl:value-of select="@xml_id"/>; templ match RelatedFeature mode after_first_ant_assing_vars dla @typeName=<xsl:value-of select="@typeName"/>;</xsl:message>
+        <!-- first assign xpath to features from  -->
+        <xsl:variable name="wfs_output_nodes" select="doc($wfs_output)"/>
+        <xsl:variable name="current_RelatedFeature" select="*"/>
+       <xsl:variable name="xml_id" select="@xml_id"/>
+        <!--<input_obj_with_xpath_debug>
+            <xsl:copy-of select="$wfs_output_nodes"/>
+        </input_obj_with_xpath_debug>-->
+            <xsl:message>#354 count($wfs_output_nodes//gml:featureMember) <xsl:value-of select="count($wfs_output_nodes//gml:featureMember)"/></xsl:message>
+          <!-- tutaj jest blad przetwarzania ze wrzuca po rekordzie do kolumny - trzeba przetworzyc dla kazdego feature member -->
+            <xsl:for-each select="$wfs_output_nodes//gml:featureMember">
+                <xsl:variable name="input_obj_with_xpath">
+                    <xsl:apply-templates mode="after_first_ant_assing_xpath" select="node()/*"/> <!-- zeby nie wstawial do xpath nazwy feature - IN7_DZIENNIK_KORESP/ID itp -->
+                </xsl:variable>
+                <!--<input_obj_with_xpath_debug>
+                    <xsl:attribute name="xpath" select="$xpath"/>
+                    <!-\-<xsl:attribute name="xpath_dita" select="$xpath_dita"/>-\->
+                    <xsl:attribute name="xpath_value" select="$xpath_value"/>
+                    <!-\-<xsl:attribute name="xpath_value_dita" select="$xpath_value_dita"/>-\->
+                    <xsl:attribute name="typeName" select="$typeName"/>
+                    <!-\-<xsl:attribute name="typeName_dita" select="$typeName_dita"/>-\->
+                    <!-\-<xsl:attribute name="featureID_name" select="$featureID_name"/>-\->
+                    <!-\-<xsl:attribute name="featureID_name_dita" select="$featureID_name_dita"/>-\->
+                    <xsl:copy-of select="$input_obj_with_xpath"/>
+                </input_obj_with_xpath_debug>-->
+                <!--<input_node_debug>
+                    <xsl:copy-of select="."/>
+                </input_node_debug>-->
+                <xsl:apply-templates mode="after_first_ant_assing_vars_childs" select="$current_RelatedFeature">
+                    <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
+                    <xsl:with-param name="xml_id_parent" select="$xml_id"/>
+                    <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                    <xsl:with-param name="feature_pos" select="position()"/><!-- wiecej features z relacji dokladamy pozycje -->
+                </xsl:apply-templates>
+            </xsl:for-each>
+        </RelatedFeatureRoot>
+    </xsl:template>
+    
+    <xsl:template match="wfs:FeatureCollection|gml:featureMember" mode="after_first_ant_assing_xpath">
+        <xsl:apply-templates mode="after_first_ant_assing_xpath"/>
+    </xsl:template>
+    
+    
+    <xsl:template mode="after_first_ant_assing_xpath" match="*">
+        <xsl:param name="curr_xpath"/>
+        <xsl:param name="loop_xpath" select="$loop_xpath"/>
+        <xsl:choose>
+            <xsl:when test="name()=$typeName">
+                <xsl:apply-templates mode="after_first_ant_assing_xpath">
+                    <xsl:with-param name="curr_xpath" select="$curr_xpath"/>
+                    <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                </xsl:apply-templates>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:variable name="curr_xpath_tmpl">
+                    <xsl:choose>
+                        <xsl:when test="$curr_xpath=''">
+                            <xsl:value-of select="local-name()"/> <!-- bylo local-name() - trzeba dorzucic xpath przechodzacy aby budowal sie w kwestii  -->
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:value-of select="concat($curr_xpath,'/',local-name())"/>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <!--<xsl:variable name="curr_xpath_tmpl" select="'asdf'"/>-->
+                <xsl:element name="{name()}">
+                    <xsl:attribute name="xpath" select="$curr_xpath_tmpl"/>
+                    <xsl:for-each select="@*">
+                        <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
+                    </xsl:for-each>
+                    <xsl:value-of select="text()"/>
+                    <xsl:apply-templates mode="after_first_ant_assing_xpath">
+                        <xsl:with-param name="curr_xpath" select="$curr_xpath_tmpl"/>
+                    </xsl:apply-templates>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template match="text()" mode="after_first_ant_assing_xpath"/>
+    
+    <xsl:template  match="RelatedFeature" mode="after_first_ant_assing_vars_childs">
+        <xsl:param name="input_obj_with_xpath" required="yes"/>
+        <xsl:param name="xml_id_parent" required="yes"/>
+        <xsl:param name="loop_xpath"  select="$loop_xpath"/>
+        <xsl:param name="feature_pos"   required="yes"/>
+        <xsl:message>#411 $feature_pos=<xsl:value-of select="$feature_pos"/>; mode after_first_ant_assing_vars_childs bylo $loop_xpath=<xsl:value-of select="$loop_xpath"/>;</xsl:message>
+        <!-- jest okazja do zrobienia bilda aby sciagnal rzeczy nizej -->
+        <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
+        <xsl:variable name="xml_id" select="@xml_id"/>
+        <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
+        <!--<xsl:variable name="loop_xpath_save" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>--> <!-- tutaj zapisal sie build z wezla z parent -->
+        <!--<debug_358_RelatedFeature>
+            <xsl:copy-of select="$input_obj_with_xpath"/>
+        </debug_358_RelatedFeature>-->
+        <!--<xsl:variable name="feature_pos">
+            <xsl:choose>
+                <xsl:when test="$feature_pos=1"/>
+                <xsl:otherwise><xsl:value-of select="$feature_pos"/></xsl:otherwise>
+            </xsl:choose>
+        </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="{$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="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:template>
+    
+    <xsl:template  match="*" mode="after_first_ant_assing_vars_childs">
+        <xsl:param name="xml_id_parent" required="yes"/>
+        <xsl:param name="loop_xpath"   required="yes"/>
+        <xsl:param name="input_obj_with_xpath" required="yes"/>
+        <xsl:param name="feature_pos"  required="yes"/>
+        <xsl:for-each select=".">
+            <xsl:choose>
+                <!--<xsl:when test="node()='topic'">asdad</xsl:when>-->
+                <!--<xsl:when test="name()='RelatedFeature'">
+                    <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
+                        <xsl:apply-templates mode="PROCES_INCLUDE">
+                            <xsl:with-param name="ID_PROCES" select="text()"/>
+                        </xsl:apply-templates>
+                    </xsl:for-each>
+                </xsl:when>-->
+                <!--<xsl:when test="name()='data-about'">
+                    <xsl:for-each select="data/apiname[@base='PROCES_INCLUDE']">
+                        <xsl:apply-templates mode="PROCES_INCLUDE">
+                            <xsl:with-param name="ID_PROCES" select="text()"/>
+                        </xsl:apply-templates>
+                    </xsl:for-each>
+                </xsl:when>-->
+                <xsl:when test="1=2"/>
+                <xsl:otherwise>
+                    <xsl:element name="{name()}">
+                        <!--<xsl:copy-of select="namespace::node()"/>-->
+                        <xsl:for-each select="@*">
+                            <xsl:choose>
+                                <xsl:when test="name()='xpath'">
+                                    <!--<xsl:attribute name="xpath_parsed" select="."/>-->
+                                    <!--1:<xsl:value-of select="$parent_obj//node()[@system_cache__appinfo:xpath=$xpath]/text()"/>-->
+                                    <!--<xsl:value-of select="$parent_obj//node()[local-name()=$xpath]/text()"/>-->
+                                    <!--V:<xsl:value-of select="$xpath"/>-->
+                                </xsl:when>
+                                <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:for-each>
+                        <xsl:choose>
+                            <xsl:when test="@xpath">
+                                <!--<xsl:variable name="escaped_html_to_xml">
+                                    <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                                        <xsl:with-param name="html" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
+                                    </xsl:call-template>
+                                </xsl:variable>-->
+                                <xsl:variable name="enter_to_ph">
+                                    <xsl:apply-templates mode="enter_to_ph" select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]">
+                                        <xsl:with-param name="count" select="count($input_obj_with_xpath/node()[local-name()=current()/@xpath])"/>
+                                    </xsl:apply-templates>
+                                </xsl:variable>
+                                <xsl:copy-of select="$enter_to_ph"/>
+                            </xsl:when>
+                        </xsl:choose>
+                        <xsl:value-of select="text()"/>
+                        <xsl:apply-templates mode="after_first_ant_assing_vars_childs">
+                            <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
+                            <xsl:with-param name="xml_id_parent" select="$xml_id_parent"/>
+                            <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                            <xsl:with-param name="feature_pos" select="$feature_pos"/>
+                        </xsl:apply-templates>
+                    </xsl:element>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
+    </xsl:template>
+    <xsl:template match="text()" mode="after_first_ant_assing_vars_childs"/>
+    <xsl:template match="comment()" mode="after_first_ant_assing_vars_childs"/>
+    <!-- pozbieranie do kupy wszystkich xmli i zlozenie dity -->
+    
+    
+    
+    
+    
+    <xsl:template match="*" mode="enter_to_ph">
+        <xsl:param name="count"/>
+        <xsl:choose>
+            <xsl:when test=" contains(  text(),'&#13;')">
+                <xsl:for-each select="tokenize(  text(),'&#13;')">
+                    <codeblock><xsl:value-of select="."/></codeblock>
+                </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:choose>
+                    <xsl:when test="$count &gt;1">
+                        <codeblock>
+<!--                            count:<xsl:value-of select="$count"/>
+-->                            <xsl:copy-of select=" text()"/>
+                        </codeblock>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:copy-of select=" text()"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 162 - 0
SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/build_recurse_ant_merge_dita_from_temp.xsl

@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:wfs="http://www.opengis.net/wfs"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    <xsl:output indent="yes" />
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="uuid" required="yes"/>
+    <xsl:param name="basedir" required="yes"/>
+    <xsl:param name="temp" required="yes"/>
+    
+    <!-- template do zlaczenia wszystkich xmli z danymi z dita 
+    description="z plikow temp/$uuid.* buduje $out_task.dita " -->
+    
+    
+    
+    
+    <xsl:template name="get_childs_rows">
+        <xsl:param name="element-filename"  required="yes"/> <!-- prezes1.root_x2f_.d1e1.CRM_PROCES_x2f_.d1e46.CRM_WSKAZNIK_x2f_.d1e51.CRM_LISTA_ZASOBOW.1. -->
+        <xsl:param name="path2collection" select="concat($temp,'/')"/> <!-- $basedir,'/' -->
+        <xsl:variable name="path">
+            <xsl:value-of select="concat($path2collection,'?select=',$element-filename,'*.dita.xml.vals.dita')"/> <!-- $element-filename,'-->
+        </xsl:variable>
+        <xsl:message>#30 otwieram kolekcje $path=<xsl:value-of select="$path"/>; </xsl:message>
+        
+        <!--<xsl:variable name="docs" select="collection($path)"/>-->
+        <!--<xsl:variable name="docs" select="collection($path)"/>-->
+        <!--<xsl:for-each select="$docs">
+            <xsl:message>#35 test - cos jest <xsl:value-of select="name()"/></xsl:message>
+            <xsl:copy-of select="."/>
+        </xsl:for-each>-->
+        <xsl:copy-of select="collection($path)"/>
+
+    </xsl:template>
+    
+    
+    
+    <xsl:template match="*" mode="root">
+        <xsl:param name="loop_xpath"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates>
+                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    
+    <xsl:template match="RelatedFeature">
+        <!-- podstawamy dane z xml na podstawie path -->
+        <xsl:param name="loop_xpath" select="'root'"/>
+        <xsl:param name="feature_pos_child"  select="1"/> <!-- pierwsze wyzwolenie narzuca 1 - kolejne sa z related -->
+        <xsl:variable name="xml_id" select="@xml_id"/>
+        <xsl:variable name="RelatedFeaturePos" select="position()"/>
+        <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
+        
+        <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
+
+        <xsl:message>#26 odpalam $feature_pos_child=<xsl:value-of select="$feature_pos_child"/>; loop_xpath=<xsl:value-of select="$loop_xpath"/>.dita.xml.vals.dita;</xsl:message>
+        <!--<debug26>
+            Will try to put file=<xsl:value-of select="concat($uuid,'.',$loop_xpath,$featureID_name,'.',$RelatedFeaturePos,'.dita.xml.vals.dita')"/>;
+        </debug26>-->
+        <!--<xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.dita.xml.vals.dita'))"/>-->
+        
+        <xsl:variable name="dita_fragment">
+            <xsl:choose>
+                <xsl:when test=" doc-available(concat($basedir,'/',$temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))">
+                    <xsl:copy-of select="doc(concat($basedir,'/',$temp,'/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:comment>#78 INFO no Related leaf xml file <xsl:value-of select="concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita')"/>;</xsl:comment>
+                    <xsl:message>#78 INFO no Related leaf xml file <xsl:value-of select="concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita')"/></xsl:message>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <!--<xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.',$feature_pos_child,'.dita.xml.vals.dita'))"/>-->
+        <!--<xsl:variable name="dita_fragment">
+            <xsl:call-template name="get_childs_rows">
+                <xsl:with-param name="element-filename" select="concat($uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.')"/>
+            </xsl:call-template>
+        </xsl:variable>-->
+         
+        <!--<debug_RelatedFeature>
+            <xsl:copy-of select="$dita_fragment"/>
+        </debug_RelatedFeature>-->
+        
+        <xsl:for-each select="$dita_fragment">
+            <xsl:apply-templates mode="RelatedFeature" select="$dita_fragment/RelatedFeatureRoot/*">
+                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+            </xsl:apply-templates>
+        </xsl:for-each>
+    </xsl:template>
+    
+    <xsl:template mode="RelatedFeature" match="*">
+        <xsl:param name="loop_xpath" required="yes"/>
+        <!--<xsl:element name="{name()}">-->
+            <!--<xsl:copy-of select="@*"/>-->
+            <!--<xsl:apply-templates select="@*"/>-->
+            <xsl:message>#94 ustalam $feature_pos_child=<xsl:value-of select="position()"/>; dla <xsl:value-of select="name()"/></xsl:message>
+            <xsl:apply-templates mode="RelatedFeatureChild" select=".">
+                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                <xsl:with-param name="feature_pos_child" select="position()"/>
+            </xsl:apply-templates>
+        <!--</xsl:element>-->
+    </xsl:template>
+    
+    <xsl:template mode="RelatedFeatureChild" match="*">
+        <xsl:param name="loop_xpath" required="yes"/>
+        <xsl:param name="feature_pos_child" required="yes"/>
+        <xsl:element name="{name()}">
+            <!--<xsl:copy-of select="@*"/>-->
+            <xsl:apply-templates select="@*"/>
+            <xsl:apply-templates mode="RelatedFeatureChild">
+                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template mode="RelatedFeatureChild" match="RelatedFeature">
+        <xsl:param name="loop_xpath" required="yes"/>
+        <xsl:param name="feature_pos_child" required="yes"/>
+        <xsl:apply-templates select=".">
+            <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+            <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
+        </xsl:apply-templates>
+    </xsl:template>
+    
+    
+    
+    
+  
+    
+    
+    
+    <xsl:template match="*" >
+        <xsl:param name="loop_xpath"/>
+        <xsl:param name="feature_pos_child" required="yes"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates>
+                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
+                <xsl:with-param name="feature_pos_child" select="$feature_pos_child"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    
+    <xsl:template match="@*">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    <xsl:template match="@xml_id"/>
+        
+    
+    
+</xsl:stylesheet>

+ 46 - 0
SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/builds_to_ant.xsl

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!-- template do zbudowania listy podzadan na podsatwie <fileset id="builds_to_ant" dir="temp" includes="prezes1.build_root_x2f_.d1e1.CRM_PROCES_x2f_.d1e46.CRM_WSKAZNIK_x2f_.d1e51.CRM_LISTA_ZASOBOW.*" />  -->
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="temp" required="yes"/>
+    <xsl:param name="default_antfile"/>
+    <!--<xsl:param name="loop_xpath" required="yes"/>-->
+    <xsl:param name="loop_xpath_real" required="yes"/>
+    <xsl:template match="builds_to_ant">
+        <project xmlns:gml="http://www.opengis.net/gml"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xmlns:xlink="http://www.w3.org/1999/xlink"
+            xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+            xmlns:wfs="http://www.opengis.net/wfs"
+            xmlns:ogc="http://www.opengis.net/ogc"
+            xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+            basedir="../."
+            name="builds_to_ant_proj{$loop_xpath_real}"
+            default="builds_to_ant{$loop_xpath_real}">
+            <target name="builds_to_ant{$loop_xpath_real}">
+                <xsl:comment> default_antfile: <xsl:value-of select="$default_antfile"/> ; </xsl:comment>
+                
+            <xsl:for-each select="tokenize(.,';')">
+                <echo>
+                    #
+                    #    
+                    #
+                    #
+                        builds_to_ant - za chwile uruchomie antfile  temp/<xsl:value-of select="."/>;
+                    #
+                    #
+                </echo>
+                <ant antfile="{$temp}/{.}" dir="."/>
+            </xsl:for-each>
+            </target>
+        </project>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 201 - 0
SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/escaped_html_to_xml.xsl

@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs system_cache__appinfo"
+    version="2.0">
+    
+    <xsl:output indent="yes"/>
+    
+    
+    
+    
+    
+    
+    
+    
+    <xsl:template name="system_cache__appinfo:escaped_html_to_xml">
+        <xsl:param name="html"/>
+        <xsl:param name="debug" select="false()"/>
+        <xsl:param name="loopno" select="1"/>
+        <xsl:variable name="anal_out">
+            <anal_out>
+                <xsl:for-each select=" tokenize($html,'&lt;') ">
+                    <xsl:variable name="lt_pos" select="position()"/>
+                    <lt>
+                        <xsl:attribute name="lt_pos" select="position()"/>
+                        
+                        <!--<xsl:value-of select="."/>-->
+                        <xsl:for-each select="tokenize(.,'&gt;')">
+                            <gt>
+                                <xsl:attribute name="gtnum" select="position()"/>
+                                <!--<xsl:attribute name="lt_pos" select="$lt_pos"/>-->
+                                
+                                
+                                <xsl:choose>
+                                    <xsl:when test="$lt_pos=1 and position()=1">
+                                        <xsl:attribute name="tag_place" select="'before_tag'"/>
+                                    </xsl:when>
+                                    <xsl:when test="$lt_pos=2 and position()=1">
+                                        <xsl:attribute name="tag_place" select="'first_tag'"/>
+                                    </xsl:when>
+                                </xsl:choose>
+                                <xsl:choose>
+                                    <xsl:when test="position()=1 and $lt_pos&gt;1">
+                                        <xsl:attribute name="is_tag" select="true()"/>
+                                    </xsl:when>
+                                    <xsl:otherwise><xsl:attribute name="is_string" select="true()"/></xsl:otherwise>
+                                </xsl:choose>
+                                <xsl:choose>
+                                    <xsl:when test=" contains(.,'/') and position()=1 and $lt_pos>1"><xsl:attribute name="closing" select="true()"/></xsl:when>
+                                    <xsl:when test=" not(contains(.,'/')) and position()=1 and $lt_pos>1"><xsl:attribute name="closing" select="false()"/></xsl:when>
+                                    <!--<xsl:otherwise><xsl:attribute name="closing" select="false()"/></xsl:otherwise>-->
+                                </xsl:choose>
+                                <xsl:choose>
+                                    <xsl:when test="position()=1 and $lt_pos&gt;1 and not(contains(.,'/')) and contains(.,' ')">
+                                        <xsl:variable name="attributes">
+                                            <xsl:for-each select="tokenize(.,' ')">
+                                                <el><xsl:value-of select="."/></el>
+                                            </xsl:for-each>
+                                        </xsl:variable>
+                                        <xsl:attribute name="attributes" select="$attributes/el[position()&gt;1]"/>
+                                        <xsl:copy-of select="$attributes/el[position()=1]/text()"/>
+                                    </xsl:when>
+                                    <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
+                                </xsl:choose>
+                                <!--<xsl:value-of select="."/>-->
+                            </gt>
+                        </xsl:for-each>
+                    </lt>
+                </xsl:for-each>
+            </anal_out>
+        </xsl:variable>
+        <!--<analyse>
+            <before_tag><xsl:value-of select="$anal_out/anal_out/lt[@ltnum=1]/gt[@gtnum=1]/text()"/></before_tag>
+            <first_tag><xsl:value-of select="$anal_out/anal_out/lt[@ltnum=2]/gt[@gtnum=1]/text()"/></first_tag>
+            <closing_tag></closing_tag>
+            <after_closing_tag></after_closing_tag>
+        </analyse>-->
+        <!--<xsl:copy-of select="$anal_out"/>-->
+        <xsl:variable name="anal_num">
+            <anal_num>
+                <xsl:for-each select="$anal_out/anal_out/lt/gt">
+                    <gt><xsl:attribute name="pos" select="position()"/>
+                        <xsl:copy-of select="@attributes"/>
+                        <xsl:choose>
+                            <xsl:when test="@is_string=true()">
+                                <xsl:attribute name="level" select="0"/>                                
+                                <xsl:value-of select="text()"/></xsl:when>
+                            <xsl:when test="@is_tag=true() and @closing=false()">
+                                <xsl:attribute name="level" select="1"/>
+                                <xsl:choose>
+                                    <xsl:when test=" position()=1">
+                                        <xsl:attribute name="new_gr" select="2"/>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <xsl:attribute name="new_gr" select="1"/>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                                <xsl:attribute name="element" select="text()"/>
+                            </xsl:when>
+                            <xsl:when test="@is_tag=true() and @closing=true()">
+                                <xsl:attribute name="level" select="-1"/>
+                                <xsl:attribute name="element" select="text()"/>
+                            </xsl:when>
+                        </xsl:choose>
+                    </gt>
+                </xsl:for-each>
+            </anal_num>
+        </xsl:variable>
+        <!--<xsl:copy-of select="$anal_num"/>-->
+        <xsl:variable name="anal_num1">
+            <anal_num1>
+                <xsl:for-each select="$anal_num/anal_num/gt">
+                    <gt>
+                        <xsl:copy-of select="@*"/>
+                        <xsl:choose>
+                            <xsl:when test="@level=0 and $anal_num/anal_num/gt[number(@pos)= number(current()/@pos)-1]/@level=1"><xsl:attribute name="level" select="1"/></xsl:when><!-- and $anal_num/anal_num/gt[@pos=current()/@pos-1]/@level= -->
+                            <xsl:when test="@level=0 and $anal_num/anal_num/gt[number(@pos)= number(current()/@pos)-1]/@level=-1"><xsl:attribute name="level" select="-1"/></xsl:when>
+                            <xsl:otherwise><xsl:attribute name="level" select="@level"/></xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:value-of select="text()"/>
+                    </gt>
+                </xsl:for-each>
+            </anal_num1>
+        </xsl:variable>
+        <!--<xsl:copy-of select="$anal_num1"/>-->
+        <xsl:variable name="anal_num_anal">
+            <anal_num_anal>
+                <xsl:for-each select="$anal_num1/anal_num1/gt">
+                    <gt>
+                        <xsl:variable name="cur_pos" select="@pos"/>
+                        <!--<xsl:attribute name="what_sum" select="concat('sum($anal_num/anal_num/gt[@pos&lt;=',$cur_pos,']/@level')" />-->
+                        <xsl:choose>
+                            <xsl:when test="sum($anal_num1/anal_num1/gt[number(@pos)&lt;= number($cur_pos) ]/@level)&lt;0">
+                                <xsl:attribute name="sum_cur" select="1"/>
+                                <xsl:attribute name="sum_cur_293" select="true()"/>
+                            </xsl:when>
+                            <!--<xsl:when test="@level=-1">
+                                <xsl:attribute name="sum_cur" select="sum($anal_num1/anal_num1/gt[number(@pos)&lt;number($cur_pos) ]/@level)+1"/>
+                            </xsl:when>-->
+                            <xsl:otherwise><xsl:attribute name="sum_cur" select="sum($anal_num1/anal_num1/gt[number(@pos)&lt;= number($cur_pos) ]/@level)+1"/></xsl:otherwise>
+                        </xsl:choose>
+                        
+                        <xsl:copy-of select="@*"/>
+                        <xsl:value-of select="text()"/>
+                        <!--<copy>
+                            <xsl:copy-of select="$anal_num/anal_num/gt[  number(@pos)&lt;= number($cur_pos) ]"/>
+                        </copy>-->
+                    </gt>
+                </xsl:for-each>
+            </anal_num_anal>
+        </xsl:variable>
+        <!--<xsl:copy-of select="$anal_num_anal"/>-->
+        <xsl:for-each select="$anal_num_anal/anal_num_anal/gt[@sum_cur=1]"><!-- text outside of first tag -->
+            <xsl:variable name="min_pos_sum_cur_1" select="min($anal_num_anal/anal_num_anal/gt[@sum_cur=1 and number(@pos)&gt;number(current()/@pos)]/@pos)"/>
+            <xsl:value-of select="text()"/>
+            <xsl:for-each select="$anal_num_anal/anal_num_anal/gt[@sum_cur=2 and number(@pos)&gt;number(current()/@pos) and  number(@pos)&lt;number($min_pos_sum_cur_1) and @level=1 ]"><!-- first level tags -->
+                <xsl:element name="{@element}">
+                    <xsl:choose>
+                        <xsl:when test="@attributes">
+                            <xsl:variable name="attributes">
+                                <xsl:for-each select="tokenize(@attributes,' ')">
+                                    <e300><xsl:attribute name="val" select="."/>
+                                        <xsl:for-each select="tokenize(.,'=&quot;')">
+                                            <e302><xsl:attribute name="val" select="."/>
+                                                <!--<xsl:attribute name="{.}" select="true()"/>-->
+                                                <xsl:for-each select="tokenize(.,'&quot;')">
+                                                    <e307>
+                                                        <xsl:attribute name="val" select="."/>
+                                                    </e307>
+                                                </xsl:for-each>
+                                            </e302>
+                                        </xsl:for-each>
+                                    </e300>
+                                </xsl:for-each>
+                            </xsl:variable>
+                            <xsl:for-each select="$attributes/e300">
+                                <xsl:attribute name="{e302[1]/@val}" select="e302[2]/e307[1]/@val"/>
+                            </xsl:for-each>
+                            <!--<xsl:copy-of select="$attributes"/>-->
+                        </xsl:when>
+                    </xsl:choose>
+                    <xsl:variable name="html2">
+                        <xsl:for-each select="$anal_num_anal/anal_num_anal/gt[@sum_cur&gt;2 and number(@pos)&gt;number(current()/@pos) and  number(@pos)&lt;number($min_pos_sum_cur_1) ]"><!-- text of 1 level tags -->
+                            <xsl:choose>
+                                <xsl:when test="@element">&lt;<xsl:value-of select="@element"/>&gt;</xsl:when>
+                                <xsl:otherwise><xsl:copy-of select="text()"/></xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </xsl:variable>
+                    <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:with-param name="html" select="$html2"/>
+                    </xsl:call-template>
+                </xsl:element>
+            </xsl:for-each>
+        </xsl:for-each>
+    </xsl:template>
+    
+    
+    
+</xsl:stylesheet>

+ 53 - 0
SE/schema/ant-url_action/default_db.crm_proces/CRM_PROCES_tree/main_build_recurse_ant.dita

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<RelatedFeature xpath="ID"  typeName="p5_default_db:CRM_PROCES"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:noNamespaceSchemaLocation="../../../default_db_xml_cache.public/topicProcesy5.xsd">
+  <!-- oznacza to refa z w $var=ID_BILLING_OWNER jest FeatureID=BILLING_OWNER.$var do sciagniecia z p5_default_db:BILLING_OWNER -->
+  <!--https://biuro.biall-net.pl/SE/version-git/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/out/null400667363.pdf-->
+<topic id="CRM_PROCES_tree" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+  <title><ph>Proces nr </ph><ph xpath="PARENT_ID"/><ph>-</ph><ph xpath="ID"/>
+    <ph>z dnia</ph>
+    <ph xpath="A_RECORD_CREATE_DATE"/> <ph>/</ph> <ph xpath="A_RECORD_UPDATE_DATE"/></title>
+  <body>
+    <p> Opis <ph xpath="DESC"></ph></p>
+    <p> Opis pelny <ph xpath="OPIS"></ph></p>
+    <p><b>Powiazane wskazniki (inne dokumenty w sprawie)</b></p>
+    <p>
+      <table>
+        <tgroup cols="6">
+          <thead>
+            <row>
+              <entry>OPIS_ZASOB</entry>
+              <entry>TYP</entry>
+              <entry>ID_PRZYPADEK</entry>
+              <entry>ZASOB ID</entry>
+              <entry>ZASOB TYPE</entry>
+              <entry>ZASOB DESC</entry>
+            </row>
+          </thead>
+          <tbody>
+            <RelatedFeature xpath="ID_PROCES" xpath_value="../ID" typeName="p5_default_db:CRM_WSKAZNIK">  
+              <row>
+                <entry xpath="OPIS_ZASOB" />
+                <entry xpath="TYP"/>
+                <entry xpath="ID_PRZYPADEK"/>
+                  <RelatedFeature xpath="ID" xpath_value="../ID_ZASOB" typeName="p5_default_db:CRM_LISTA_ZASOBOW">  
+                      <entry xpath="ID" />
+                      <entry xpath="TYPE"/>
+                     <entry xpath="DESC"/>
+                    <RelatedFeature xpath="ID" xpath_value="../ID_ZASOB" typeName="p5_default_db:CRM_LISTA_ZASOBOW">  
+                      <entry xpath="ID" />
+                      <entry xpath="TYPE"/>
+                      <entry xpath="DESC"/>
+                    </RelatedFeature>
+                  </RelatedFeature>
+              </row>
+            </RelatedFeature>
+          </tbody>
+        </tgroup>
+      </table>
+    </p> 
+  </body>
+</topic>
+</RelatedFeature>