a.binder 8 anos atrás
pai
commit
32548a702c
15 arquivos alterados com 3288 adições e 26 exclusões
  1. 3 2
      SE/schema/WPS_Functions/build_WPS_Functions.xml
  2. 8 2
      SE/schema/ant-url_action/default_db.bi_audit_energa_rum_kontrahenci_powiazania/bi_audit_energa_rum_kontrahenci_powiazania/build_bi_audit_energa_rum_kontrahenci_powiazania.xml
  3. 42 8
      SE/schema/default_db_xml_cache.public/builds_to_ant.xsl
  4. 1314 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl
  5. 556 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors/BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors_tree_to_dita.xsl
  6. 1 1
      SE/schema/default_db_xml_cache.public/default_db/CRM_PROCES/PROCES_INIT_tree_to_dita.xsl
  7. 281 0
      SE/schema/default_db_xml_cache.public/default_db/EXAMPLE/EXAMPLE_tree_to_dita.xsl
  8. 150 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplot.xsl
  9. 87 1
      SE/schema/default_db_xml_cache.public/default_db/images/images.xsl
  10. 11 7
      SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.xsl
  11. 754 0
      SE/schema/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl
  12. 7 3
      SE/schema/default_db_xml_cache.public/object_modeling_new_by_xml_schema.xsl
  13. 59 0
      SE/schema/default_db_xml_cache.public/system_cache__appinfo/external_schema_targetNamespace.xsl
  14. 2 2
      SE/schema/default_db_xml_cache.public/system_cache__appinfo/postprocess.xsl
  15. 13 0
      SE/schema/default_db_xml_cache.public/truncate_special_and_do_uppercase.xsl

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

@@ -135,8 +135,9 @@
             <param name="WPS_Functions" expression="${WPS_Functions}"/>
         </xslt>
         <ant antfile="${build_WPS_Functions.childproperties.builds.xml}" inheritall="yes" inheritrefs="yes"/>
-        
-    </target><target name="save_build_properties" > <!-- todo nie wiem czy trzymac properties tu i tam - do optymalziacji-->
+    </target>
+    
+    <target name="save_build_properties" > <!-- todo nie wiem czy trzymac properties tu i tam - do optymalziacji-->
         <!-- ${uuid} -->
         <ant antfile="${build_root.xml}"  target="save_build_properties"/>
         <loadproperties srcfile="${build_properties}"/>

+ 8 - 2
SE/schema/ant-url_action/default_db.bi_audit_energa_rum_kontrahenci_powiazania/bi_audit_energa_rum_kontrahenci_powiazania/build_bi_audit_energa_rum_kontrahenci_powiazania.xml

@@ -39,6 +39,10 @@
     <property name="CRM_PROCES_tree_basedir" location="${basedir}/../CRM_PROCES_tree"  />                         
     <property name="CRM_PROCES_tree_basedir.temp" location="${CRM_PROCES_tree_basedir}/temp"  />
     
+    <property name="WPS_Functions" location="../../../WPS_Functions"/>
+    <property name="build_root.xml" location="../../../build.xml"/>
+    <property name="build_SE.xml" location="../../../../build_SE.xml"/>
+    
     <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>
     
     
@@ -68,8 +72,8 @@
    
     <target name="bi_audit_energa_rum_kontrahenci_powiazania"  depends="check_default_db_xml_cache.public_default,read_build_properties" description="URL_TASK Wygeneruj druk bi_audit_energa_rum_kontrahenci_powiazania">
         <tempfile property="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point.txt" prefix="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point" destdir="${temp}" suffix=".txt"/>
-        <loadfile property="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point" srcfile="${BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point.txt}"/>
-        <echo> BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point ${BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point} </echo>
+        
+        
         
         
         
@@ -81,7 +85,9 @@
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <param name="WPS_Functions" expression="${WPS_Functions}"/>
         </xslt>
+        <loadfile property="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point" srcfile="${BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point.txt}"/>
         
+        <echo> BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point ${BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_COLUMN.mount_point} </echo>
         
         <!-- ${procesy5_config.folders.properties.xml} - read folder 
         

+ 42 - 8
SE/schema/default_db_xml_cache.public/builds_to_ant.xsl

@@ -9,7 +9,7 @@
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     
-    <xsl:param name="temp" required="yes"/>
+    <xsl:include href="get_all_xsd.xsl"/><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"/>
@@ -23,13 +23,15 @@
     <xsl:param name="build_check_java_process_count.xml" required="yes"/>
     <xsl:param name="parallel_java_process_max" required="yes"/>
     <xsl:param name="loop_xpath" /> <!-- required="yes" , added at @2017-04-14 to concat $temp in exec --> 
-    <xsl:param name="feature_pos"/>
-    <xsl:param name="feature_pos_parent"/> <!-- do wykluczenia bledow z przejsciem przez loop jak jest wiecej elementow Proces_tree -->
+    <xsl:param name="feature_pos" required="yes"/>
+    <xsl:param name="feature_pos_parent" required="yes"/> <!-- do wykluczenia bledow z przejsciem przez loop jak jest wiecej elementow Proces_tree -->
     <xsl:param name="process_locks"/>
     <xsl:param name="uuid" required="yes"/>
     <xsl:param name="debug" select="1"/>
     
-    <xsl:variable name="xpath_query_test">
+    <xsl:param name="xml_id" required="yes"/>
+    <xsl:param name="recurse_ant_basedir.recurse_cache"/>
+    <xsl:param name="typeNameRoot" required="yes"/><xsl:variable name="xpath_query_test">
         <xsl:choose>
             <xsl:when test="$xpath_query_test.xml">
                 <xsl:copy-of select="doc($xpath_query_test.xml)"/>
@@ -129,7 +131,7 @@
                                 <!--<ant antfile="{$temp}/{$loop_xpath}/{.}/build.xml" dir="." inheritall="false">
                                     <property name="parallel_pos" value="{position()}"/>
                                 </ant>--> <!-- CHANGED from ${temp}/{.} -->
-                                <java>
+                                <sequential><java>
                                     <xsl:attribute name="jar" select="$ant-launcher.jar"/>
                                     <!--<xsl:attribute name="classname" select="'org.apache.tools.ant.Main'"/>-->
                                     <!--<xsl:attribute name="dir" select="'${basedir}'"/>-->
@@ -142,7 +144,39 @@
                                     <arg value="-buildfile"/>
                                     <arg value="{$temp}/{$loop_xpath}/{.}/build.xml"/>
                                 </java>
-                            </xsl:for-each>
+                            <loadfile  property="builds_to_ant_cache_fid_ant{$loop_path_recurs}{$loop_xpath_real}{$xml_id}.{$feature_pos_parent}.{position()}" srcfile="{$temp}/{$loop_xpath}/{position()}.fid_parent.txt"/>
+                                    
+                                    <!-- THIS SHOULD BE THE SAME AS IN build_recurse_ant.xsl/builds_to_ant.xsl (to be template) line 1000 name CACHE_COPY_TASK - EOF -->
+                                    
+                                    <echo> #146 builds_to_ant detected fid *.fid_parent.txt <xsl:value-of select="concat('${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/></echo>
+                                   
+                                   <!-- <mkdir>
+                                        <xsl:attribute name="dir" select="concat($recurse_ant_basedir.recurse_cache,'/',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/>
+                                    </mkdir>
+                                   
+                                    <!-\- child elements -\->
+                                    <mkdir>
+                                        <xsl:attribute name="dir" select="concat($recurse_ant_basedir.recurse_cache,'/',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}','/_child_',$xml_id,'.',$feature_pos_parent,'.', position())"/>
+                                    </mkdir>
+                                    <copy failonerror="false"> <!-\- we copy important files to cache. Recursed cached files should be already aliased in child process (smallest parts)  -\->
+                                        <xsl:attribute name="todir" select="concat($recurse_ant_basedir.recurse_cache,'/',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}','/_child_',$xml_id,'.',$feature_pos_parent,'.', position()  )"/>
+                                        <fileset dir="{$temp}/{$loop_xpath_real}" includes="*" /> <!-\- {@xml_id}. -\->
+                                    </copy>
+                                    
+                                    <!-\- root elements -\->
+                                    
+                                    
+                                    <copy failonerror="false"> <!-\- we copy important files to cache. Recursed cached files should be already aliased in child process (smallest parts)  -\->
+                                        <xsl:attribute name="todir" select="concat($recurse_ant_basedir.recurse_cache,'/',system_cache__appinfo:escape_object_prefix_to_string($typeNameRoot),'.','${builds_to_ant_cache_fid_ant',$loop_path_recurs,$loop_xpath_real,$xml_id,'.',$feature_pos_parent,'.', position(),'}')"/>
+                                        <fileset dir="{$temp}/{$loop_xpath}/../" includes="{tokenize($loop_xpath_real,'/')[count(tokenize($loop_xpath_real,'/'))]}.*" />
+                                        <fileset dir="{$temp}/{$loop_xpath}/../" includes="{ $feature_pos}.fid_parent.txt" /><!-\- ostatni po / wartosc sciezki -\->
+                                    </copy>-->
+                                    
+                                  
+                                    
+                                    <!-- EOF THIS SHOULD BE THE SAME AS IN build_recurse_ant.xsl/builds_to_ant.xsl (to be template) line 1000 name CACHE_COPY_TASK  -->
+                                    
+                                </sequential></xsl:for-each>
                         </parallel>
                         <!--<delete>
                             <xsl:attribute name="file" select="concat('${builds_to_ant_lock',$loop_path_recurs,$loop_xpath_real,'}')"/>
@@ -271,7 +305,7 @@
                                         <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
                                     </xsl:element>
                                 </exec>-->
-                                <java>
+                                <sequential><java>
                                     <xsl:attribute name="jar" select="$ant-launcher.jar"/>
                                     <!--<xsl:attribute name="classname" select="'org.apache.tools.ant.Main'"/>-->
                                     <xsl:attribute name="dir" select="concat($temp,'/',$loop_xpath,'/',.)"/>
@@ -287,7 +321,7 @@
                                         <xsl:attribute name="line" select="concat('-Dparallel_pos=',position())"/>
                                     </xsl:element>
                                 </java>
-                            </xsl:for-each>
+                            </sequential></xsl:for-each>
                         </parallel>
                         
                         

+ 1314 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl

@@ -0,0 +1,1314 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <!--<xsl:param name="xref_level" select="5"/>-->
+    
+    
+    <xsl:variable name="KRS_own">
+        <KRS_own>
+            <KRS>0000033455</KRS>
+            <KRS>0000049425</KRS>
+            <KRS>0000207049</KRS>
+            <KRS>0000372150</KRS>
+            <KRS>0000381284</KRS>
+            <KRS>0000391862</KRS>
+            <KRS>0000438248</KRS>
+            <KRS>0000538920</KRS>
+            <KRS>0000538927</KRS>
+            <KRS>0000538929</KRS>
+            <KRS>0000538935</KRS>
+            <KRS>0000538947</KRS>
+            <KRS>0000538948</KRS>
+            <KRS>0000538966</KRS>
+            <KRS>0000539158</KRS>
+            <KRS>0000539818</KRS>
+            <KRS>0000540064</KRS>
+            <KRS>0000033455</KRS><!-- ENERGA-OPER -ATOR SPÓŁKA AKCYJNA -->
+            <KRS>0000007426</KRS>
+            <KRS>0000025667</KRS>
+        </KRS_own>
+    </xsl:variable>
+    
+    
+   
+    
+    <xsl:template match="RelatedFeatureRoot" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA">
+        <xsl:message>#37 template match="RelatedFeatureRoot" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"</xsl:message>
+        <xsl:apply-templates mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+    </xsl:template>
+    
+    <xsl:template match="*|comment()|text()" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA">
+        <xsl:message>#42 template match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"</xsl:message>
+        <!-- Now search for dita_graphs -->
+        <xsl:variable name="dita">
+            <xsl:apply-templates select="." mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.dita"/>
+        </xsl:variable>
+        
+        <xsl:for-each select="$dita//simpletable">
+            <xsl:apply-templates select="." mode="system_cache__dita:graph__write_dita_preprocess">
+                <xsl:with-param name="fileindex" select="@id"/>
+            </xsl:apply-templates>
+        </xsl:for-each>
+        
+    </xsl:template>
+    
+    <xsl:template match="RelatedFeatureRoot" mode="postprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old" mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row"/>
+      
+    
+    
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" mode="ditamap_root">
+        <!--<xsl:result-document href="energa_bledy_rum.ditamap">-->
+            <map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:map.xsd">
+                <title>raport z przetwarzania Powiązań
+                oprac. A.Binder Rip/Procesy5
+                </title>
+                <!-- osoby Akceptujacy_merytorycznie___nazwisko_i_imie -->
+                <xsl:variable name="resulset" select="."/> <!-- current() -->
+                
+                <!--<xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" select="."/>-->
+                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA">
+                    <xsl:for-each-group select="BI_audit_ENERGA_PRACOWNICY" group-by="pesel">
+                        <xsl:copy-of select="."/>
+                    </xsl:for-each-group>
+                <!--$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA//BI_audit_ENERGA_PRACOWNICY[pesel/text()=$current_pesel_2][1]-->
+                </xsl:variable>
+                
+                <xsl:variable name="sources">
+                    <sources>
+                        <xsl:for-each-group select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="source">
+                            <source><xsl:value-of select="source"/></source>
+                        </xsl:for-each-group>
+                    </sources>
+                </xsl:variable>
+                
+                
+                <xsl:variable name="interested_row">
+                    <interested_row>
+                        <xsl:for-each select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row">
+                            <!--<xsl:variable name="test">
+                                <test>
+                                <xsl:for-each select="object/*[ position() = 1]">
+                                    <xsl:variable name="cur" select="."/>
+                                    <xsl:for-each select="$KRS_search/KRS_search/KRS">
+                                        <xsl:choose>
+                                            <xsl:when test="$cur/krs = ."><OK/></xsl:when>
+                                        </xsl:choose>
+                                    </xsl:for-each>
+                                </xsl:for-each>
+                                </test>
+                            </xsl:variable>-->
+                            <xsl:variable name="test">
+                                <test>
+                                    <xsl:variable name="cur_krs" select="object[ position() = last() ]/BI_audit_ENERGA_RUM_KONTRAHENCI/KRS"/>
+                                    <xsl:if test="not($KRS_own//KRS/text() = $cur_krs)"><OK/></xsl:if>
+                                </test>
+                            </xsl:variable>
+                            <xsl:choose>
+                                <xsl:when test="$test/test/OK">
+                                    <xsl:message>#76 OKOK  trasa <xsl:value-of select="position()"/></xsl:message>
+                                    <xsl:copy-of select="."/>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:message>#76 unwanted trasa <xsl:value-of select="position()"/></xsl:message>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </interested_row>
+                </xsl:variable>
+                
+                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI_filtered">
+                    <BI_audit_ENERGA_RUM_KONTRAHENCI_filtered>
+                        <xsl:for-each select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI">
+                            <xsl:choose>
+                                <xsl:when test="$interested_row//BI_audit_ENERGA_RUM_KONTRAHENCI/ID = current()/ID ">
+                                    <xsl:copy-of select="."/>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </BI_audit_ENERGA_RUM_KONTRAHENCI_filtered>
+                </xsl:variable>
+                
+                <topichead navtitle="Statystyka ilości powiązań">
+                    <topicref href="statystyka_pracownik.dita">
+                        <xsl:result-document href="{$temp}/{$uuid}/statystyka_pracownik.dita">
+                            <xsl:apply-templates select="." mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.dita"/>
+                        </xsl:result-document>
+                    </topicref>
+                </topichead>
+                
+                <topichead navtitle="Powiązania od Pracowników do Kontrahentow - lista odnośników (źródła)">
+                    <xsl:for-each select="$sources/sources/source">
+                        <topichead navtitle="żródło:{.} Powiązania od Pracowników do Kontrahentow">
+                            <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ object[position() = 1]/*/source= current() ]" group-by="object[position() = 1]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip)">
+                                <xsl:sort select=" count(.)"/>
+                                <xsl:variable name="group_name" select="system_cache__appinfo:truncate_special_and_do_uppercase(object[position() = 1]/*[ position() = 1] /concat(imiona,'_',nazwisko,'_',nip,'_LISTA'))"/>
+                                <xsl:variable name="refpos" select="concat(object[ position() = last()]/* [ position() = 1]/concat(name(),ID),'_', position())"/>
+                                <!--<topichead navtitle="{object[position() = 1]/*/concat(imiona,' ',nazwisko,' ',nip)} powiązań ({ count( current-group())}) ">-->
+                                <!--<topicref href="{$group_name}/{$refpos}.dita">-->
+                                    <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA" select=".">
+                                        <xsl:sort select="object[position() =  last()]/*[ position() = 1]/ID"/>                                
+                                        <xsl:with-param name="group_name" select="$group_name"/>
+                                        <xsl:with-param name="refpos" select="$refpos"/>
+                                    </xsl:apply-templates>
+                                <!--</topicref>-->
+                                <!--</topichead>-->
+                            </xsl:for-each-group>
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>
+                
+                <!--<topichead navtitle="Grupa głównych ścieżek wychodzących z przykładami (źródła)">
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:message>#103 Grupa głównych ścieżek wychodzących z przykładami (źródła): <xsl:value-of select="."/></xsl:message>
+                        <topichead navtitle="ścieżka dla źródła {.}">
+                            <xsl:for-each-group select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ object[position() = 1]/*/source= current() ]" group-by="(object[position() &gt; 3]/BI_audit_KRS/ID)[ position() = 1] ">
+                                <xsl:sort select=" count(.)"/>
+                                <xsl:variable name="refpos" select="(object[position() &gt; 3]/BI_audit_KRS)[ position() = 1]/concat(krs,'_', position())"/>
+                                <xsl:variable name="group_name" select="(object[position() &gt; 3]/BI_audit_KRS)[ position() = 1]/concat('KRSY_',krs)"/>
+                              
+                                <topicref href="{$group_name}/{$refpos}.dita"/>
+                                <!-\-</topicref>-\->
+                                <!-\-</topichead>-\->
+                            </xsl:for-each-group>
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>-->
+                
+                <topichead navtitle="Powiązania pogrupowane pod kątem pochodzenia źródła danych do kontrahentow ">
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:variable name="source" select="."/>
+                        <xsl:message>#112 analyzing source: <xsl:value-of select="$source"/> Powiązania pogrupowane pod kątem pochodzenia źródła danych do kontrahentow </xsl:message>
+                        <topichead navtitle="Źródło danych ({.}) - Powiązania">
+                            <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[not(object[ position() = last()]/BI_audit_KW_requested_person) and object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/source = $source  ]  " group-by="object[position() = 1]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip)">
+                                    <xsl:sort select=" count(.)"/>
+                                    <xsl:variable name="group_name" select="system_cache__appinfo:truncate_special_and_do_uppercase(object[position() = 1]/*[ position() = 1] /concat(imiona,'_',nazwisko,'_',nip))"/>
+                                    <topichead navtitle="{object[position() = 1]/*/concat(imiona,' ',nazwisko,' ',nip)} powiązań ({ count( current-group())}) ">
+                                    <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" select=".">
+                                        <xsl:sort select="object[position() =  last()]/*[ position() = 1]/ID"/>                                
+                                        <xsl:with-param name="group_name" select="$group_name"/>
+                                        <xsl:with-param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+                                    </xsl:apply-templates>
+                                    </topichead>
+                                </xsl:for-each-group>
+                         </topichead>
+                    </xsl:for-each>
+                </topichead>
+                
+                <!-- CSV RAPORT -->
+                <xsl:result-document href="{$temp}/{$uuid}/RAPORT.csv" omit-xml-declaration="yes" >
+                    <xsl:text>"nr";"nazwisko";"nip";"firma";"nip";"miejscowosc";"info";"głębokość;źródło"</xsl:text>
+                    <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" group-by="object[position() = 1]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip)">
+                        <xsl:sort select=" count(.)"/>
+                        <xsl:variable name="group_name" select="system_cache__appinfo:truncate_special_and_do_uppercase(object[position() = 1]/*[ position() = 1] /concat(imiona,'_',nazwisko,'_',nip))"/>
+                        <xsl:for-each-group select="current-group()" group-by="object[position() = last()]/*[ position() = 1]/concat(name(),ID)">
+                            "<xsl:value-of select="position()"/>";"<xsl:value-of select="object[position() = 1]/*[ position() = 1]/concat(imiona,' ',nazwisko)"/>";"<xsl:value-of select="object[position() = 1]/*[ position() = 1]/nip"/><xsl:text>";"</xsl:text><xsl:value-of select="object[ position() = last()]/*[ position() = 1]/Pelna_nazwa_kontrahenta"/>";"<xsl:value-of select="object[ position() = last()]/*[ position() = 1]/NIP"/>";"<xsl:value-of select="object[ position() = last()]/*[ position() = 1]/Miejscowosc"/>";"<xsl:value-of select="object[ position() = last()]/*[ position() = 1]/concat(Nr_dzialki,' ',Nr_KW)"/><xsl:text>";"</xsl:text><xsl:value-of select="count(object)"/>";<xsl:value-of select="object[position() = 1]/*[ position() = 1]/source"/>;</xsl:for-each-group>
+                    </xsl:for-each-group>
+                </xsl:result-document>
+                
+                
+                <topichead navtitle="Powiązania od Pracowników do Działek (podział na źródła)">
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:variable name="source" select="."/>
+                        <topichead navtitle="żródło:{$source} Powiązania od Pracowników do Działek">
+                            <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[ position() = last() ]/BI_audit_KW_requested_person  and object[position() = 1]/*/source= current()]" group-by="object[position() = 1]/*[ position() = 1]/concat(ID,imiona,nazwisko,pesel,nip)">
+                                <xsl:sort select=" count(.)"/>
+                                <xsl:variable name="group_name" select="system_cache__appinfo:truncate_special_and_do_uppercase(object[position() = 1]/*[ position() = 1]/concat(imiona,'_',nazwisko,'_',nip))"/>
+                                <topichead navtitle="{object[position() = 1]/BI_audit_ENERGA_PRACOWNICY/concat(imiona,' ',nazwisko,' ',nip,' ')} powiązań ({ count( current-group())}) ">
+                                    <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" select=".">
+                                        <xsl:sort select="object[position() =  last()]/*/ID"/>                                
+                                        <xsl:with-param name="group_name" select="$group_name"/>
+                                        <xsl:with-param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+                                    </xsl:apply-templates>
+                                </topichead>
+                            </xsl:for-each-group>
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>
+                
+                    
+                <!--<topichead navtitle="Powiązania od Pracowników do Działek">
+                    <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[ position() = last()]/BI_audit_KW_requested]" group-by="object[position() = 1]/*/concat(name(),ID,imiona,nazwisko,pesel,nip)">
+                        <xsl:sort select=" count(.)"/>
+                        <xsl:variable name="group_name" select="system_cache__appinfo:truncate_special_and_do_uppercase(object[position() = last() ]/*/concat(ID,' ',Id_BI_audit_KW_requested,' ',nip))"/>
+                        <topichead navtitle="{object[position() = 1]/*/concat(imiona,' ',nazwisko,' ',nip)} powiązań ({ count( current-group())}) ">
+                            <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" select="current-group()">
+                                <xsl:sort select="object[position() =  last()]/*/ID"/>                                
+                                <xsl:with-param name="group_name" select="$group_name"/>
+                            </xsl:apply-templates>
+                        </topichead>
+                    </xsl:for-each-group>
+                </topichead>-->
+                <!--<topichead navtitle="Powiązania do kontrahentów z którymi zawarto umowy (podział na źródła)(przed uzupełnieniem danych)">
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:variable name="source" select="."/>
+                        <topichead navtitle="żródło: {.} - Powiązania do kontrahentów z którymi zawarto umowy">
+                            <xsl:for-each-group select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI and  object[position() = 1]/*/source= $source]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
+                                <xsl:variable name="group_name" select="object[position() = last() ]/* [ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta,position()))"/>
+                                
+                                <!-\-<topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-\->
+                                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select=" object[ position() = last()]/ BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                <xsl:choose>
+                                    <xsl:when test="//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID=$BI_audit_ENERGA_RUM_KONTRAHENCI.ID">
+                                        <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_do" select="current-group()[position() = 1]">
+                                            <xsl:with-param name="group_name" select="$group_name"/>
+                                            <xsl:with-param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+                                        </xsl:apply-templates> 
+                                    </xsl:when>
+                                </xsl:choose>
+                                <!-\-</topichead>-\->
+                            </xsl:for-each-group>
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>-->
+                
+                
+                
+                <topichead navtitle="Powiązania do kontrahentów z którymi zawarto umowy">
+                    
+                    <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI ]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
+                                <xsl:variable name="group_name" select="object[position() = last() ]/* [ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta,position()))"/>
+                                <xsl:variable name="kontrahent_id" select="object[position() = last() ]/* [ position() = 1]/ID"/>
+                                <xsl:variable name="current_group" select="current-group()"/>
+                                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select=" object[ position() = last()]/ BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                <!--<topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-->
+                                
+                                <xsl:choose>
+                                    <xsl:when test="$resulset//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID=$BI_audit_ENERGA_RUM_KONTRAHENCI.ID">
+                                        <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_do" select="current-group()[ position() = 1]">
+                                            <xsl:with-param name="group_name" select="$group_name"/>
+                                            <xsl:with-param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+                                            <xsl:with-param name="resulset" select="$resulset"/>
+                                        </xsl:apply-templates>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        
+                                    </xsl:otherwise>
+                                </xsl:choose> 
+                                <!--</topichead>-->
+                            </xsl:for-each-group>
+                </topichead>
+                
+                
+                
+                <topichead navtitle="Powiązania wykryte po wyrywkowym uzupełnieniu danych (w przypadku dowiązania raportu porównawczego) ">
+                    
+                    <xsl:message>#233 Powiązania wykryte po wyrywkowym uzupełnieniu danych</xsl:message>    
+                    <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI ]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
+                                <xsl:variable name="group_name" select="object[position() = last() ]/*[ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta, position()))"/>
+                                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select=" object[ position() = last()]/ BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                <!--topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) {$BI_audit_ENERGA_RUM_KONTRAHENCI.ID}">-->
+                                
+                                <xsl:choose>
+                                    <xsl:when test="$resulset//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID=$BI_audit_ENERGA_RUM_KONTRAHENCI.ID">
+                                        <!--<topichead navtitle="było wcześniej znalezione i pominieto dla {$BI_audit_ENERGA_RUM_KONTRAHENCI.ID}"/>-->
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_do" select="current-group()[ position() = 1]">
+                                            <xsl:with-param name="group_name" select="$group_name"/>
+                                            <xsl:with-param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+                                            <xsl:with-param name="resulset" select="$resulset"/>
+                                            <xsl:with-param name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select="$BI_audit_ENERGA_RUM_KONTRAHENCI.ID"/>
+                                        </xsl:apply-templates>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                                
+                                <!--                        </topichead>-->
+                            </xsl:for-each-group>
+                        
+                </topichead>
+                
+                <topichead navtitle="Powiązania do kontrahentów z którymi zawarto umowy (podział na źródła)(podział na spółki własne)">
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:variable name="source" select="."/>
+                        <topichead navtitle="żródło: {.} -(podział na spółki własne)  Powiązania do kontrahentów z którymi zawarto umowy">
+                            
+                            <xsl:for-each-group select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_UMOWY" group-by="Spolka_glowna">
+                                <xsl:variable name="spolka_glowna" select="Spolka_glowna[1]"/>
+                                
+                                
+                                <xsl:variable name="if_topic">
+                                    <xsl:message>#268 if topic for <xsl:value-of select="$spolka_glowna"/>;</xsl:message>
+                                    <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI and  object[position() = 1]/*/source= $source]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
+                                        <xsl:variable name="group_name" select="object[position() = last() ]/* [ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta,position()))"/>
+                                        <xsl:variable name="kontrahent_id" select="object[position() = last() ]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                        <xsl:variable name="current_group" select="current-group()"/>
+                                        <!--<xsl:variable name="zrodlo" select="."/>-->
+                                        <xsl:message>#346 kontr podzial go <xsl:value-of select="position()"/> / id: <xsl:value-of select="$kontrahent_id"/> / <xsl:value-of select="$spolka_glowna"/></xsl:message>
+                                        <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select=" object[ position() = last()]/ BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                        <!--<topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-->
+                                        
+                                        <xsl:for-each select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[ID=$kontrahent_id and BI_audit_ENERGA_RUM_UMOWY/Spolka_glowna=$spolka_glowna]">
+                                            <xsl:if test="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI[ID = $kontrahent_id]">
+                                                <topicref href="{$group_name}_DO/1.dita"/>
+                                            </xsl:if>
+                                            
+                                        </xsl:for-each>
+                                    </xsl:for-each-group>
+                                </xsl:variable>
+                                
+                                <xsl:choose>
+                                    <xsl:when test="$if_topic/*">
+                                        <topichead navtitle="żródło: {$source} spółka gł:{$spolka_glowna} ">
+                                            <xsl:message>#267 podzial spolka glowna: <xsl:value-of select="$spolka_glowna"/></xsl:message>
+                                            <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI and  object[position() = 1]/*/source= $source]" group-by="object[position() =  last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/concat(ID,Pelna_nazwa_kontrahenta)">
+                                                <xsl:variable name="group_name" select="object[position() = last() ]/* [ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta,position()))"/>
+                                                <xsl:variable name="kontrahent_id" select="object[position() = last() ]/* [ position() = 1]/ID"/>
+                                                <xsl:variable name="current_group" select="current-group()"/>
+                                                <!--<xsl:variable name="zrodlo" select="."/>-->
+                                                
+                                                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select=" object[ position() = last()]/ BI_audit_ENERGA_RUM_KONTRAHENCI/ID"/>
+                                                <!--<topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-->
+                                                
+
+                                                <xsl:for-each select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[ID=$kontrahent_id and BI_audit_ENERGA_RUM_UMOWY/Spolka_glowna=$spolka_glowna]">
+                                                    <xsl:message> #270 $kontrahent =<xsl:value-of select="$group_name"/></xsl:message>
+                                                    <xsl:if test="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI[ID = $kontrahent_id]">
+                                                        <topicref href="{$group_name}_DO/1.dita"/>
+                                                    </xsl:if>
+                                                </xsl:for-each>
+                                                
+                                                <!--</topichead>-->
+                                            </xsl:for-each-group>
+
+                                        </topichead>
+                                    </xsl:when>
+                                </xsl:choose>
+                                
+                            </xsl:for-each-group>
+
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>
+                
+                <topichead navtitle="Powiązania do kontrahentów z KRS ogólnie (podział na źródła)">
+                    
+                    <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs_uniq">
+                        <BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs_uniq>
+                            <xsl:for-each select="$sources/sources/source">
+                                <xsl:variable name="source" select="."/>
+                                    <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() = 1]/*/source= current()]/object/BI_audit_KRS" group-by="krs">
+                                        <xsl:variable name="group_name" select="concat('KRSY_',krs)"/>
+                                        <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select="krs"/>
+                                        <krs>
+                                            <xsl:attribute name="krs" select="krs"/>
+                                            <xsl:attribute name="source" select="$source"/>
+                                        </krs>
+                                    </xsl:for-each-group>
+                            </xsl:for-each>
+                        </BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs_uniq>
+                    </xsl:variable>
+                    
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:variable name="source" select="."/>
+                        <xsl:message>#286 Powiązania do kontrahentów z KRS ogólnie (podział na źródła) = <xsl:value-of select="."/></xsl:message>
+                        <topichead navtitle="żródło:{.}  Powiązania do kontrahentów z KRS ogólnie">
+                            <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[object[position() = 1]/*/source= current()]/object/BI_audit_KRS" group-by="krs">
+                                <xsl:variable name="group_name" select="concat('KRSY_',krs)"/>
+                                <!--<topichead navtitle="{object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-->
+                                <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" select="krs"/>
+                                <!--<xsl:choose>
+                                    <xsl:when test="//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID=$BI_audit_ENERGA_RUM_KONTRAHENCI.ID">-->
+                                        <xsl:choose>
+                                            <xsl:when test="count($BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs_uniq/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs_uniq/krs[@krs = current()/krs]) &gt; 1">
+                                                <xsl:variable name="min" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs_uniq/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs_uniq/krs[@krs = current()/krs][1]"/>
+                                                <xsl:choose>
+                                                    <xsl:when test="$source = $min/@source">
+                                                        <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs" select="." >
+                                                            <xsl:with-param name="group_name" select="$group_name"/>
+                                                        </xsl:apply-templates>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xsl:variable name="refpos" select="concat(krs,'_', position())"/>
+                                                        <topicref href="{$group_name}/{$refpos}.dita"/>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </xsl:when>
+                                            <xsl:otherwise>
+                                                <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs" select="." >
+                                                    <xsl:with-param name="group_name" select="$group_name"/>
+                                                </xsl:apply-templates>
+                                            </xsl:otherwise>
+                                        </xsl:choose>
+                                 
+                                    <!--</xsl:when>
+                                </xsl:choose>-->
+                                <!--</topichead>-->
+                            </xsl:for-each-group>
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>
+                
+                
+                
+                <!--<topichead navtitle="Do wykonania - błędne numery NIP w kontrahentach wskazujące na spółkę ENERGII!"></topichead>-->
+                
+                
+                
+            </map>
+        <!--</xsl:result-document>-->
+    </xsl:template>
+    
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.dita">
+        
+        <topic id="topic_simpletable_statystyka_pracownik.dita" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title>Statystyka powiązań    
+                
+            </title>
+            <body>
+                
+                    <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                        <p><xsl:value-of select="ID"/> - <xsl:value-of select="nazwisko"/><xsl:text> </xsl:text> <xsl:value-of select="imiona"/><xsl:text> </xsl:text>źródło:<xsl:value-of select="source"/></p>
+                    </xsl:for-each-group>
+                
+                <xsl:variable name="simpletable"> 
+                    <simpletable frame="all" id="topic_simpletable_statystyka_pracownik.dita_table">
+                        <strow>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                                <stentry><xsl:value-of select="ID"/></stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                        <strow>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                                <xsl:variable name="pracownik" select="ID"/>
+                                <stentry><xsl:value-of select=" count( current-group() )"/></stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                    </simpletable>
+                </xsl:variable>
+                <p> Ilości powiązań <note>Uwaga, w przypadku odnalezionych kilku tras do tego samego kontrahenta pokazywana jest jedna trasa (wykres nie zawiera tego ograniczenia)</note>
+                    <xsl:copy-of select="$simpletable"/>
+                    <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                        <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                        <xsl:with-param name="width" select="700"/>
+                    </xsl:apply-templates>
+                </p>
+                
+                
+                <xsl:variable name="current" select="."/>
+                
+                
+                <xsl:variable name="simpletable"> 
+                    <simpletable frame="all" id="topic_simpletable_statystyka_pracownik.dita_table_srednie">
+                        <strow>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                                <stentry><xsl:value-of select="ID"/></stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                        <strow>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                                <xsl:variable name="pracownik" select="ID"/>
+                                <stentry><xsl:value-of select=" round(count( $current/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/ID=$pracownik]/object) div count( current-group() ) )"/></stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                    </simpletable>
+                </xsl:variable>
+                <p>Średnie długości powiązań
+                    
+                    <!--<xsl:value-of select="count( $current/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/ID=$PROCES_INIT_tree.ditamap]/object)"/>-->
+                    
+                    
+                    <xsl:copy-of select="$simpletable"/>
+                    <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                        <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                        <xsl:with-param name="width" select="700"/>
+                    </xsl:apply-templates>
+                </p>
+                
+                
+                <xsl:variable name="simpletable"> 
+                    <simpletable frame="all" id="topic_simpletable_statystyka_pracownik.dita_table_kwoty">
+                        <strow>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                                <stentry><xsl:value-of select="ID"/></stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                        <strow>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                                <xsl:variable name="pracownik" select="ID"/>
+                                <xsl:variable name="transakcje">
+                                    <transakcje>
+                                        <xsl:for-each select="$current/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ object[position() = 1]/BI_audit_ENERGA_PRACOWNICY/ID=$pracownik]/object[ position() = last() ]/BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                        
+                                        <xsl:variable name="kontrach" select="ID"/>
+                                        <!--(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) )-->
+                                        <!--(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) )-->
+                                        <!-- sum( $current/BI_audit_ENERGA_RUM_KONTRAHENCI[ID=$kontrach]/BI_audit_ENERGA_RUM_UMOWY/Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_) -->
+                                            <sum kontrach="{$kontrach}"><xsl:value-of select="xs:double(sum( $current/BI_audit_ENERGA_RUM_KONTRAHENCI[ID=$kontrach]/BI_audit_ENERGA_RUM_UMOWY/number(replace(Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_,',','.'))))"/></sum>
+                                    </xsl:for-each>
+                                    </transakcje>
+                                </xsl:variable>
+                                <!--<xsl:copy-of select="$transakcje"/>-->
+                                <stentry><xsl:value-of select=" format-number(xs:double(sum($transakcje/transakcje/sum[ not(text()='NaN')]) div 1000000),'####')"/></stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                    </simpletable>
+                </xsl:variable>
+                <p>Kwoty transakcji <note>w mln PLN</note>
+                    <xsl:copy-of select="$simpletable"/>
+                    <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                        <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                        <xsl:with-param name="width" select="700"/>
+                    </xsl:apply-templates>
+                </p>
+                
+            </body>
+        </topic>
+        
+    </xsl:template>
+    
+    <xsl:template match="BI_audit_KRS" mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_krs">
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:variable name="refpos" select="concat(krs,'_', position())"/>
+        <xsl:variable name="position" select="position()"/>
+        <topicref href="{$group_name}/{$refpos}.dita">
+            <xsl:message>#545 debug : result doc: <xsl:value-of select="$group_name"/>/<xsl:value-of select="$refpos"/></xsl:message>
+            <xsl:result-document href="{$temp}/{$uuid}/{$group_name}/{$refpos}.dita">
+                <topic id="topic_simpletable_{$group_name}_{position()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                    <title>Powiązań <!--<xsl:value-of select="position()"/> /--><xsl:value-of select="count( current-group())"/> dla  
+                        do : <xsl:value-of select="nazwa"/><xsl:text> </xsl:text><xsl:value-of select="S_miejscowosc"/>
+                        <xsl:value-of select="A_ulica"/><xsl:text> </xsl:text><xsl:value-of select="A_nrDomu"/>
+                    </title>
+                    <body>
+                        
+                        <simpletable frame="all" relcolwidth="1* 3* 3*" id="simpletable_rows__child_krs_{$group_name}_{$refpos}">
+                            <strow>
+                                <stentry>Lp</stentry>
+                                <!--<stentry>Uwagi!</stentry>-->
+                                <stentry>Osoba od</stentry>
+                                <stentry>Firma do</stentry>
+                            </strow>
+                           <!-- <xsl:for-each select="current-group()[ position() &lt; 10 ] ">-->
+                            
+                            <xsl:for-each-group select="current-group()[ position() &lt; 10 ] " group-by="../../object[position() =  last()]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip)"><!-- firmy do -->
+                                <xsl:variable name="position_1" select="position()"/>    
+                                <xsl:for-each-group select="current-group()[ position() &lt; 10 ][1] " group-by="../../object[position() =  1]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip)"> <!-- pracownicy -->
+                                    
+                                    <xsl:variable name="group_name_refpos" select="../../object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/system_cache__appinfo:truncate_special_and_do_uppercase(concat(imiona,'_',nazwisko,'_',nip))"/>
+                                    <xsl:variable name="group_name_refpos.kon" select="concat(../../object[position() = last() ]/*[ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta)),'1_DO')"/>
+                                    <xsl:variable name="refpos" select="concat(../../object[ position() = last()]/* [ position() = 1]/concat(name(),ID),'_', 1)"/>
+                                    <strow>
+                                        <stentry><xsl:value-of select="$position_1"/> / <!--<xsl:value-of select="$position"/> / --><xsl:value-of select="position()"/> </stentry>
+                                        <!--<stentry>-->
+                                            <!--<xsl:choose>
+                                                <xsl:when test="../../object[ position() = 2]/BI_audit_KRS_person/pesel[ //]"></xsl:when>
+                                            </xsl:choose>-->
+                                        <!--</stentry>-->
+                                        <stentry>
+                                            <xref href="../{$group_name_refpos}/{$refpos}.dita">
+                                                <xsl:value-of select="../../object[ position() = 1]/*[ position() = 1 ]/concat(imiona,' ',nazwisko,' (',source,')')"/>
+                                            </xref>
+                                        </stentry>
+                                        <stentry>
+                                            <xsl:choose>
+                                                <xsl:when test="../../object[ position() = last()]/* [ position() = 1 ]/Pelna_nazwa_kontrahenta">
+                                                    <xref href="../{$group_name_refpos.kon}/1.dita">
+                                                        <xsl:value-of select="../../object[ position() = last()]/* [ position() = 1 ] /concat(Pelna_nazwa_kontrahenta,' ',Seller_Person,' ',Nr_KW)"/>
+                                                    </xref>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    <xsl:value-of select="../../object[ position() = last()]/* [ position() = 1 ] /concat(Pelna_nazwa_kontrahenta,' ',Seller_Person,' ',Nr_KW)"/>
+                                                </xsl:otherwise>
+                                            </xsl:choose>
+                                            </stentry>
+                                    </strow>
+                                    
+                                </xsl:for-each-group>
+                            </xsl:for-each-group>
+                            
+                            
+                        <!--</xsl:for-each>-->
+                        </simpletable>
+                    </body>
+                </topic>
+            </xsl:result-document>
+        </topicref>
+        
+        
+    </xsl:template>
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_do" match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row">
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" required="yes"/>
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI.ID" required="yes"/>
+        <xsl:param name="resulset" required="yes"/>
+        <xsl:variable name="current" select="."/>
+        <xsl:variable name="current_nip" select="object[ position() = last()]/*/NIP"/>
+        <topicref href="{$group_name}_DO/{position()}.dita">
+            <xsl:result-document href="{$temp}/{$uuid}/{$group_name}_DO/{position()}.dita">
+                <topic id="topic_simpletable_cheat_row_{$group_name}_DO_{position()}_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                    <title>Powiązanie do  
+                        <xsl:value-of select="object[ position() = last()]/*/Pelna_nazwa_kontrahenta"/><xsl:text> </xsl:text>
+                        <xsl:value-of select="object[ position() = last()]/*/Miejscowosc"/><xsl:text> </xsl:text>
+                        <xsl:value-of select="object[ position() = last()]/*/NIP"/><xsl:text> </xsl:text>
+                        ilość: <xsl:value-of select=" count(current-group())"/>
+                    </title>
+                    
+                    <body>
+                        <p>
+                            
+                            Występuje w powiązaniach: 
+                            <simpletable frame="all" relcolwidth="1* 2* 2* 4*" id="simpletable_rows__child_cheat_2{$group_name}_{ position()}_{generate-id()}">
+                                <strow>
+                                    <stentry>Lp</stentry>
+                                    <stentry>Osoba powiązana</stentry>
+                                    <stentry>Rejestr</stentry>
+                                    <stentry>Dane z rejestru</stentry>
+                                </strow>
+                                
+                                
+                                <xsl:for-each-group select="current-group()/object[ position() = 1]" group-by="BI_audit_ENERGA_PRACOWNICY/ID">
+                                    <xsl:variable name="current_pesel" select="BI_audit_ENERGA_PRACOWNICY/pesel"/>
+                                    <!-- chce sprawdzic czy pesel inny niz current() wystepuje w BI_audit_KRS_person jak tak to olac  -->
+                                    <xsl:variable name="test_if_prev_worker">
+                                        <xsl:for-each select="../object/BI_audit_KRS_person[not(pesel = $current_pesel)]">
+                                            <xsl:variable name="current_pesel_2" select="pesel/text()"/>
+                                            <!--testuje:<xsl:value-of select="$current_pesel_2"/>,-->
+                                            <xsl:for-each select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA//BI_audit_ENERGA_PRACOWNICY[pesel/text()=$current_pesel_2][1]">
+                                                <prev pesel="{pesel}">
+                                                    <xsl:value-of select="nazwisko"/>
+                                                </prev>
+                                            </xsl:for-each>
+                                        </xsl:for-each>
+                                    </xsl:variable>
+                                    <!--<xsl:choose>
+                                        <xsl:when test=" count(../object/BI_audit_ENERGA_PRACOWNICY) &gt; 1">-->
+                                        <!--<strow>
+                                            <stentry>dodatk jest</stentry>
+                                            <stentry><xsl:value-of select=" count(../object/BI_audit_ENERGA_PRACOWNICY)"/></stentry>
+                                            <stentry>following-sibling::node test_if_prev_worker <xsl:for-each-group select="$test_if_prev_worker/prev" group-by="@pesel"><xsl:value-of select="@pesel"/><xsl:value-of select="."/></xsl:for-each-group></stentry>
+                                            <stentry>$current_pesel = <xsl:value-of select="$current_pesel"/><!-\-following-siblin::node <xsl:value-of select="preceding-sibling::node()/BI_audit_ENERGA_PRACOWNICY"/>-\-></stentry>
+                                        </strow>-->
+                                    <!-- 
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <strow>
+                                            <stentry>dodatk nie jest</stentry>
+                                            <stentry><xsl:value-of select=" count(../object/BI_audit_ENERGA_PRACOWNICY)"/></stentry>
+                                            <stentry>following-sibling::node test_if_prev_worker <xsl:copy-of select="$test_if_prev_worker"/><!-\-<xsl:copy-of select="$current/../following-sibling::node()/name()"></xsl:copy-of>-\-></stentry>
+                                            <stentry><!-\-<xsl:copy-of select="following-sibling::node()/name()"></xsl:copy-of>-\-></stentry>
+                                        </strow>
+                                    </xsl:otherwise>
+                                </xsl:choose>-->
+                                    <xsl:choose>
+                                        <xsl:when test="$test_if_prev_worker/prev"/>
+                                        <xsl:otherwise>
+                                            <strow>
+                                                <stentry><xsl:value-of select="position()"/></stentry>
+                                                <stentry>
+                                                    <xsl:variable name="group_name_refpos" select="$current/object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/system_cache__appinfo:truncate_special_and_do_uppercase(concat(imiona,'_',nazwisko,'_',nip))"/>
+                                                    <!--<xsl:variable name="group_name_refpos" select="../../object[position() = last() ]/* [ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta,'_kontr'))"/>-->
+                                                    <xsl:variable name="refpos" select="concat($current/object[ position() = last()]/* [ position() = 1]/concat(name(),ID),'_', 1)"/>
+                                                    <xref href="../{$group_name_refpos}/{$refpos}.dita">
+                                                        <xsl:value-of select="*/concat(imiona,' ', nazwisko, ' ', nip,' (żr:',source,')')"/>
+                                                    </xref>
+                                                </stentry>
+                                                <stentry>
+                                                    <xsl:variable name="name">
+                                                        <name><xsl:value-of select="*/name()"/></name>
+                                                    </xsl:variable>
+                                                    <xsl:apply-templates mode="enter_to_ph_text" select="$name/name">
+                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                    </xsl:apply-templates>
+                                                </stentry>
+                                                <stentry>
+                                                    <xsl:for-each select="*/*">
+                                                        <xsl:if test="text()">
+                                                            <xsl:variable name="name">
+                                                                <name><xsl:value-of select="name()"/></name>
+                                                            </xsl:variable>
+                                                            <b><xsl:apply-templates mode="enter_to_ph_text" select="$name/name">
+                                                                <xsl:with-param name="element" select="'entry'"/>
+                                                            </xsl:apply-templates></b>
+                                                            <xsl:text> </xsl:text>
+                                                            <xsl:apply-templates mode="enter_to_ph_text" select=".">
+                                                                <xsl:with-param name="element" select="'entry'"/>
+                                                            </xsl:apply-templates>
+                                                            <xsl:text> </xsl:text>
+                                                        </xsl:if>
+                                                    </xsl:for-each>
+                                                </stentry>
+                                            </strow>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
+                                    
+                                </xsl:for-each-group>
+                            </simpletable>
+                            
+                        </p>
+                        <p>
+                            Podpisane umowy:<!--(<xsl:value-of select="../BI_audit_ENERGA_RUM_KONTRAHENCI[ID/text()='2816']/BI_audit_ENERGA_RUM_UMOWY/Tytul_dokumentu"/>)-->
+                           <!-- (<xsl:value-of select="current()/object[ position() = last() ]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID "/>)-->
+                            <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1*" id="simpletable_rows__child_cheat_4{$group_name}_{generate-id()}_{ position()}">
+                                <strow>
+                                    <stentry>Data utw. spr./ Tytul dokumentu</stentry>
+                                    <stentry>Wprowadzajacy wniosek</stentry>
+                                    <stentry>Kontrahent</stentry>
+                                    <stentry>Akceptujacy merytorycznie</stentry>
+                                    <stentry>Osoba merytoryczna</stentry>
+                                    <stentry>Przedmiot umowy</stentry>
+                                </strow>
+                                <strow>
+                                    <stentry>Spółka główna</stentry>
+                                    <stentry>Typ umowy</stentry>
+                                    <stentry>Wartosc zlecenia zamowienia netto w PLN</stentry>
+                                    <stentry>Wartosc zlecenia zamowienia netto w walucie</stentry>
+                                    <stentry>Wartosc przedmiotu umowy netto w PLN</stentry>
+                                    <stentry>Wartosc kosztowa przedmiotu umowy netto w walucie </stentry>
+                                </strow>
+                                <!--  current()/object[ position() = last() ]/I -->
+                                <xsl:for-each select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[ID/text()= current()/object[ position() = last() ]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID/text()]/BI_audit_ENERGA_RUM_UMOWY">
+                                    <xsl:sort select="Wartosc_przedmiotu_umowy_netto_w_PLN" order="descending"/>
+                                    <xsl:choose>
+                                        <xsl:when test=" position() &lt; 100">
+                                            <strow>
+                                                <stentry><xsl:value-of select="Data_utworzenia_sprawy"/> / 
+                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Tytul_dokumentu">
+                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                    </xsl:apply-templates>
+                                                    <!--<xsl:value-of select="field[@name='Tytul_dokumentu']"/>--></stentry>
+                                                <stentry>
+                                                    <xsl:value-of select="Wprowadzajacy_wniosek___nazwisko_i_imie"/>
+                                                </stentry>
+                                                <stentry>
+                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Pelna_nazwa_kontrahenta">
+                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                    </xsl:apply-templates>
+                                                </stentry>
+                                                <stentry>
+                                                    <xsl:value-of select="Akceptujacy_merytorycznie___nazwisko_i_imie"/>
+                                                </stentry>
+                                                <stentry>
+                                                    <xsl:value-of select="Osoba_merytoryczna___nazwisko_i_imie"/>
+                                                </stentry>
+                                                <stentry>
+                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Przedmiot_umowy">
+                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                    </xsl:apply-templates>
+                                                    <!--<xsl:value-of select="field[@name='Przedmiot_umowy']"/>--></stentry>
+                                            </strow>
+                                            <strow>
+                                                <stentry>
+                                                    <xsl:value-of select="Spolka_glowna"/>
+                                                </stentry>
+                                                <stentry><xsl:value-of select="Typ_umowy__aktualny_"/></stentry>
+                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_PLN"/></stentry>
+                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_walucie"/></stentry>
+                                                <stentry><xsl:value-of select="Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_"/></stentry>
+                                                <stentry><xsl:value-of select="Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie"/></stentry>
+                                            </strow>
+                                            <strow>
+                                                <stentry>-</stentry>
+                                                <stentry>-</stentry>
+                                                <stentry>-</stentry>
+                                                <stentry>-</stentry>
+                                                <stentry>-</stentry>
+                                                <stentry>-</stentry>
+                                            </strow>
+                                        </xsl:when>
+                                        <xsl:when test="position() = 100">
+                                            <strow>
+                                                <stentry>Zestawienie zawiera więcej rekordów</stentry>
+                                                <stentry>Pominięto z uwagi na wielkość raportu</stentry>
+                                                <stentry/>
+                                                <stentry/>
+                                                <stentry/>
+                                                <stentry/>
+                                            </strow>
+                                        </xsl:when>
+                                        <xsl:otherwise/>
+                                    </xsl:choose>
+                                </xsl:for-each>
+                            </simpletable>
+                        </p>
+                    </body>
+                </topic>
+            </xsl:result-document>
+        </topicref>
+    </xsl:template>
+    
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA" match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row">
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="refpos" required="yes"/>
+        
+        <xsl:variable name="position" select="position()"/>
+        <xsl:variable name="group_name.ref_prac" select="system_cache__appinfo:truncate_special_and_do_uppercase(object[position() = 1]/*[ position() = 1] /concat(imiona,'_',nazwisko,'_',nip))"/>
+        <xsl:variable name="refpos.ref_prac" select="concat(object[ position() = last()]/* [ position() = 1]/concat(name(),ID),'_', position())"/>
+        
+       
+                <xsl:variable name="group_name_refpos.kon" select="concat(object[position() = last() ]/*[ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta)),'KONTR_DO')"/>
+                <xsl:variable name="refpos.kon" select="1"/>
+                <topicref href="{$group_name}/{$refpos}.dita">
+                    <xsl:result-document href="{$temp}/{$uuid}/{$group_name}/{$refpos}.dita">
+                        <topic id="topic_simpletable_cheat_row_{$group_name}_{$refpos}_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                            <title>Powiązanń dla <xsl:value-of select="count( current-group())"/> dla  
+                                <xsl:value-of select="object[ position() = 1]/*/imiona"/><xsl:text> </xsl:text>
+                                <xsl:value-of select="object[ position() = 1]/*/nazwisko"/><xsl:text> </xsl:text>
+                                <xsl:value-of select="object[ position() = 1]/*/nip"/><xsl:text> </xsl:text>
+                                żródło:<xsl:value-of select="object[ position() = 1]/*/source"/><xsl:text> </xsl:text>
+                                ;
+                            </title>
+                            
+                            <body>
+                                <p>
+                                    <xref href="../{$group_name.ref_prac}/{$refpos.ref_prac}.dita">
+                                        <xsl:value-of select="object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/concat(imiona,' ', nazwisko, ' ', nip)"/>
+                                    </xref>
+                                </p>
+                            </body>
+                        </topic>
+                    </xsl:result-document>
+                </topicref>
+    </xsl:template>
+    
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row">
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" required="yes"/>
+        <xsl:variable name="position" select="position()"/>
+        
+        <xsl:for-each-group select=" current-group()" group-by="object[position() =  last()]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip)">
+            <xsl:sort select="count(object)" order="ascending"/>
+            <!--<xsl:for-each select="current-group()">-->
+                
+                
+                <!-- TEST IF PREV -->
+                <xsl:variable name="current_pesel" select="object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/pesel"/>
+                <xsl:variable name="test_if_prev_worker">
+                    <xsl:for-each select="object/BI_audit_KRS_person[not(pesel = $current_pesel)]">
+                        <xsl:variable name="current_pesel_2" select="pesel/text()"/>
+                        <!--testuje:<xsl:value-of select="$current_pesel_2"/>,-->
+                        <xsl:for-each select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA//BI_audit_ENERGA_PRACOWNICY[pesel/text()=$current_pesel_2][1]">
+                            <prev pesel="{pesel}">
+                                <xsl:value-of select="nazwisko"/>
+                            </prev>
+                        </xsl:for-each>
+                    </xsl:for-each>
+                </xsl:variable>
+                <!-- TEST IF PREV -->
+                <xsl:choose>
+                    <xsl:when test="$test_if_prev_worker/prev"/>
+                    <xsl:otherwise>
+                        <xsl:variable name="refpos" select="concat(object[ position() = last()]/* [ position() = 1]/concat(name(),ID),'_', 1)"/> <!-- position() -->
+                        
+                        <xsl:variable name="group_name_refpos.kon" select="concat(object[position() = last() ]/*[ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta)),'1_DO')"/>
+                        <xsl:variable name="refpos.kon" select="1"/>
+                        <xsl:choose>
+                            <xsl:when test=" position() = 0 ">
+                                <topichead navtitle=" Pominięto więcej przykładów z uwagi na ilość"/>
+                            </xsl:when>
+                            <xsl:when test=" position() = 0 ">
+                                <xsl:result-document href="{$temp}/{$uuid}/{$group_name}/{$refpos}.dita">
+                                    <topic id="topic_simpletable_cheat_row_{$group_name}_{$refpos}_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                                        xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                                        <title>
+                                            <xsl:if test="$test_if_prev_worker/prev">
+                                                !! nadmiarowe wzajemne !!
+                                                <xsl:for-each-group select="$test_if_prev_worker/prev" group-by="@pesel"><xsl:text> </xsl:text> <xsl:value-of select="."/></xsl:for-each-group>
+                                            </xsl:if>
+                                            Powiązanie <xsl:value-of select="position()"/> /<xsl:value-of select="count( current-group())"/> dla  
+                                            <xsl:value-of select="object[ position() = 1]/*/imiona"/><xsl:text> </xsl:text>
+                                            <xsl:value-of select="object[ position() = 1]/*/nazwisko"/><xsl:text> </xsl:text>
+                                            <xsl:value-of select="object[ position() = 1]/*/nip"/><xsl:text> </xsl:text>
+                                            źródło:<xsl:value-of select="object[ position() = 1]/*/source"/>
+                                            - do : <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' - ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_person)"/><xsl:text> </xsl:text>
+                                            <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/Seller_person"/><xsl:text> </xsl:text> poprzez: <xsl:value-of select="object[ position() = last()]/relation_from"/>
+                                            (gł.szuk.: <xsl:value-of select="count(object)"/>) ;
+                                        </title>
+                                        
+                                        <body>
+                                            <p>
+                                                Ścieżka śledzenia do 
+                                                <xsl:choose>
+                                                    <xsl:when test="object[ position() = last()]/BI_audit_KW_requested_person">
+                                                        
+                                                        działki:  <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                        
+                                                    </xsl:when>
+                                                    <xsl:when test="object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                                        
+                                                        <xref href="../{$group_name_refpos.kon}/{$refpos.kon}.dita">
+                                                            kontrahenta:  <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                        </xref>
+                                                        
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        
+                                                            Kontrahenta:  <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                        
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                                
+                                                
+                                                <simpletable frame="all" relcolwidth="1* 2* 2* 4*" id="simpletable_rows__child_cheat_7{$group_name}_path_{ $refpos}_{generate-id()}">
+                                                    <strow>
+                                                        <stentry>Lp</stentry>
+                                                        <stentry>Sposób wyszukania</stentry>
+                                                        <stentry>Rejestr</stentry>
+                                                        <stentry>Dane z rejestru</stentry>
+                                                    </strow>
+                                                    <xsl:for-each select="object">
+                                                        <strow>
+                                                            <stentry><xsl:value-of select="position()"/></stentry>
+                                                            <stentry>
+                                                                <xsl:apply-templates mode="enter_to_ph_text" select="relation_from">
+                                                                    <xsl:with-param name="element" select="'entry'"/>
+                                                                </xsl:apply-templates>
+                                                            </stentry>
+                                                            <stentry>
+                                                                <xsl:variable name="name">
+                                                                    <name><xsl:value-of select="*/name()"/></name>
+                                                                </xsl:variable>
+                                                                <xsl:apply-templates mode="enter_to_ph_text" select="$name/name">
+                                                                    <xsl:with-param name="element" select="'entry'"/>
+                                                                </xsl:apply-templates>
+                                                                <!--<xsl:value-of select="string(*/name())"/>-->
+                                                            </stentry>
+                                                            <stentry>
+                                                                <xsl:choose>
+                                                                    <xsl:when test="BI_audit_KRS">
+                                                                        <xref href="../KRSY_{BI_audit_KRS/krs}/{BI_audit_KRS/krs}_1.dita">
+                                                                            <xsl:value-of select="BI_audit_KRS/nazwa"/><xsl:text> </xsl:text>
+                                                                            <xsl:value-of select="BI_audit_KRS/S_miejscowosc"/><xsl:text> </xsl:text>
+                                                                        </xref>
+                                                                    </xsl:when>
+                                                                    <xsl:otherwise>
+                                                                        <xsl:for-each select="*/*">
+                                                                            <xsl:if test="text() and not(name()='A_STATUS')">
+                                                                                <b><xsl:value-of select="name()"/></b><xsl:text> </xsl:text>
+                                                                                <xsl:apply-templates mode="enter_to_ph_text" select="text()">
+                                                                                    <xsl:with-param name="element" select="'entry'"/>
+                                                                                </xsl:apply-templates>
+                                                                                <xsl:text> </xsl:text>
+                                                                            </xsl:if>
+                                                                        </xsl:for-each>
+                                                                    </xsl:otherwise>
+                                                                </xsl:choose>
+                                                                
+                                                            </stentry>
+                                                        </strow>
+                                                    </xsl:for-each>
+                                                </simpletable>
+                                                
+                                            </p>
+                                            <!--TODO to separate raport xlink <xsl:choose>
+                                    <xsl:when test="deal">
+                                        <p>
+                                            Podpisane umowy?
+                                            <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1*" id="simpletable_rows__child_cheat_5{$group_name}_{ $refpos}_{generate-id()}">
+                                                <strow>
+                                                    <stentry>Data utw. spr./ Tytul dokumentu</stentry>
+                                                    <stentry>Wprowadzajacy wniosek</stentry>
+                                                    <stentry>Kontrahent</stentry>
+                                                    <stentry>Akceptujacy merytorycznie</stentry>
+                                                    <stentry>Osoba merytoryczna</stentry>
+                                                    <stentry>Przedmiot umowy</stentry>
+                                                </strow>
+                                                <strow>
+                                                    <stentry>(dane dla poprz.rek.)</stentry>
+                                                    <stentry>Typ umowy</stentry>
+                                                    <stentry>Wartosc zlecenia zamowienia netto w PLN</stentry>
+                                                    <stentry>Wartosc zlecenia zamowienia netto w walucie</stentry>
+                                                    <stentry>Wartosc przedmiotu umowy netto w PLN</stentry>
+                                                    <stentry>Wartosc kosztowa przedmiotu umowy netto w walucie </stentry>
+                                                </strow>
+                                                <xsl:for-each select="deal">
+                                                    <xsl:sort select="Wartosc_przedmiotu_umowy_netto_w_PLN" order="descending"/>
+                                                    <xsl:choose>
+                                                        <xsl:when test=" position() &lt; 100">
+                                                            <strow>
+                                                                <stentry><xsl:value-of select="Data_utworzenia_sprawy"/> / 
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Tytul_dokumentu">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!-\-<xsl:value-of select="field[@name='Tytul_dokumentu']"/>-\-></stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Wprowadzajacy_wniosek___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Pelna_nazwa_kontrahenta">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Akceptujacy_merytorycznie___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Osoba_merytoryczna___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Przedmiot_umowy">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!-\-<xsl:value-of select="field[@name='Przedmiot_umowy']"/>-\-></stentry>
+                                                            </strow>
+                                                            <strow>
+                                                                <stentry>(dane dla poprz.rek.)</stentry>
+                                                                <stentry><xsl:value-of select="Typ_umowy__aktualny_"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_PLN"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_walucie"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie"/></stentry>
+                                                            </strow>
+                                                        </xsl:when>
+                                                        <xsl:when test="position() = 100">
+                                                            <strow>
+                                                                <stentry>Zestawienie zawiera więcej rekordów</stentry>
+                                                                <stentry>Pominięto z uwagi na wielkość raportu</stentry>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                            </strow>
+                                                        </xsl:when>
+                                                        <xsl:otherwise/>
+                                                    </xsl:choose>
+                                                </xsl:for-each>
+                                            </simpletable>
+                                        </p>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <p> Dane transakcji 
+                                            <simpletable frame="all" relcolwidth="1* 4*" id="simpletable_rows__child_cheat_9{$group_name}_{ $refpos}_{generate-id()}">
+                                                <strow>
+                                                    <stentry>Kolumna</stentry>
+                                                    <stentry>Wartosc</stentry>
+                                                </strow>
+                                                <xsl:for-each select="object[ position() = last()]/*">
+                                                    <strow>
+                                                        <stentry><xsl:value-of select="name()"/></stentry>
+                                                        <stentry><xsl:value-of select="."/></stentry>
+                                                    </strow>
+                                                </xsl:for-each>
+                                            </simpletable>
+                                        
+                                        </p>
+                                    </xsl:otherwise>
+                                </xsl:choose>-->
+                                            
+                                        </body>
+                                    </topic>
+                                </xsl:result-document>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <topicref href="{$group_name}/{$refpos}.dita">
+                                    <xsl:result-document href="{$temp}/{$uuid}/{$group_name}/{$refpos}.dita">
+                                        <topic id="topic_simpletable_cheat_row_{$group_name}_{$refpos}_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                                            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                                            <title>
+                                                <xsl:if test="$test_if_prev_worker/prev">
+                                                    !! nadmiarowe wzajemne !!
+                                                    <xsl:for-each-group select="$test_if_prev_worker/prev" group-by="@pesel"><xsl:text> </xsl:text> <xsl:value-of select="."/></xsl:for-each-group>
+                                                </xsl:if>
+                                                Powiązanie <xsl:value-of select="position()"/> /<xsl:value-of select="count( current-group())"/> dla  
+                                                <xsl:value-of select="object[ position() = 1]/*/imiona"/><xsl:text> </xsl:text>
+                                                <xsl:value-of select="object[ position() = 1]/*/nazwisko"/><xsl:text> </xsl:text>
+                                                <xsl:value-of select="object[ position() = 1]/*/nip"/><xsl:text> </xsl:text>
+                                                źródło:<xsl:value-of select="object[ position() = 1]/*/source"/><xsl:text> </xsl:text>
+                                                - do : <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_person)"/><xsl:text> </xsl:text>
+                                                <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/Seller_person"/><xsl:text> </xsl:text> poprzez: <xsl:value-of select="object[ position() = last()]/relation_from"/>
+                                                (gł.szuk.: <xsl:value-of select="count(object)"/>) ;
+                                            </title>
+                                            
+                                            <body>
+                                                <p>
+                                                    Ścieżka śledzenia do 
+                                                    <xsl:choose>
+                                                        <xsl:when test="object[ position() = last()]/BI_audit_KW_requested">
+                                                            
+                                                            działki:  <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                            
+                                                        </xsl:when>
+                                                        <xsl:otherwise>
+                                                            <xref href="../{$group_name_refpos.kon}/{$refpos.kon}.dita">
+                                                                kontrahenta:  <xsl:value-of select="object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                            </xref>
+                                                        </xsl:otherwise>
+                                                    </xsl:choose>
+                                                    
+                                                    
+                                                    <simpletable frame="all" relcolwidth="1* 2* 2* 4*" id="simpletable_rows__child_cheat_7{$group_name}_path_{ $refpos}_{generate-id()}">
+                                                        <strow>
+                                                            <stentry>Lp</stentry>
+                                                            <stentry>Sposób wyszukania</stentry>
+                                                            <stentry>Rejestr</stentry>
+                                                            <stentry>Dane z rejestru</stentry>
+                                                        </strow>
+                                                        <xsl:for-each select="object">
+                                                            <strow>
+                                                                <stentry><xsl:value-of select="position()"/></stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="relation_from">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:variable name="name">
+                                                                        <name><xsl:value-of select="*/name()"/></name>
+                                                                    </xsl:variable>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="$name/name">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!--<xsl:value-of select="string(*/name())"/>-->
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:choose>
+                                                                        <xsl:when test="BI_audit_KRS">
+                                                                            <xref href="../KRSY_{BI_audit_KRS/krs}/{BI_audit_KRS/krs}_1.dita">
+                                                                                <xsl:value-of select="BI_audit_KRS/nazwa"/><xsl:text> </xsl:text>
+                                                                                <xsl:value-of select="BI_audit_KRS/S_miejscowosc"/><xsl:text> </xsl:text>
+                                                                            </xref>
+                                                                        </xsl:when>
+                                                                        <xsl:otherwise>
+                                                                            <xsl:for-each select="*/*">
+                                                                                <xsl:if test="text() and not(name()='A_STATUS')">
+                                                                                    <b><xsl:value-of select="name()"/></b><xsl:text> </xsl:text>
+                                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="text()">
+                                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                                    </xsl:apply-templates>
+                                                                                    <xsl:text> </xsl:text>
+                                                                                </xsl:if>
+                                                                            </xsl:for-each>
+                                                                        </xsl:otherwise>
+                                                                    </xsl:choose>
+                                                                    
+                                                                </stentry>
+                                                            </strow>
+                                                        </xsl:for-each>
+                                                    </simpletable>
+                                                    
+                                                </p>
+                                                <!--TODO to separate raport xlink <xsl:choose>
+                                    <xsl:when test="deal">
+                                        <p>
+                                            Podpisane umowy?
+                                            <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1*" id="simpletable_rows__child_cheat_5{$group_name}_{ $refpos}_{generate-id()}">
+                                                <strow>
+                                                    <stentry>Data utw. spr./ Tytul dokumentu</stentry>
+                                                    <stentry>Wprowadzajacy wniosek</stentry>
+                                                    <stentry>Kontrahent</stentry>
+                                                    <stentry>Akceptujacy merytorycznie</stentry>
+                                                    <stentry>Osoba merytoryczna</stentry>
+                                                    <stentry>Przedmiot umowy</stentry>
+                                                </strow>
+                                                <strow>
+                                                    <stentry>(dane dla poprz.rek.)</stentry>
+                                                    <stentry>Typ umowy</stentry>
+                                                    <stentry>Wartosc zlecenia zamowienia netto w PLN</stentry>
+                                                    <stentry>Wartosc zlecenia zamowienia netto w walucie</stentry>
+                                                    <stentry>Wartosc przedmiotu umowy netto w PLN</stentry>
+                                                    <stentry>Wartosc kosztowa przedmiotu umowy netto w walucie </stentry>
+                                                </strow>
+                                                <xsl:for-each select="deal">
+                                                    <xsl:sort select="Wartosc_przedmiotu_umowy_netto_w_PLN" order="descending"/>
+                                                    <xsl:choose>
+                                                        <xsl:when test=" position() &lt; 100">
+                                                            <strow>
+                                                                <stentry><xsl:value-of select="Data_utworzenia_sprawy"/> / 
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Tytul_dokumentu">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!-\-<xsl:value-of select="field[@name='Tytul_dokumentu']"/>-\-></stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Wprowadzajacy_wniosek___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Pelna_nazwa_kontrahenta">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Akceptujacy_merytorycznie___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Osoba_merytoryczna___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Przedmiot_umowy">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!-\-<xsl:value-of select="field[@name='Przedmiot_umowy']"/>-\-></stentry>
+                                                            </strow>
+                                                            <strow>
+                                                                <stentry>(dane dla poprz.rek.)</stentry>
+                                                                <stentry><xsl:value-of select="Typ_umowy__aktualny_"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_PLN"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_walucie"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie"/></stentry>
+                                                            </strow>
+                                                        </xsl:when>
+                                                        <xsl:when test="position() = 100">
+                                                            <strow>
+                                                                <stentry>Zestawienie zawiera więcej rekordów</stentry>
+                                                                <stentry>Pominięto z uwagi na wielkość raportu</stentry>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                            </strow>
+                                                        </xsl:when>
+                                                        <xsl:otherwise/>
+                                                    </xsl:choose>
+                                                </xsl:for-each>
+                                            </simpletable>
+                                        </p>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <p> Dane transakcji 
+                                            <simpletable frame="all" relcolwidth="1* 4*" id="simpletable_rows__child_cheat_9{$group_name}_{ $refpos}_{generate-id()}">
+                                                <strow>
+                                                    <stentry>Kolumna</stentry>
+                                                    <stentry>Wartosc</stentry>
+                                                </strow>
+                                                <xsl:for-each select="object[ position() = last()]/*">
+                                                    <strow>
+                                                        <stentry><xsl:value-of select="name()"/></stentry>
+                                                        <stentry><xsl:value-of select="."/></stentry>
+                                                    </strow>
+                                                </xsl:for-each>
+                                            </simpletable>
+                                        
+                                        </p>
+                                    </xsl:otherwise>
+                                </xsl:choose>-->
+                                                
+                                            </body>
+                                        </topic>
+                                    </xsl:result-document>
+                                </topicref>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        
+                    </xsl:otherwise>
+                </xsl:choose>
+               
+            <!--</xsl:for-each>-->
+        </xsl:for-each-group>
+    </xsl:template>
+    
+    
+   
+    
+    
+</xsl:stylesheet>

+ 556 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors/BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors_tree_to_dita.xsl

@@ -0,0 +1,556 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="xref_level" select="5"/>
+    
+    <xsl:variable name="grupy">
+        <grupy>
+            <grupa group_name="Rejestrujacy_w_RUM___nazwisko_i_imie">Rejestrujacy w RUM</grupa>
+            <grupa group_name="Wprowadzajacy_wniosek___nazwisko_i_imie">Wprowadzajacy wniosek</grupa>
+            <grupa group_name="Akceptujacy_merytorycznie___nazwisko_i_imie">Akceptujacy merytorycznie</grupa>
+            <grupa group_name="Osoba_merytoryczna___nazwisko_i_imie">Osoba merytoryczna</grupa>
+            <grupa group_name="Typ_umowy__aktualny_">Typ umowy aktualny</grupa>
+            <grupa group_name="Pelna_nazwa_kontrahenta">Pelna_nazwa_kontrahenta</grupa>
+        </grupy>
+    </xsl:variable>
+    
+    <xsl:variable name="quote">
+        <xsl:text>&quot;</xsl:text>
+    </xsl:variable>
+    <xsl:variable name="amp">
+        <xsl:text>&amp;</xsl:text>
+    </xsl:variable>
+    <xsl:variable name="xA">
+        <xsl:text>&amp;#xA</xsl:text>
+    </xsl:variable>
+    
+    <xsl:template match="RelatedFeatureRoot" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors">
+        <xsl:message>#37 template match="RelatedFeatureRoot" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors"</xsl:message>
+        <xsl:apply-templates mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors"/>
+    </xsl:template>
+    
+    <xsl:template match="*|text()" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors"/>
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors">
+        <xsl:message>#42 template match="BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors" mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors"</xsl:message>
+        <xsl:variable name="resulset" select="."/>
+        <xsl:for-each select="$grupy/grupy/grupa">
+            <!--<xsl:copy-of select="$current"></xsl:copy-of>-->
+            <xsl:variable name="group_name" select="@group_name"/>
+            <xsl:variable name="group_value" select="text()"/>
+            <xsl:for-each-group select="$resulset//row" group-by=" system_cache__appinfo:truncate_special_and_do_uppercase(field[@name=$group_name])">
+                <xsl:sort select="sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) " order="descending"/>
+                <xsl:apply-templates select="." mode="dita_kontr_cheat_BI_audit_ENERGA_RUM_KONTRAHENCI_preprocess">
+                    <xsl:with-param name="group_name" select="$group_name"/>
+                    <xsl:with-param name="group_value" select="field[@name=$group_name]"/>
+                    <xsl:with-param name="group_desc" select="$group_value"/>
+                </xsl:apply-templates>
+            </xsl:for-each-group>
+        </xsl:for-each>
+    </xsl:template>
+    
+    <xsl:template match="RelatedFeatureRoot" mode="postprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors"/>
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors" mode="ditamap_root">
+        <!--<xsl:result-document href="energa_bledy_rum.ditamap">-->
+            <map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:map.xsd">
+                <title>raport z przetwarzania energa_bledy_RUM.xml - podejrzani kontrahenci i ich umowy
+                oprac. A.Binder Rip/Procesy5</title>
+                <!-- osoby Akceptujacy_merytorycznie___nazwisko_i_imie -->
+                <xsl:variable name="resulset" select="."/>
+                <xsl:for-each select="$grupy/grupy/grupa">
+                    <!--<xsl:copy-of select="$current"></xsl:copy-of>-->
+                    <xsl:variable name="group_name" select="@group_name"/>
+                    <xsl:variable name="group_value" select="text()"/>
+                    <topichead navtitle="{text()}">
+                        <xsl:for-each-group select="$resulset//row" group-by=" system_cache__appinfo:truncate_special_and_do_uppercase(field[@name=$group_name])">
+                            <xsl:sort select="sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) " order="descending"/>
+                            <!--<test><xsl:value-of select="field/@name"/></test>-->
+                            <!--<xsl:copy-of select=" current-group()"></xsl:copy-of>-->
+                                <xsl:apply-templates select="." mode="dita_ref_kontr_BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                    <xsl:with-param name="group_name" select="$group_name"/>
+                                    <xsl:with-param name="group_value" select="field[@name=$group_name]"/>
+                                    <xsl:with-param name="group_desc" select="$group_value"/>
+                                </xsl:apply-templates>
+                                <xsl:apply-templates select="." mode="dita_kontr_BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                    <xsl:with-param name="group_name" select="$group_name"/>
+                                    <xsl:with-param name="group_value" select="field[@name=$group_name]"/>
+                                    <xsl:with-param name="group_desc" select="$group_value"/>
+                                </xsl:apply-templates>
+                            <!--<xsl:apply-templates select="." mode="dita_graph__BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                    <xsl:with-param name="group_name" select="$group_name"/>
+                                    <xsl:with-param name="group_value" select="field[@name=$group_name]"/>
+                                    <xsl:with-param name="group_desc" select="$group_value"/>
+                                </xsl:apply-templates>-->
+                        </xsl:for-each-group>
+                    </topichead>
+                </xsl:for-each>
+                <topichead navtitle="Obiekty wprowadzone jako typ Bezkosztowe, podczas, gdy są kosztowe!">
+                    <xsl:for-each select="$grupy/grupy/grupa"> <!-- [field[@name='Typ_umowy__aktualny_']/not(text()='Bezkosztowa')]  -->
+                        <xsl:variable name="group_name" select="@group_name"/>
+                        <xsl:variable name="group_value" select="text()"/>
+                        <topichead navtitle="{text()}">
+                            <xsl:for-each-group select="$resulset//row[ field[@name='Typ_umowy__aktualny_']/text()='Bezkosztowa' and xs:double(sum(field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ) &gt; 1 ] " group-by="system_cache__appinfo:truncate_special_and_do_uppercase(field[@name=$group_name])">
+                                <xsl:sort select="sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) " order="descending"/>
+                                <!--<test><xsl:value-of select="field/@name"/></test>-->
+                                <!--<xsl:copy-of select=" current-group()"></xsl:copy-of>-->
+                                <xsl:apply-templates select="." mode="dita_ref_kontr_BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                    <xsl:with-param name="group_name" select="concat($group_name,'_cheat_bezkoszt')"/>
+                                    <xsl:with-param name="group_value" select="field[@name=$group_name]"/>
+                                    <xsl:with-param name="group_desc" select="$group_value"/>
+                                    <!--<xsl:with-param name="group_name_base" select="$group_name"/>-->
+                                </xsl:apply-templates>
+                                <xsl:apply-templates select="." mode="dita_kontr_cheat_BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                    <xsl:with-param name="group_name" select="concat($group_name,'_cheat_bezkoszt')"/>
+                                    <xsl:with-param name="group_value" select="field[@name=$group_name]"/>
+                                    <xsl:with-param name="group_desc" select="$group_value"/>
+                                </xsl:apply-templates>
+                                
+                            </xsl:for-each-group>
+                        </topichead>
+                    </xsl:for-each>
+                </topichead>
+                
+                <!--  -->
+                <!-- osoby Osoba_merytoryczna___nazwisko_i_imie -->
+                
+                <!-- Rejestrujacy_w_RUM___nazwisko_i_imie -->
+                
+                <!-- Typ_umowy__aktualny_ -->
+                <!--<xsl:apply-templates mode="dita_ref_kontr_BI_audit_ENERGA_RUM_KONTRAHENCI"/>-->
+            </map>
+        <!--</xsl:result-document>-->
+    </xsl:template>
+    
+    <!--moved to get-all-xsd <xsl:function name="system_cache__appinfo:truncate_special_and_do_uppercase">
+        <xsl:param name="group_value"/>
+        <!-\-<xsl:value-of select='replace($group_value,"( |&apos;|$amp|\||\n|#|$xA|$quote|é|ą|ę|ś|ż|ź|ć|ó|ł|ź|ń|Ś|Ą|Ż|Ź|Ć|Ń|Ó|Ł|/|\.|,| )","_")'/>-\->
+        <xsl:value-of select="upper-case(translate($group_value, translate($group_value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', ''), ''))" />
+    </xsl:function>-->
+    <xsl:template match="text()" mode="dita_kontr_cheat_BI_audit_ENERGA_RUM_KONTRAHENCI_preprocess"/>
+    
+    <xsl:template match="*" mode="dita_kontr_cheat_BI_audit_ENERGA_RUM_KONTRAHENCI_preprocess" >
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="group_value" required="yes"/>
+        <xsl:param name="group_desc"  required="yes"/>
+        <!--<xsl:param name="group_name_base" required="yes"/>-->
+        
+                        <xsl:variable name="simpletable">
+                            <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1*" id="simpletable_cheat{$group_name}_{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}">
+                                <strow>
+                                    <stentry>Il.Um.</stentry>
+                                    <stentry>Zam.PLN</stentry>
+                                    <stentry>Zam.W</stentry>
+                                    <stentry>Wart.p.Um.</stentry>
+                                    <stentry>Sum.k.przed.um.WAL</stentry>
+                                </strow>
+                                <strow>
+                                    <stentry>
+                                        <xsl:choose>
+                                            <xsl:when test=" string-length($group_value) &gt; 0">
+                                                <xsl:value-of select="count(current-group()[field[@name=$group_name][ text()=$group_value] ])"/>
+                                            </xsl:when>
+                                            <xsl:otherwise>
+                                                <xsl:value-of select="count(current-group())"/>
+                                            </xsl:otherwise>
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                                    <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_walucie__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                                    <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                                    <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie__aktualna_'][ string(number(text())) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                                    
+                                </strow>
+                            </simpletable>
+                        </xsl:variable>
+                        <xsl:apply-templates mode="system_cache__dita:graph__write_dita_preprocess" select="$simpletable"/>
+                       
+    </xsl:template>
+    
+    <xsl:template match="*" mode="dita_kontr_cheat_BI_audit_ENERGA_RUM_KONTRAHENCI" >
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="group_value" required="yes"/>
+        <xsl:param name="group_desc"  required="yes"/>
+        <!--<xsl:param name="group_name_base" required="yes"/>-->
+        <xsl:result-document href="{$temp}/{$uuid}/{$group_name}/{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}.dita">
+            <topic id="topic_simpletable_cheat{$group_name}_{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                <title>Dane z rejestru dla kryterium : 
+                    <xsl:choose>
+                        <xsl:when test=" string-length($group_value) &gt; 1">
+                            <xsl:value-of select="$group_value"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            - Bez wprowadzonej wartości!
+                        </xsl:otherwise>
+                    </xsl:choose>
+                    ( <xsl:value-of select="count(current-group())"/>
+                     wpisów / <xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/> pln )
+                    - <xsl:value-of select="$group_desc"/>
+                </title>
+                <body>
+                    <p>
+                        <xsl:variable name="simpletable">
+                                <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1*" id="simpletable_cheat{$group_name}_{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}">
+                                    <strow>
+                                        <stentry>Ilość umów</stentry>
+                                        <stentry>Suma wartość zleceń zamówień netto w PLN</stentry>
+                                        <stentry>Suma wartość zleceń netto w walucie</stentry>
+                                        <stentry>Suma wartości przedmiotu umowy netto w PLN</stentry>
+                                        <stentry>Suma kosztowa przedmiotu umowy netto w walucie aktualna</stentry>
+                                    </strow>
+                                <strow>
+                                    <stentry>
+                                        <xsl:choose>
+                                            <xsl:when test=" string-length($group_value) &gt; 0">
+                                                <xsl:value-of select="count(current-group()[field[@name=$group_name][ text()=$group_value] ])"/>
+                                            </xsl:when>
+                                            <xsl:otherwise>
+                                                <xsl:value-of select="count(current-group())"/>
+                                            </xsl:otherwise>
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                                    <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_walucie__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                                    <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                                    <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie__aktualna_'][ string(number(text())) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                                    
+                                </strow>
+                            </simpletable>
+                        </xsl:variable>
+                        <xsl:copy-of select="$simpletable"/>
+
+                        <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable"/>
+                            
+                        
+                        
+                    </p>
+                    
+                    
+                    
+                    <p>
+                        <b>Obiekty powiązane w nieprawidłowych typach ! </b>
+                        <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1*" id="simpletable_rows__child_cheat{$group_name}_{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}">
+                            <strow>
+                                <stentry>Data utw. spr./ Tytul dokumentu</stentry>
+                                <stentry>Wprowadzajacy wniosek</stentry>
+                                <stentry>Kontrahent</stentry>
+                                <stentry>Akceptujacy merytorycznie</stentry>
+                                <stentry>Osoba merytoryczna</stentry>
+                                <stentry>Przedmiot umowy</stentry>
+                            </strow>
+                            <strow>
+                                <stentry>(dane dla poprz.rek.)</stentry>
+                                <stentry>Typ umowy</stentry>
+                                <stentry>Wartosc zlecenia zamowienia netto w PLN</stentry>
+                                <stentry>Wartosc zlecenia zamowienia netto w walucie</stentry>
+                                <stentry>Wartosc przedmiotu umowy netto w PLN</stentry>
+                                <stentry>Wartosc kosztowa przedmiotu umowy netto w walucie </stentry>
+                            </strow>
+                            <xsl:for-each select="current-group()[field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN'][number(replace(text(),',','.')) &gt; 0 ]]">
+                                <xsl:sort select="field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.'))" order="descending"/>
+                                <xsl:choose>
+                                    <xsl:when test=" position() &lt; 100">
+                                        <strow>
+                                            <stentry><xsl:value-of select="field[@name='Data_utworzenia_sprawy']"/> / 
+                                                <xsl:apply-templates mode="enter_to_ph_text" select="field[@name='Tytul_dokumentu']">
+                                                    <xsl:with-param name="element" select="'entry'"/>
+                                                </xsl:apply-templates>
+                                                <!--<xsl:value-of select="field[@name='Tytul_dokumentu']"/>--></stentry>
+                                            <stentry>
+                                                <xsl:choose>
+                                                    <xsl:when test="$group_name='Wprowadzajacy_wniosek___nazwisko_i_imie_cheat_bezkoszt'">
+                                                        <xsl:value-of select="field[@name='Wprowadzajacy_wniosek___nazwisko_i_imie']"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xref href="../Wprowadzajacy_wniosek___nazwisko_i_imie_cheat_bezkoszt/{ system_cache__appinfo:truncate_special_and_do_uppercase(field[@name='Wprowadzajacy_wniosek___nazwisko_i_imie'])}.dita">
+                                                            <xsl:value-of select="field[@name='Wprowadzajacy_wniosek___nazwisko_i_imie']"/>
+                                                        </xref>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:choose>
+                                                    <xsl:when test="$group_name='Pelna_nazwa_kontrahenta_cheat_bezkoszt'">
+                                                        <!--<xsl:value-of select="field[@name='Pelna_nazwa_kontrahenta']"/>-->
+                                                        <xsl:apply-templates mode="enter_to_ph_text" select="field[@name='Pelna_nazwa_kontrahenta']">
+                                                            <xsl:with-param name="element" select="'entry'"/>
+                                                        </xsl:apply-templates>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xref href="../Pelna_nazwa_kontrahenta_cheat_bezkoszt/{ system_cache__appinfo:truncate_special_and_do_uppercase(field[@name='Pelna_nazwa_kontrahenta'])}.dita">
+                                                            <xsl:apply-templates mode="enter_to_ph_text" select="field[@name='Pelna_nazwa_kontrahenta']">
+                                                                <xsl:with-param name="element" select="'entry'"/>
+                                                            </xsl:apply-templates>
+                                                            <!--<xsl:value-of select="field[@name='Pelna_nazwa_kontrahenta']"/>--></xref>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:choose>
+                                                    <xsl:when test="$group_name='Akceptujacy_merytorycznie___nazwisko_i_imie_cheat_bezkoszt'">
+                                                        <xsl:value-of select="field[@name='Akceptujacy_merytorycznie___nazwisko_i_imie']"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xref href="../Akceptujacy_merytorycznie___nazwisko_i_imie_cheat_bezkoszt/{ system_cache__appinfo:truncate_special_and_do_uppercase(field[@name='Akceptujacy_merytorycznie___nazwisko_i_imie'])}.dita">
+                                                            <xsl:value-of select="field[@name='Akceptujacy_merytorycznie___nazwisko_i_imie']"/>
+                                                        </xref>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:choose>
+                                                    <xsl:when test="$group_name='Osoba_merytoryczna___nazwisko_i_imie_cheat_bezkoszt'">
+                                                        <xsl:value-of select="field[@name='Osoba_merytoryczna___nazwisko_i_imie']"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xref href="../Osoba_merytoryczna___nazwisko_i_imie_cheat_bezkoszt/{ system_cache__appinfo:truncate_special_and_do_uppercase(field[@name='Osoba_merytoryczna___nazwisko_i_imie'])}.dita">
+                                                            <xsl:value-of select="field[@name='Osoba_merytoryczna___nazwisko_i_imie']"/>
+                                                        </xref>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:apply-templates mode="enter_to_ph_text" select="field[@name='Przedmiot_umowy']">
+                                                    <xsl:with-param name="element" select="'entry'"/>
+                                                </xsl:apply-templates>
+                                                <!--<xsl:value-of select="field[@name='Przedmiot_umowy']"/>--></stentry>
+                                        </strow>
+                                        <strow>
+                                            <stentry>(dane dla poprz.rek.)</stentry>
+                                            <stentry><xsl:value-of select="field[@name='Typ_umowy__aktualny_']"/></stentry>
+                                            <stentry><xsl:value-of select="field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN']"/></stentry>
+                                            <stentry><xsl:value-of select="field[@name='Wartosc_zlecenia_zamowienia_netto_w_walucie']"/></stentry>
+                                            <stentry><xsl:value-of select="field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_']"/></stentry>
+                                            <stentry><xsl:value-of select="field[@name='Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie']"/></stentry>
+                                        </strow>
+                                    </xsl:when>
+                                    <xsl:when test="position() = 100">
+                                        <strow>
+                                            <stentry>Zestawienie zawiera więcej rekordów</stentry>
+                                            <stentry>Pominięto z uwagi na wielkość raportu</stentry>
+                                            <stentry/>
+                                            <stentry/>
+                                            <stentry/>
+                                            <stentry/>
+                                        </strow>
+                                    </xsl:when>
+                                    <xsl:otherwise/>
+                                </xsl:choose>
+                            </xsl:for-each>
+                        </simpletable>
+                    </p>
+                </body>
+            </topic>
+        </xsl:result-document>
+        
+        
+        
+    </xsl:template>
+    
+    <xsl:template match="*" mode="dita_kontr_BI_audit_ENERGA_RUM_KONTRAHENCI" >
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="group_value" required="yes"/>
+        <xsl:param name="group_desc" required="yes"/>
+        <xsl:result-document href="{$temp}/{$uuid}/{$group_name}/{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}.dita">
+            <topic id="topic_simpletable_{$group_name}_{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                <title>Dane z rejestru dla kryterium : 
+                    <xsl:choose>
+                        <xsl:when test=" string-length($group_value) &gt; 1">
+                            <xsl:value-of select="$group_value"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            - Bez wprowadzonej wartości!
+                        </xsl:otherwise>
+                    </xsl:choose>
+                    (<xsl:choose>
+                        <xsl:when test=" string-length($group_value) &gt; 0">
+                            <xsl:value-of select="count(current-group()[field[@name=$group_name][ text()=$group_value] ])"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:value-of select="count(current-group())"/>
+                        </xsl:otherwise>
+                    </xsl:choose> wpisów / <xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/> pln )
+                    - <xsl:value-of select="$group_desc"/>
+                </title>
+                <body>
+                    <p><simpletable frame="all" relcolwidth="1* 1* 1* 1* 1*" id="simpletable_{$group_name}_{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}">
+                        <strow>
+                            <stentry>Ilość umów</stentry>
+                            <stentry>Suma wartość zleceń zamówień netto w PLN</stentry>
+                            <stentry>Suma wartość zleceń netto w walucie</stentry>
+                            <stentry>Suma wartości przedmiotu umowy netto w PLN</stentry>
+                            <stentry>Suma kosztowa przedmiotu umowy netto w walucie aktualna</stentry>
+                        </strow>
+                        <strow>
+                            <stentry>
+                                <xsl:choose>
+                                    <xsl:when test=" string-length($group_value) &gt; 0">
+                                        <xsl:value-of select="count(current-group()[field[@name=$group_name][ text()=$group_value] ])"/>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <xsl:value-of select="count(current-group())"/>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                            </stentry>
+                            <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                            <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_walucie__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                            <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                            <stentry><xsl:value-of select="format-number(xs:double(sum(current-group()/field[@name='Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie__aktualna_'][ string(number(text())) != 'NaN']/number(replace(text(),',','.')) ) ),'#,###.00')"/></stentry>
+                            
+                        </strow>
+                    </simpletable>
+                    </p>
+                    <p>
+                        <xsl:choose>
+                            <xsl:when test="( xs:double(sum(current-group()/field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_' and ../field[@name='Typ_umowy__aktualny_']='Bezkosztowa'    ][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) ) &gt; 1 ) ">
+                                <hazardstatement>
+                                    <messagepanel >
+                                        <typeofhazard>UWAGA dla danego typu są podejrzane wpisy typu
+                                            bezkosztowe</typeofhazard>
+                                        <howtoavoid><xref href="../{$group_name}_cheat_bezkoszt/{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}.dita"/></howtoavoid>
+                                    </messagepanel>
+                                </hazardstatement>
+                            </xsl:when>
+                        </xsl:choose>
+                        
+                        
+                    </p>
+                    <p>
+                        <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1*" id="simpletable_child_{$group_name}_{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}">
+                            <strow>
+                                <stentry>Data utw. spr./ Tytul dokumentu</stentry>
+                                <stentry>Wprowadzajacy wniosek</stentry>
+                                <stentry>Kontrahent</stentry>
+                                <stentry>Akceptujacy merytorycznie</stentry>
+                                <stentry>Osoba merytoryczna</stentry>
+                                <stentry>Przedmiot umowy</stentry>
+                            </strow>
+                            <strow>
+                                <stentry>(dane dla poprz.rek.)</stentry>
+                                <stentry>Typ umowy</stentry>
+                                <stentry>Wartosc zlecenia zamowienia netto w PLN</stentry>
+                                <stentry>Wartosc zlecenia zamowienia netto w walucie</stentry>
+                                <stentry>Wartosc przedmiotu umowy netto w PLN</stentry>
+                                <stentry>Wartosc kosztowa przedmiotu umowy netto w walucie</stentry>
+                            </strow>
+                            <xsl:for-each select="current-group()">
+                                <xsl:sort select="field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.'))" order="descending"/>
+                                <xsl:choose>
+                                    <xsl:when test=" position() &lt; 100">
+                                        <strow>
+                                            <stentry><xsl:value-of select="field[@name='Data_utworzenia_sprawy']"/> / <!--<xsl:value-of select="field[@name='Tytul_dokumentu']"/>-->
+                                                <xsl:apply-templates mode="enter_to_ph_text" select="field[@name='Tytul_dokumentu']">
+                                                    <xsl:with-param name="element" select="'entry'"/>
+                                                </xsl:apply-templates>
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:choose>
+                                                    <xsl:when test="$group_name='Wprowadzajacy_wniosek___nazwisko_i_imie' or $xref_level &lt; 2">
+                                                        <xsl:value-of select="field[@name='Wprowadzajacy_wniosek___nazwisko_i_imie']"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xref href="../Wprowadzajacy_wniosek___nazwisko_i_imie/{ system_cache__appinfo:truncate_special_and_do_uppercase(field[@name='Wprowadzajacy_wniosek___nazwisko_i_imie'])}.dita">
+                                                            <xsl:value-of select="field[@name='Wprowadzajacy_wniosek___nazwisko_i_imie']"/>
+                                                        </xref>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:choose>
+                                                    <xsl:when test="$group_name='Pelna_nazwa_kontrahenta'  or $xref_level &lt; 2">
+                                                        <xsl:apply-templates mode="enter_to_ph_text" select="field[@name='Pelna_nazwa_kontrahenta']">
+                                                            <xsl:with-param name="element" select="'entry'"/>
+                                                        </xsl:apply-templates>
+                                                        <!--<xsl:value-of select="field[@name='Pelna_nazwa_kontrahenta']"/>-->
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xref href="../Pelna_nazwa_kontrahenta/{ system_cache__appinfo:truncate_special_and_do_uppercase(field[@name='Pelna_nazwa_kontrahenta'])}.dita">
+                                                            <xsl:apply-templates mode="enter_to_ph_text" select="field[@name='Pelna_nazwa_kontrahenta']">
+                                                                <xsl:with-param name="element" select="'entry'"/>
+                                                            </xsl:apply-templates>
+                                                            <!--<xsl:value-of select="field[@name='Pelna_nazwa_kontrahenta']"/>--></xref>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:choose>
+                                                    <xsl:when test="$group_name='Akceptujacy_merytorycznie___nazwisko_i_imie'  or $xref_level &lt; 2">
+                                                        <xsl:value-of select="field[@name='Akceptujacy_merytorycznie___nazwisko_i_imie']"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xref href="../Akceptujacy_merytorycznie___nazwisko_i_imie/{ system_cache__appinfo:truncate_special_and_do_uppercase(field[@name='Akceptujacy_merytorycznie___nazwisko_i_imie'])}.dita"><xsl:value-of select="field[@name='Akceptujacy_merytorycznie___nazwisko_i_imie']"/></xref>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:choose>
+                                                    <xsl:when test="$group_name='Osoba_merytoryczna___nazwisko_i_imie'  or $xref_level &lt; 2">
+                                                        <xsl:value-of select="field[@name='Osoba_merytoryczna___nazwisko_i_imie']"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xref href="../Osoba_merytoryczna___nazwisko_i_imie/{ system_cache__appinfo:truncate_special_and_do_uppercase(field[@name='Osoba_merytoryczna___nazwisko_i_imie'])}.dita">
+                                                            <xsl:value-of select="field[@name='Osoba_merytoryczna___nazwisko_i_imie']"/>
+                                                        </xref>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                                
+                                            </stentry>
+                                            <stentry>
+                                                <xsl:apply-templates mode="enter_to_ph_text" select="field[@name='Przedmiot_umowy']">
+                                                    <xsl:with-param name="element" select="'entry'"/>
+                                                </xsl:apply-templates>
+                                                <!--<xsl:value-of select="field[@name='Przedmiot_umowy']"/>-->
+                                            </stentry>
+                                        </strow>
+                                        <strow>
+                                            <stentry>(dane dla poprz.rek.)</stentry>
+                                            <stentry><xsl:value-of select="field[@name='Typ_umowy__aktualny_']"/></stentry>
+                                            <stentry><xsl:value-of select="format-number(xs:double(number(field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN']) ),'#,###.00')"/></stentry>
+                                            <stentry><xsl:value-of select="format-number(xs:double(number(field[@name='Wartosc_zlecenia_zamowienia_netto_w_walucie']) ),'#,###.00')"/></stentry>
+                                            <stentry><xsl:value-of select="format-number(xs:double(number(field[@name='Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_']) ),'#,###.00')"/></stentry>
+                                            <stentry><xsl:value-of select="format-number(xs:double(number(field[@name='Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie']) ),'#,###.00')"/></stentry>
+                                        </strow>
+                                    </xsl:when>
+                                    <xsl:when test="position() = 100 ">
+                                        <strow>
+                                            <stentry>Zestawienie zawiera więcej rekordów</stentry>
+                                            <stentry>Pominięto z uwagi na wielkość raportu</stentry>
+                                            <stentry/>
+                                            <stentry/>
+                                            <stentry/>
+                                            <stentry/>
+                                        </strow>
+                                    </xsl:when>
+                                    <xsl:otherwise/>
+                                </xsl:choose>
+                            </xsl:for-each>
+                        </simpletable>
+                    </p>
+                </body>
+            </topic>
+        </xsl:result-document>
+            
+        
+        
+    </xsl:template>
+    
+    <xsl:template match="*" mode="dita_ref_kontr_BI_audit_ENERGA_RUM_KONTRAHENCI" >
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="group_value" required="yes"/>
+        <topicref href="{$group_name}/{system_cache__appinfo:truncate_special_and_do_uppercase($group_value)}.dita"/>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

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

@@ -254,7 +254,7 @@
     
     <!-- to ignore -->
     <xsl:template match="*" mode="task"/>
-    <xsl:template match="*" />
+    
     
     <xsl:template match="CRM_IMAGE_CRM_PROCES|CRM_IMAGE_CRM_LISTA_ZASOBOW|CRM_IMAGE_CRM_WSKAZNIK" mode="postprocess_images_unique">
         <xsl:variable name="ext" select="substring-after(TYPE,'/')"/>

+ 281 - 0
SE/schema/default_db_xml_cache.public/default_db/EXAMPLE/EXAMPLE_tree_to_dita.xsl

@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+  <!--  <xsl:import href="../../escaped_html_to_xml.xsl"/>
+    <xsl:import href="../../dita_enter_to_ph.xsl"/>-->
+    <!--<xsl:import href="../../system_cache__appinfo/postprocess.xsl"/>-->
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+     <!-- file behind will be created dita files -->
+    
+   <!-- <xsl:param name="temp" required="yes"/>
+    <xsl:param name="uuid" required="yes"/>-->
+    
+    
+    <!-- do stworzenia ditamap na podstawie danych w CRM_PROCES -->
+    
+    
+    <!--<xsl:import href="../default_db_xml_cache.public/escaped_html_to_xml.xsl"/>-->
+    <!--<xsl:import href="../../dita_enter_to_ph.xsl"/>-->
+    
+    
+    <!--<xsl:apply-templates select="." mode="preprocess_root_EXAMPLE"/>-->
+    <xsl:template mode="preprocess_root_EXAMPLE" match="*|text()|comment()"/>
+    
+    <xsl:template mode="preprocess_root_EXAMPLE" match="RelatedFeatureRoot">
+        <xsl:comment>#36 mam <xsl:value-of select="ID"/></xsl:comment>
+        <xsl:for-each select="//EXAMPLE//(the_geom[ text()])" > <!-- group-by="../ID" -->
+            <xsl:comment>#37 mam <xsl:value-of select="../ID"/></xsl:comment>
+            <xsl:apply-templates mode="system_cache__dita:preprocess_images" select=".">
+                <xsl:with-param name="fileindex" select="concat(../ID,'_',../local-name())"/>
+            </xsl:apply-templates>
+        </xsl:for-each>
+        
+        <!-- Now search for dita_graphs -->
+        <!--<xsl:variable name="dita">
+            <xsl:for-each select="//*">
+                <xsl:apply-templates/>
+            </xsl:for-each>
+        </xsl:variable>
+        
+        <xsl:for-each select="$dita//simpletable">
+            <xsl:apply-templates select="." mode="system_cache__dita:graph__write_dita_preprocess">
+                <xsl:with-param name="fileindex" select="@id"/>
+            </xsl:apply-templates>
+        </xsl:for-each>-->
+        <!--<debug_dita>
+            <xsl:copy-of select="$dita//simpletable"/>
+        </debug_dita>-->
+    </xsl:template>
+    
+    <!--<xsl:apply-templates select="." mode="postprocess_root_EXAMPLE"/>-->
+    
+    <!--<xsl:template match="RelatedFeatureRoot">
+        <xsl:apply-templates mode="ditamap_root"/>
+    </xsl:template>-->
+    
+    
+    <!-- inform to process images from base64 -->
+    <xsl:template mode="postprocess_root_EXAMPLE" match="RelatedFeatureRoot">
+        <xsl:comment>postprocess_root_EXAMPLE</xsl:comment>
+            <!--<xsl:apply-templates mode="postprocess_images_EXAMPLE"/>-->
+            <xsl:for-each-group select="//(EXAMPLE_IMAGE)" group-by="ID">
+                <xsl:apply-templates mode="postprocess_images_EXAMPLE" select="."/>
+            </xsl:for-each-group>
+    </xsl:template>
+    
+    <xsl:template mode="postprocess_root_EXAMPLE" match="*|text()|comment()"/>
+        
+    
+    <!-- parse result to image template -->
+    <xsl:template match="CRM_IMAGE_CRM_PROCES|CRM_IMAGE_CRM_LISTA_ZASOBOW|EXAMPLE_IMAGE" mode="postprocess_images_EXAMPLE">
+        <xsl:variable name="ext" select="substring-after(TYPE,'/')"/>
+        <xsl:apply-templates mode="system_cache__dita:postprocess_image" select=".">
+            <xsl:with-param name="ext" select="$ext"/>
+            <xsl:with-param name="fileindex" select="ID"/>
+        </xsl:apply-templates>
+    </xsl:template>
+    
+    <!-- search for images -->
+    <xsl:template match="*" mode="postprocess_images_EXAMPLE">
+        <xsl:apply-templates mode="postprocess_images_EXAMPLE"/>
+    </xsl:template>
+    
+    <!-- deny rest -->
+    <xsl:template mode="postprocess_images_EXAMPLE" match="text()|comment()"/>
+    
+   
+    <!-- create root map -->
+    <xsl:template match="EXAMPLE" mode="ditamap_root">
+        <xsl:comment>#73 EXAMPLE matched</xsl:comment>
+        <map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:map.xsd">
+            <title>
+                <xsl:if test="not(ID='0')">{ <xsl:value-of select="ID"/> } </xsl:if>
+                <xsl:value-of select="DESC"/>
+            </title>
+            <xsl:apply-templates mode="ditamap" select="."/>
+        </map>
+    </xsl:template>
+    
+    
+        
+        
+    
+    <!-- some child element seen as dita topic -->
+    
+    <xsl:template match="EXAMPLE" mode="ditamap">
+        <topichead>
+            <topicmeta>
+                <navtitle> {<xsl:value-of select="ID"/>}
+                    <!--<xsl:apply-templates select="DESC" mode="system_cache__appinfo:extract_text"/>-->
+                    <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                            <xsl:with-param name="html" select="DESC"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                </navtitle>
+                <shortdesc>
+                    <!--<xsl:apply-templates select="OPIS" mode="system_cache__appinfo:extract_text"/>-->
+                    <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                            <xsl:with-param name="html" select="OPIS"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                </shortdesc>
+            </topicmeta>
+            <topicref href="{ID}_topic.dita">
+                <xsl:result-document href="{$temp}/{$uuid}/{ID}_topic.dita">
+                    <xsl:apply-templates select="."/>
+                </xsl:result-document>
+            <xsl:apply-templates mode="ditamap"/>
+            </topicref>
+        </topichead>
+    </xsl:template>
+    
+    <!-- insert image to dita by template -->
+    
+    <!--<xsl:template match="EXAMPLE_IMAGE" mode="dita" >
+        <xsl:comment>#118 EXAMPLE_IMAGE matched</xsl:comment>
+        <xsl:apply-templates select="." mode="system_cache__dita:process_image">
+            <xsl:with-param name="width"  select="WIDTH"/>
+            <xsl:with-param name="ext"  select="substring-after(TYPE,'/')"/>
+            <xsl:with-param name="fileindex"  select="ID"/>
+        </xsl:apply-templates>
+    </xsl:template>-->
+    
+    <!--<xsl:template match="IF_TRUE_GOTO" mode="example">
+        <xsl:variable name="text" select="text()"/>
+        <xsl:choose>
+            <xsl:when test="text() = '0'"/>
+            <xsl:otherwise>                
+                <xsl:choose>
+                    <xsl:when test="//PROCES_INIT[ID/text()= $text]"><note>Wyzwala procedurę: <xref href="{text()}_topic.dita"/></note></xsl:when>
+                    <xsl:when test="//PROCES[ID/text()= $text]"><note>Odniesienie do kroku: <xref href="#task_{text()}" format="dita"/></note></xsl:when>
+                    <xsl:otherwise>
+                        <note>Wyzwala do procedurę <xsl:value-of select="$text"/> (niewidoczna w tym opracowaniu)
+                            <xref
+                                href="{$TargetNamespaceBindings}/SE/version-git/procesy5.php?task=PROCES_VIEW_LIST&amp;HIDE_PANEL=1&amp;id_proces={text()}"
+                                format="html" scope="external"/>
+                        </note>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>-->
+    
+    
+        
+    
+    <!-- make child topic -->
+    <xsl:template match="EXAMPLE_CHILD" mode="ditamap">
+        <topicref href="{ID}_topic.dita">
+            <xsl:result-document href="{$temp}/{$uuid}/{ID}_topic.dita">
+                <xsl:apply-templates select="."/>
+            </xsl:result-document>
+            <xsl:apply-templates  mode="ditamap"/>
+        </topicref>
+    </xsl:template>
+    
+   
+    <xsl:template match="EXAMPLE|EXAMPLE_CHILD">
+        <topic id="task_{ID}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title>{<b><xsl:value-of select="ID"/></b>}
+                <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                    <xsl:call-template name="system_cache__appinfo:escaped_html_to_xml">
+                        <xsl:with-param name="html" select="DESC"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+            </title>
+            <prolog>
+                <author><xsl:value-of select="A_RECORD_CREATE_AUTHOR"/> w <xsl:value-of select="A_RECORD_CREATE_DATE"/></author>
+                <!--<change-historylist>
+                    <change-item>
+                        <change-completed>
+                            <xsl:value-of select="A_RECORD_UPDATE_DATE"/> <xsl:value-of select="A_RECORD_UPDATE_AUTHOR"/>
+                        </change-completed>
+                    </change-item>
+                </change-historylist>-->
+            </prolog>
+            <body>
+                <xsl:variable name="system_cache__appinfo:escaped_html_to_xml">
+                    <xsl:call-template name="escaped_html_to_xml_and_surrounded_enter" exclude-result-prefixes="#all">
+                        <xsl:with-param name="enter_surround_to" select="'p'"/>
+                        <xsl:with-param name="html" select="OPIS"/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <p>
+                <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="system_cache__appinfo:extract_text"/>
+                </p>
+                <p>
+                    <xsl:apply-templates mode="system_cache__dita:process_image" select="EXAMPLE_IMAGE">
+                        <xsl:with-param name="width" select="600"/>
+                    </xsl:apply-templates> <!-- It adds images if are in EXAMPLE_IMAGE -->
+                </p>
+                <p>
+                    <xsl:apply-templates mode="system_cache__dita:images__read" select="the_geom">
+                        <xsl:with-param name="fileindex" select="concat(ID,'_',local-name())"/>
+                    </xsl:apply-templates>
+                </p>
+                <xsl:variable name="simpletable">
+                    <simpletable frame="all" relcolwidth="1* 1* 1*" id="simpletable_rows__child_cheat_7{local-name()}_path_{ID}_{generate-id()}">
+                        <strow>
+                            <stentry>Poland</stentry>
+                            <stentry>Ukraine</stentry>
+                            <stentry>Estonia</stentry>
+                        </strow>
+                        <strow>
+                            <stentry>1</stentry>
+                            <stentry>2</stentry>
+                            <stentry>3</stentry>
+                        </strow>
+                        <strow>
+                            <stentry>3</stentry>
+                            <stentry>4</stentry>
+                            <stentry>5</stentry>
+                        </strow>
+                    </simpletable>
+                </xsl:variable>
+                <p>
+                    <xsl:copy-of select="$simpletable"/>
+                    <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                        <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                        <xsl:with-param name="width" select="300"/>
+                    </xsl:apply-templates>
+                </p>
+            </body>
+        </topic>
+    </xsl:template>
+    
+    
+    <!-- to ignore -->
+    
+    
+    
+    <!-- save image in telled by system_cache__dita:postprocess_image position -->
+    <xsl:template match="EXAMPLE_IMAGE" mode="postprocess_image_EXAMPLE">
+        <xsl:apply-templates select="." mode="system_cache__dita:postprocess_image">
+            <xsl:with-param name="fileindex" select="ID"/>
+            <xsl:with-param name="ext" select="substring-after(TYPE,'/')"/>
+        </xsl:apply-templates>
+    </xsl:template>
+    
+    
+    
+    
+    
+</xsl:stylesheet>

+ 150 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplot.xsl

@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!-- to create graphs - using WPS_Functions/graph_gnuplot/build_graph_gnuplot.xml -->
+    
+    <!-- example from web http://timmurphy.org/2014/08/11/creating-bar-charts-with-gnuplot/
+            
+            
+        plot <data_file> using <label_column>:xtic(<value_column>) with boxes
+                
+        barchart.gnuplot:
+        set terminal pngcairo font "arial,10" size 500,500
+        set output 'barchart.png'
+        set boxwidth 0.75
+        set style fill solid
+        set title "Population of Australian cities (millions), as of June 2012"
+        plot "population.dat" using 2:xtic(1) with boxes
+        
+        population.dat
+            Adelaide    1.277174
+            Brisbane    2.189878
+            Canberra    0.374658
+            Darwin      0.131678
+            Hobart      0.216959
+            Melbourne   4.246345
+            Sydney      4.667283
+        
+        -->
+    
+    
+    <!-- than use in _dita
+    
+    <xsl:apply-templates mode="system_cache__appinfo:images__read" select=".">
+                    <xsl:with-param name="fileindex" select="$fileindex"/>
+    </xsl:apply-templates>
+    -->
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    
+    
+    <xsl:template mode="system_cache__dita:graph__write_dita_preprocess" match="simpletable">
+        <!-- do stworzenia grafu na bazie tabeli simpletable w dita -->
+        <xsl:variable name="fileindex" select="@id"/>
+        <xsl:apply-templates mode="system_cache__dita:graph__write" select=".">
+            <xsl:with-param name="fileindex" select="$fileindex"/>
+        </xsl:apply-templates>
+        <xsl:result-document href="{$ditadir}/graph_to_image/{$fileindex}.gnuplot" omit-xml-declaration="yes">
+set terminal pngcairo font "arial,6" size 800,600
+set nokey
+set output '<xsl:value-of select="$fileindex"/>.png'
+set boxwidth 0.75
+set style fill solid
+set title "Wykres"
+plot "<xsl:value-of select="$fileindex"/>.gnuplot.dat" using 2:xtic(1) with boxes
+        </xsl:result-document>
+        <xsl:result-document href="{$ditadir}/graph_to_image/{$fileindex}.gnuplot.dat" omit-xml-declaration="yes">
+            <!--<system_cache__appinfo:graph_to_image.population.dat>-->
+                <!--<xsl:attribute name="local-name" select="local-name()"/>-->
+                <xsl:variable name="cols" select="count(strow[ position() = 1]/stentry)"/>
+                <xsl:variable name="strow" select="strow"/>
+                <xsl:for-each select="1 to $cols">
+                    <xsl:for-each select="$strow/stentry[ position() = current()]">
+                        <xsl:choose>
+                            <xsl:when test="position() = 1">
+                                <!--<xsl:value-of select="system_cache__appinfo:truncate_special_and_do_uppercase(.)"/><xsl:text>&#09;</xsl:text>-->
+                                <xsl:value-of select="string(.)"/><xsl:text>&#09;</xsl:text>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:value-of select="string(.)"/><xsl:text>&#09;</xsl:text>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:for-each>
+                    <xsl:text>&#10;</xsl:text>
+                </xsl:for-each>
+            <!--</system_cache__appinfo:graph_to_image.population.dat>-->
+            <!--<xsl:apply-templates mode="preprocess_gml_geometry_image" select="."/>-->
+        </xsl:result-document>
+        
+        
+    </xsl:template>
+    
+    <xsl:template match="*|text()" mode="system_cache__dita:graph__write_dita_preprocess">
+        <xsl:message terminate="yes"> #71 unknown element <xsl:value-of select="name()"/> /  <xsl:value-of select="."/></xsl:message>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__dita:graph_to_image" match="graphs">
+        <xsl:param name="fileindex" required="yes"/> <!-- ex. 3161_IN7_MK_BAZA_DYSTRYBUCJI - is related dir in dita dir with images -->
+        <xsl:param name="width" select="500"/>
+        <xsl:apply-templates mode="system_cache__appinfo:images">
+            <xsl:with-param name="fileindex" select="$fileindex"/>
+            <xsl:with-param name="width" select="$width"/>
+        </xsl:apply-templates>
+    </xsl:template>
+    
+    
+    
+    <xsl:template mode="system_cache__dita:graph_to_image" match="graph"> <!-- [@x and @y] -->
+        <xsl:param name="fileindex" required="yes"/>
+        <xsl:param name="width"  select="500"/>
+        <image href="graph_to_image/{$fileindex}.png" width="{$width}"/>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__dita:graph_to_image" match="*">
+        <xsl:message terminate="yes">#56 not expected data - needed @x and @y to be in xml image element: correct is: 
+            <graph x="1" y="1">
+                <title>some title</title>
+                <file>/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/graph_gnuplot/temp/graph_to_image/{$uuid}/image-1-1.png</file>
+            </graph>
+        </xsl:message>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__dita:graph__write" match="*">
+        <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
+        <graph_to_image srcfile="{$ditadir}/graph_to_image/{$fileindex}.gnuplot" dstfile="{$ditadir}/graph_to_image/{$fileindex}.png.xml"  fileindex="{$fileindex}" ditadir="{$ditadir}"/> <!--  barchart.gnuplot="{$ditadir}/graph_to_image/{$fileindex}.gnuplot" population.dat.dita="{$ditadir}/{$fileindex}.dat" barchart.png.dita="{$ditadir}/{$fileindex}.png" --> 
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__dita:graph__read" match="*">
+        <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
+        <xsl:param name="width" select="500"/>
+        <!-- to read and parse system_cache__appinfo:images -->
+        <!--<xsl:variable name="fileindex" select="concat(ID,'_',local-name())"/>-->
+        <xsl:choose>
+            <xsl:when test="doc-available(concat($ditadir,'/graph_to_image/',$fileindex,'.png.xml'))">
+                <xsl:apply-templates mode="system_cache__dita:graph_to_image" select="doc(concat($ditadir,'/graph_to_image/',$fileindex,'.png.xml'))">
+                    <xsl:with-param name="fileindex" select="$fileindex"/>
+                    <xsl:with-param name="width" select="$width"/>
+                </xsl:apply-templates>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:comment>#83 doc not aviable <xsl:value-of select="concat($ditadir,'/graph_to_image/',$fileindex,'.png.xml')"/></xsl:comment>
+                <xsl:message>#83 doc not aviable <xsl:value-of select="concat($ditadir,'/graph_to_image/',$fileindex,'.png.xml')"/></xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    
+    
+    
+    
+    
+</xsl:stylesheet>

+ 87 - 1
SE/schema/default_db_xml_cache.public/default_db/images/images.xsl

@@ -39,7 +39,93 @@
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     
-    <xsl:template mode="system_cache__appinfo:images" match="images">
+    <xsl:template match="*" mode="system_cache__dita:postprocess_image_convert">
+        <xsl:param name="ext" select="substring-after(TYPE,'/')"/>
+        <xsl:param name="fileindex" select="ID"/>
+        <base64_to_image srcfile="{$temp}/{$uuid}/{ID}_image.base64.{$ext}" dstfile="{$temp}/{$uuid}/{ID}_image.{$ext}" />
+    </xsl:template>
+    
+    
+    <xsl:template match="*" mode="system_cache__dita:process_image">
+        <xsl:param name="width" required="yes"/>
+        <xsl:param name="ext" select="substring-after(TYPE,'/')"/>
+        <xsl:param name="fileindex" select="ID"/>
+        <xsl:choose>
+            <xsl:when test="number($width) &gt; 600">
+                <image href="{$fileindex}_image.{$ext}" width="500"></image>
+            </xsl:when>
+            <xsl:otherwise>
+                <image href="{$fileindex}_image.{$ext}" width="{$width}"></image>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template match="*" mode="system_cache__dita:postprocess_image">
+        <xsl:param name="ext" select="substring-after(TYPE,'/')"/>
+        <xsl:param name="fileindex" select="ID"/>
+        <xsl:result-document href="{$temp}/{$uuid}/{ID}_image.base64.{$ext}" omit-xml-declaration="yes">
+            <xsl:value-of select="IMAGE/text()"/>
+        </xsl:result-document>
+        <xsl:apply-templates mode="system_cache__dita:postprocess_image_convert" select=".">
+            <xsl:with-param name="ext" select="$ext"/>
+            <xsl:with-param name="fileindex" select="$fileindex"/>
+        </xsl:apply-templates>
+    </xsl:template>
+    
+    <!-- IMAGES - gml!!! -->
+    
+    
+    
+    <xsl:template mode="system_cache__dita:preprocess_images" match="*">
+        <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
+        <xsl:comment>#90 system_cache__dita:preprocess_images</xsl:comment>
+            
+        <xsl:apply-templates mode="system_cache__dita:preprocess_images__write" select=".">
+                <xsl:with-param name="fileindex" select="$fileindex"/>
+            </xsl:apply-templates>
+            <xsl:result-document href="{$ditadir}/{$fileindex}.gml">
+                <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" 
+                    xmlns="http://www.opengis.net/wfs" 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:default_objects="https://biuro.biall-net.pl/wfs/ault_objects">
+                    <xsl:attribute name="local-name" select="local-name()"/>
+                    <gml:featureMember>
+                        <xsl:copy-of select="." copy-namespaces="no"/>
+                    </gml:featureMember>
+                </wfs:FeatureCollection>
+                <!--<xsl:apply-templates mode="preprocess_gml_geometry_image" select="."/>-->
+            </xsl:result-document>
+        
+        
+        <!-- podsumwoania po stanach -->
+        
+        
+    </xsl:template>
+    
+    
+    <xsl:template mode="system_cache__dita:preprocess_images__write" match="*">
+        <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
+        <gml_to_image srcfile="{$ditadir}/{$fileindex}.gml" dstfile="{$ditadir}/{$fileindex}.png.xml" fileindex="{$fileindex}" ditadir="{$ditadir}"/> 
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__dita:images__read" match="*">
+        <xsl:param name="fileindex" select="concat(ID,'_',local-name())"/>
+        <!-- to read and parse system_cache__appinfo:images -->
+        <!--<xsl:variable name="fileindex" select="concat(ID,'_',local-name())"/>-->
+        <xsl:choose>
+            <xsl:when test="doc-available(concat($ditadir,'/',$fileindex,'.png.xml'))">
+                <xsl:apply-templates mode="system_cache__appinfo:images" select="doc(concat($ditadir,'/',$fileindex,'.png.xml'))">
+                    <xsl:with-param name="fileindex" select="$fileindex"/>
+                </xsl:apply-templates>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:comment>#83 doc not aviable <xsl:value-of select="concat($ditadir,'/',$fileindex,'.png.xml')"/></xsl:comment>
+                <xsl:message>#83 doc not aviable <xsl:value-of select="concat($ditadir,'/',$fileindex,'.png.xml')"/></xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:template><xsl:template mode="system_cache__appinfo:images" match="images">
         <xsl:param name="fileindex" required="yes"/> <!-- ex. 3161_IN7_MK_BAZA_DYSTRYBUCJI - is related dir in dita dir with images -->
         <xsl:apply-templates mode="system_cache__appinfo:images">
             <xsl:with-param name="fileindex" select="$fileindex"/>

+ 11 - 7
SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.xsl

@@ -12,16 +12,18 @@
     <!--<xsl:import href="../dita_enter_to_ph.xsl"/>-->
     <xsl:include href="../default_db/enter_to_ph.xsl"/>
     
-    <xsl:include href="extract_text.xsl"/>
+    <xsl:include href="../truncate_special_and_do_uppercase.xsl"/><xsl:include href="extract_text.xsl"/>
     <xsl:include href="images/images.xsl"/>
     
-    <xsl:include href="CRM_PROCES/PROCES_INIT_tree_to_dita.xsl"/>
+    <xsl:include href="graph_gnuplot/graph_gnuplot.xsl"/><xsl:include href="CRM_PROCES/PROCES_INIT_tree_to_dita.xsl"/>
     <xsl:include href="IN7_MK_BAZA_DYSTRYBUCJI/IN7_MK_BAZA_DYSTRYBUCJI_tree_to_dita.xsl"/>
     <xsl:include href="L_APPOITMENT_USER/L_APPOITMENT_USER_tree_to_dita.xsl"/>
     
     
     
-    <xsl:output indent="yes"/>
+    <xsl:include href="BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors/BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors_tree_to_dita.xsl"/>
+    <xsl:include href="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl"/>
+    <xsl:include href="EXAMPLE/EXAMPLE_tree_to_dita.xsl"/><xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     
     <xsl:param name="temp" required="yes"/>
@@ -32,15 +34,17 @@
     <xsl:template mode="preprocess" match="RelatedFeatureRoot">
         <preprocess_dita>
             <xsl:comment>#27 match RelatedFeatureRoot</xsl:comment>
-            <xsl:apply-templates select="." mode="preprocess_root_IN7_MK_BAZA_DYSTRYBUCJI"/>
+            <xsl:apply-templates select="." mode="preprocess_root_EXAMPLE"/><xsl:apply-templates select="." mode="preprocess_root_IN7_MK_BAZA_DYSTRYBUCJI"/>
             <!--<xsl:apply-templates select="." mode="postprocess_root_PROCES_INIT"/>-->
-        </preprocess_dita>
+        <xsl:apply-templates select="." mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors"/>
+            <xsl:apply-templates select="." mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA"/>
+            <xsl:apply-templates select="." mode="postprocess_root_PROCES_INIT"/></preprocess_dita>
     </xsl:template>
     
     <xsl:template mode="postprocess" match="RelatedFeatureRoot">
         <postprocess_dita>
             <xsl:comment>#25 match RelatedFeatureRoot</xsl:comment>
-            <xsl:apply-templates select="." mode="postprocess_root_IN7_MK_BAZA_DYSTRYBUCJI"/>
+            <xsl:apply-templates select="." mode="postprocess_root_EXAMPLE"/><xsl:apply-templates select="." mode="postprocess_root_IN7_MK_BAZA_DYSTRYBUCJI"/>
             <xsl:apply-templates select="." mode="postprocess_root_PROCES_INIT"/>
         </postprocess_dita>
     </xsl:template>
@@ -54,4 +58,4 @@
     
     <xsl:template mode="ditamap" match="*"/>
     
-</xsl:stylesheet>
+<xsl:template match="*" /></xsl:stylesheet>

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

@@ -0,0 +1,754 @@
+<?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:wfs="http://www.opengis.net/wfs"
+    xmlns:gml="http://www.opengis.net/gml"
+    xmlns:ogc="http://www.opengis.net/ogc"
+    xmlns:get_wfs_recurse_xsl="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/get_wfs_recurse_xsl.xsd"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!-- TESTING for recurse get WFS using xsd schemas and/or retrieved xlinks  -->
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:param name="typeName" select="'p5_default_db:PROCES_INIT'"/>
+    <xsl:param name="xpath" select="'ID'"/>
+    <xsl:param name="xpath_value" select="'994'"/>
+    <xsl:param name="uuid" select="'PROCES_INIT_PID_994_ALL_test'"/>
+    
+    <!--<xsl:param name="procesy5_system_schema_file" required="yes"/>-->
+    <!--<xsl:param name="vrtfNamespaces_file" required="yes"/>-->
+    
+    <xsl:param name="username" select="'a.binder'"/>
+    <xsl:param name="username.pass"  required="yes"/>
+    
+    <xsl:param name="simpleSchema_dir" required="yes"/>
+    
+    <xsl:param name="targetNamespace_DEFAULTS_prefix" select="'default_db'"/> <!-- TODO should be detected -->
+    <xsl:param name="debug" select="1"/>
+    
+    
+    <xsl:param name="api" select="'biuro.biall-net.pl/SE/version-git/wfs-data.php'"/>
+    <xsl:param name="protocol" select="'https://'"/>
+    
+    <!--<xsl:variable name="vrtfNamespaces" select="doc($vrtfNamespaces_file)"/>
+    <xsl:variable name="procesy5_system_schema" select="doc($procesy5_system_schema_file)"/>
+    -->
+    
+    <xsl:param name="ignore_maxOccurs_0" select="'1'"/>
+    
+    
+    <xsl:function name="get_wfs_recurse_xsl:GetsimpleSchema">
+        <xsl:param name="typeNameRealResource"/>
+        <xsl:variable name="featureID_name_dita" select="substring-after($typeNameRealResource,':')"/>
+        <xsl:variable name="simpleSchemaFile" select="concat($simpleSchema_dir,'/',$targetNamespace_DEFAULTS_prefix,'/',$featureID_name_dita,'.xml')"/>
+        <xsl:message>get_wfs_recurse_xsl:GetsimpleSchema: <xsl:value-of select="$simpleSchemaFile"/></xsl:message>
+        <xsl:copy-of select="doc($simpleSchemaFile)"/>
+    </xsl:function>
+    
+    <xsl:function name="get_wfs_recurse_xsl:typeNameRealResource">
+        <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
+        <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/@typeNameRealResource"/>
+    </xsl:function>
+    <xsl:function name="get_wfs_recurse_xsl:RelatedFilter">
+        <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
+        <xsl:value-of select="$get_wfs_recurse_xsl:GetsimpleSchema/(RelatedFeatureRoot|RelatedFeature)/RelatedFilter"/>
+    </xsl:function>
+    
+        
+    <xsl:function name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter">
+        <xsl:param name="get_wfs_recurse_xsl:GetsimpleSchema"/>
+        <xsl:copy-of select="$get_wfs_recurse_xsl:GetsimpleSchema/RelatedFeature/simpleTypeMakeOgcFilter"/>
+    </xsl:function>
+    
+    <xsl:function name="get_wfs_recurse_xsl:xpath_dita">
+        <xsl:param name="xpath"/>
+        <xsl:param name="get_wfs_recurse_xsl:xpath"/>
+        <xsl:choose>
+            <xsl:when test=" string-length($get_wfs_recurse_xsl:xpath) &gt;0">
+                <xsl:value-of select="$get_wfs_recurse_xsl:xpath"/>
+                <xsl:if test="$debug &gt; 2"><xsl:message>#121 narzucam $xpath=(<xsl:value-of select="$get_wfs_recurse_xsl:xpath"/>) z wyzwolenia build.xml </xsl:message></xsl:if>
+            </xsl:when>
+            <xsl:otherwise><xsl:value-of select="$xpath"/></xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+    <xsl:function name="get_wfs_recurse_xsl:xpath_value_dita">
+        <xsl:param name="xpath"/>
+        <xsl:param name="xpath_value"/>
+        <!--<xsl:param name="get_wfs_recurse_xsl:xpath_value"/>-->
+        <xsl:param name="input_obj_with_xpath"/>
+        
+        <xsl:variable name="get_wfs_recurse_xsl: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:if test="$debug &gt; 2"><xsl:message>#67.1 $input_obj_with_xpath: <xsl:copy-of select="$input_obj_with_xpath"/> </xsl:message></xsl:if>-->
+                    <!--<xsl:variable name="xpath_value_token">-->
+                    <xsl:call-template name="xpath_filter_apply">
+                        <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
+                        <xsl:with-param name="xpath" select="$xpath"/>
+                        <xsl:with-param name="xpath_value" select="$xpath_value"/>
+                    </xsl:call-template>
+                    <!--</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:when test="string-length($get_wfs_recurse_xsl:xpath_value) &gt;0">
+                    <xsl:if test="$debug &gt; 2"><xsl:message>#67.0 $xpath_value=(<xsl:value-of select="$get_wfs_recurse_xsl:xpath_value"/>); narzucone pewnie z wyzwolenia build.xml</xsl:message></xsl:if>
+                    <xsl:value-of select="$get_wfs_recurse_xsl:xpath_value"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="$get_wfs_recurse_xsl:xpath_value"/><!-\- parametr z template narzuca wartosc -\->
+                </xsl:otherwise>-->
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:copy-of select="$get_wfs_recurse_xsl:xpath_value_dita"/>
+    </xsl:function>
+    
+    <xsl:template match="And" mode="simpleTypeMakeOgcFilter_merge_apply">
+        <xsl:choose>
+            <xsl:when test="child::node()">
+                <xsl:value-of select="'&lt;ogc:And&gt;'"/>
+                <xsl:apply-templates mode="simpleTypeMakeOgcFilter_merge_apply"/>
+                <xsl:value-of select="'&lt;/ogc:And&gt;'"/>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template match="*" mode="simpleTypeMakeOgcFilter_merge_apply" xpath-default-namespace="http://www.opengis.net/ogc">
+        <xsl:value-of select="concat('&lt;',name(),'&gt;')"/>
+        <xsl:apply-templates mode="simpleTypeMakeOgcFilter_merge_apply"/>
+        <xsl:value-of select="concat('&lt;/',name(),'&gt;')"/>
+    </xsl:template>
+    
+    <xsl:template match="text()" mode="simpleTypeMakeOgcFilter_merge_apply">
+        <xsl:value-of select="."/>
+    </xsl:template>
+    
+    <xsl:template name="simpleTypeMakeOgcFilter_merge"><!-- do zrobienia polaczonego filtru OGC -->
+        <xsl:param name="simpleTypeMakeOgcFilter" required="yes"/>
+        <xsl:param name="xpath_dita" required="yes"/> <!-- @value -->
+        <xsl:param name="xpath_value_dita" required="yes"/> <!-- @xpath_value -->
+      <!--  <xsl:param name="get_wfs_recurse_xsl:xpath_dita" required="yes"/>
+        <xsl:param name="get_wfs_recurse_xsl:xpath_value_dita" required="yes"/>-->
+        <xsl:param name="RelatedFilter"/>
+        <xsl:if test="$debug &gt; 2"><xsl:message>#1754 name="simpleTypeMakeOgcFilter_merge"
+            $simpleTypeMakeOgcFilter = <xsl:copy-of select="$simpleTypeMakeOgcFilter"></xsl:copy-of>
+            $get_wfs_recurse_xsl:xpath_dita = <xsl:copy-of select="$xpath_dita"/>
+            $get_wfs_recurse_xsl:xpath_value_dita = <xsl:copy-of select="$xpath_value_dita"/>
+            #EOF
+        </xsl:message>
+        </xsl:if>
+        <xsl:value-of select="'&amp;Filter=&lt;ogc:Filter&gt;'"/>
+        <xsl:variable name="Filter">
+            <And>
+                <xsl:for-each select="$RelatedFilter">
+                    <ogc:PropertyIsEqualTo>
+                        <ogc:PropertyName><xsl:value-of select="$xpath_dita"/></ogc:PropertyName>
+                        <ogc:Literal><xsl:value-of select="$xpath_value_dita"/></ogc:Literal>
+                    </ogc:PropertyIsEqualTo>
+                </xsl:for-each>
+                <ogc:PropertyIsEqualTo>
+                    <ogc:PropertyName><xsl:value-of select="$xpath_dita"/></ogc:PropertyName>
+                    <ogc:Literal><xsl:value-of select="$xpath_value_dita"/></ogc:Literal>
+                </ogc:PropertyIsEqualTo>
+                <And>
+                    <xsl:for-each select="$simpleTypeMakeOgcFilter/*">
+                        <xsl:copy-of select="."/>
+                    </xsl:for-each>
+                </And>
+            </And>
+        </xsl:variable>
+        <xsl:apply-templates select="$Filter" mode="simpleTypeMakeOgcFilter_merge_apply"/>
+        <xsl:value-of select="'&lt;/ogc:Filter&gt;'"/>
+    </xsl:template>
+    
+    <xsl:template name="xpath_filter_apply"> <!-- do przetworzenia filtra na podstawie danych wezla poprzedniego $input_obj_with_xpath oraz podanych parametrow @xpath i @xpath_value -->
+        <xsl:param name="input_obj_with_xpath" required="yes"/>
+        <xsl:param name="xpath" required="yes"/>
+        <xsl:param name="xpath_value" required="yes"/>
+        <xsl:variable name="xpath_value_token">
+            <xsl:for-each select=" tokenize($xpath_value,'/')">
+                <xsl:if test="$debug &gt; 2"><xsl:message>#341 znalazlem dla=<xsl:value-of select="."/>; ; <xsl:value-of select="$input_obj_with_xpath/node()[@xpath=current()]"/></xsl:message></xsl:if>
+                <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:if test="$debug &gt; 2"><xsl:message>#345 ustalam na <xsl:value-of select="$xpath_value_token/node()[1]/text()"/>;</xsl:message></xsl:if>
+        <!--<xsl:value-of select="$xpath_value_token/node()[1]/text()"/>-->
+        <xsl:value-of select="$xpath_value_token"/>
+    </xsl:template>
+    
+    
+    
+    <!--${simpleSchema_dir}/${namespace_prefix_p5_tr_map}/${main_build_recurse_ant.tr_map_sed}.xml-->
+    <xsl:template name="main">
+        <xsl:param name="typeName" select="$typeName"/>
+        <xsl:param name="api" select="$api"/>
+        <xsl:param name="protocol" select="$protocol"/>
+        <xsl:param name="targetNamespace_DEFAULTS_prefix" select="$targetNamespace_DEFAULTS_prefix"/>
+        <!--<xsl:param name="xpath_value" select="$xpath_value"/>-->
+        <xsl:param name="get_wfs_recurse_xsl:xpath"/>
+        <xsl:variable name="input_obj_with_xpath"><input_obj_with_xpath/></xsl:variable>
+        <xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>
+        <!--<xsl:copy-of select="$get_wfs_recurse_xsl:GetsimpleSchema"/>-->
+        <xsl:variable name="get_wfs_recurse_xsl:typeNameRealResource" select="get_wfs_recurse_xsl:typeNameRealResource($get_wfs_recurse_xsl:GetsimpleSchema)"/>
+        
+        <xsl:variable name="xpath_dita" select="$xpath"/>
+        <xsl:variable name="xpath_value_dita" select="$xpath_value"/>
+        
+        <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter($get_wfs_recurse_xsl:GetsimpleSchema)"/>
+        <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="get_wfs_recurse_xsl:RelatedFilter($get_wfs_recurse_xsl:GetsimpleSchema)"/>
+        <xsl:variable name="OGC_Filter">
+            <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
+                <xsl:with-param name="simpleTypeMakeOgcFilter" select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
+                <xsl:with-param name="RelatedFilter" select="$get_wfs_recurse_xsl:RelatedFilter"/>
+                
+                <xsl:with-param name="xpath_dita" select="$xpath"/>
+                <xsl:with-param name="xpath_value_dita" select="$xpath_value"/>
+                <!--<xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath"/>-->
+                <!--<xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value"/>-->
+                
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:if test="$debug &gt; 3">
+         <xpath_dita>
+             <xsl:value-of select="$xpath_dita"></xsl:value-of>
+         </xpath_dita>
+         <xpath_value_dita>
+             <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
+         </xpath_value_dita>
+                 <!--  <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
+                       <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
+                   </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
+                   <Filter>
+                       <xsl:copy-of select="$OGC_Filter"/>
+                   </Filter>-->
+        </xsl:if>
+        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15')"/>
+        <xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>
+        <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($url_string)"/>
+        <xsl:if test="$debug &gt; 5">
+            <wfs_response>
+            <request>Retrieving <xsl:value-of select="$url_string"/></request>
+                <oryg>https://                     biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:CRM_PROCES&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</oryg>
+                <test>https://a.binder:@biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:PROCES_INIT&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</test>
+                
+                <!--<xsl:copy-of select="$wfs_response"/>-->
+                
+                <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>-->
+            </wfs_response>
+        </xsl:if>
+        <xsl:apply-templates mode="after_first_ant_assing_vars" select="$get_wfs_recurse_xsl:GetsimpleSchema">
+            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
+        </xsl:apply-templates>
+    </xsl:template>
+    
+    
+    
+    <!--<xsl:template match="RelatedFeature" mode="get_wfs_recurse_xsl:wfs_response">
+        <xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>
+        <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response">
+            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
+        </xsl:apply-templates>
+    </xsl:template>-->
+    
+    <!--<xsl:template match="simpleTypeMakeOgcFilter|RelatedFilter" mode="get_wfs_recurse_xsl:wfs_response"/>-->
+        
+    <!--<xsl:template match="*" mode="get_wfs_recurse_xsl:wfs_response">
+        <xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>
+        <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_simpleType" select="$get_wfs_recurse_xsl:wfs_response"/>
+        <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature">
+            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
+        </xsl:apply-templates>
+    </xsl:template>-->    
+    
+    
+    
+    
+    
+    <xsl:template mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature" match="RelatedFeature">
+        <!--<xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>-->
+        <xsl:param name="get_wfs_recurse_xsl:typeNameRealResource" select="@typeNameRealResource"/>
+        <xsl:param name="input_obj_with_xpath" required="yes"/>
+        <!--<xsl:param name="xpath"  select="$xpath"/>-->
+        <!--<xsl:param name="xpath_value"  select="$xpath_value"/>-->
+        <!--<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>-->
+        <xsl:variable name="xpath_dita" select="get_wfs_recurse_xsl:xpath_dita('',@xpath)"/>
+        <xsl:variable name="xpath_value_dita" select="get_wfs_recurse_xsl:xpath_value_dita(@xpath,@xpath_value,$input_obj_with_xpath)"/>
+        <!--<xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>-->
+        <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
+        <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="RelatedFilter"/>
+        <xsl:variable name="OGC_Filter">
+            <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
+                <xsl:with-param name="simpleTypeMakeOgcFilter" select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
+                <xsl:with-param name="RelatedFilter" select="$get_wfs_recurse_xsl:RelatedFilter"/>
+                <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
+                <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
+               <!-- <xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath_dita"/>
+                <xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value_dita"/>-->
+            </xsl:call-template>
+        </xsl:variable>
+     
+        <!--<input_obj_with_xpath><xsl:copy-of select="$input_obj_with_xpath"/></input_obj_with_xpath>-->
+        <xsl:if test="$debug &gt; 4">
+            <xpath_dita>
+                <xsl:value-of select="$xpath_dita"/>/@xpath_value: <xsl:value-of select="@xpath_value"/>
+            </xpath_dita>
+            <xpath_value_dita>
+                <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
+            </xpath_value_dita>
+            <!--  <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
+                          <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
+                      </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
+                      <Filter>
+                          <xsl:copy-of select="$OGC_Filter"/>
+                      </Filter>-->
+        </xsl:if>
+        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15')"/>
+        <xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>
+        <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($url_string)"/>
+        <xsl:if test="$debug &gt; 5">
+            <wfs_response>
+                <request>Retrieving <xsl:value-of select="$url_string"/></request>
+                <oryg>https://                     biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:CRM_PROCES&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</oryg>
+                <test>https://a.binder:@biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:PROCES_INIT&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</test>
+                <xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response//gml:featureMember[1]"/>
+            </wfs_response>
+        </xsl:if>
+        <xsl:apply-templates mode="after_first_ant_assing_vars" select="." >
+            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
+        </xsl:apply-templates>
+        
+    </xsl:template>
+    
+    
+    <xsl:template mode="get_wfs_recurse_xsl:wfs_response_RelatedFeatureLoop" match="RelatedFeature">
+        <!--<xsl:param name="get_wfs_recurse_xsl:wfs_response" required="yes"/>-->
+        <xsl:param name="get_wfs_recurse_xsl:typeNameRealResource" select="@typeNameRealResource"/>
+        <xsl:param name="input_obj_with_xpath" required="yes"/>
+        <xsl:param name="xpath"  select="$xpath"/>
+        <xsl:param name="xpath_value"  select="$xpath_value"/>
+        <!--<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>-->
+        <xsl:variable name="xpath_dita" select="get_wfs_recurse_xsl:xpath_dita('',$xpath)"/>
+        <xsl:variable name="xpath_value_dita" select="get_wfs_recurse_xsl:xpath_value_dita($xpath,$xpath_value,$input_obj_with_xpath)"/>
+        <!--<xsl:variable name="get_wfs_recurse_xsl:GetsimpleSchema" select="get_wfs_recurse_xsl:GetsimpleSchema($typeName)"/>-->
+        <xsl:variable name="get_wfs_recurse_xsl:simpleTypeMakeOgcFilter" select="simpleTypeMakeOgcFilter"/>
+        <xsl:variable name="get_wfs_recurse_xsl:RelatedFilter" select="RelatedFilter"/>
+        <xsl:variable name="OGC_Filter">
+            <xsl:call-template name="simpleTypeMakeOgcFilter_merge">
+                <xsl:with-param name="simpleTypeMakeOgcFilter" select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
+                <xsl:with-param name="RelatedFilter" select="$get_wfs_recurse_xsl:RelatedFilter"/>
+                
+                <xsl:with-param name="xpath_dita" select="$xpath_dita"/>
+                <xsl:with-param name="xpath_value_dita" select="$xpath_value_dita"/>
+                
+             <!--   <xsl:with-param name="get_wfs_recurse_xsl:xpath_dita" select="$xpath_dita"/>
+                <xsl:with-param name="get_wfs_recurse_xsl:xpath_value_dita" select="$xpath_value_dita"/>-->
+            </xsl:call-template>
+        </xsl:variable>
+        
+        <!--<input_obj_with_xpath><xsl:copy-of select="$input_obj_with_xpath"/></input_obj_with_xpath>-->
+        <xsl:if test="$debug &gt; 4">
+            <debug>
+                <xsl:attribute name="typeNameRealResource" select="@typeNameRealResource"/>
+                <xsl:attribute name="typeName" select="@typeName"/>
+              <xpath_dita>
+                  <xsl:value-of select="$xpath_dita"/>/@xpath_value: <xsl:value-of select="@xpath_value"/>
+              </xpath_dita>
+              <xpath_value_dita>
+                  <xsl:value-of select="$xpath_value_dita"></xsl:value-of>
+              </xpath_value_dita>
+            </debug>
+        </xsl:if>
+        <!--  <get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
+                      <xsl:copy-of select="$get_wfs_recurse_xsl:simpleTypeMakeOgcFilter"/>
+                  </get_wfs_recurse_xsl:simpleTypeMakeOgcFilter>
+                  <Filter>
+                      <xsl:copy-of select="$OGC_Filter"/>
+                  </Filter>-->
+        
+        <xsl:variable name="request_string" select="concat('?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=',$get_wfs_recurse_xsl:typeNameRealResource,$OGC_Filter,'&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15')"/>
+        <xsl:variable name="url_string" select="concat($protocol,$username,':',$username.pass,'@',$api,'/',$targetNamespace_DEFAULTS_prefix,'/',$request_string)"/>
+        <xsl:variable name="get_wfs_recurse_xsl:wfs_response" select="doc($url_string)"/>
+        <xsl:if test="$debug &gt; 4">
+            <wfs_response>
+                <request>Retrieving <xsl:value-of select="$url_string"/></request>
+                <oryg>https://                     biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:CRM_PROCES&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</oryg>
+                <test>https://a.binder:@biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=p5_default_db:PROCES_INIT&amp;SRSNAME=EPSG:3003&amp;MAXFEATURES=15</test>
+               <!-- <debug_child_loop>-->
+                    <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>-->
+                <!--</debug_child_loop>-->
+                <!--<xsl:copy-of select="$get_wfs_recurse_xsl:wfs_response"/>-->
+            </wfs_response>
+        </xsl:if>
+        <xsl:apply-templates mode="after_first_ant_assing_vars" select="." >
+            <xsl:with-param name="get_wfs_recurse_xsl:wfs_response" select="$get_wfs_recurse_xsl:wfs_response"/>
+        </xsl:apply-templates>
+    </xsl:template>
+    <xsl:template mode="get_wfs_recurse_xsl:wfs_response_simpleType" match="*">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <xsl:template match="wfs:FeatureCollection">
+        <xsl:apply-templates/>
+    </xsl:template>
+    
+    <xsl:template  match="gml:featureMember">
+        <xsl:apply-templates mode="gml:featureMember"/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="gml:featureMember">
+         <!-- TODO parse from prefx requested type -->
+    </xsl:template>
+    
+    
+    
+    
+    
+    
+    <!-- xpath -->
+    
+    <xsl:template match="text()|comment()" mode="after_first_ant_assing_vars"/>
+      
+      
+      <xsl:template match="RelatedFeature" mode="after_first_ant_assing_vars">
+          <xsl:param name="loop_xpath" />
+          <xsl:param name="get_wfs_recurse_xsl:wfs_response"  required="yes"/>
+        <!--<RelatedFeatureRoot>-->
+            
+        <!-- first assign xpath to features from  -->
+        <xsl:variable name="wfs_output_nodes" select="$get_wfs_recurse_xsl:wfs_response"/>
+        <xsl:variable name="current_RelatedFeature" select="*"/>
+        <xsl:variable name="xml_id" select="@xml_id"/>
+        <xsl:variable name="feature_pos_parent" select="@feature_pos"/>
+        
+            <xsl:if test="$debug &gt; 2"><xsl:message>
+                     {+}{+}{+}{+}{+}{+}{+}{+}{+}{+} #354 count($wfs_output_nodes//gml:featureMember) <xsl:value-of select="count($wfs_output_nodes//gml:featureMember)"/></xsl:message></xsl:if>
+          <!-- 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">
+                <!--<wfs_record>
+                    <xsl:copy-of select="."/>
+                </wfs_record>-->
+                <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>
+                <xsl:variable name="input_obj_fid" select="*"/> <!-- dla wykrycia @fid -->
+                <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:with-param name="feature_pos_parent" select="$feature_pos_parent"/> <!-- @2017-04 byly nadpisywane informacje - trzeba dorzucic jeszcze $feature_pos_parent w nazwie przetwarzania -->
+                    <xsl:with-param name="input_obj_fid" select="$input_obj_fid"/>
+                </xsl:apply-templates>
+                <!-- cache tasks ? -->
+            </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"/>
+        <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:choose>
+                            <xsl:when test="name()='fid'"/>
+                            <xsl:otherwise><xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute></xsl:otherwise>
+                        </xsl:choose>
+                    </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="simpleTypeMakeOgcFilter" mode="after_first_ant_assing_vars_childs">
+        <xsl:if test="$debug &gt; 2"><xsl:message>#621 bypassing simpleTypeMakeOgcFilter in after_first_ant_assing_vars_childs</xsl:message></xsl:if>
+    </xsl:template>
+    
+    
+    <!-- przetwarzanie kolejne w celu podstawienia wartosci i wystawienia build dla kolejnych wezlow - problem z obsluga rownorzednie zagniezdzonych wezlow poprzez inne wezly -->
+    <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:param name="feature_pos_parent"  required="yes"/>
+        <xsl:param name="input_obj_fid" required="no"/>
+        <xsl:for-each select=".">
+            <xsl:choose>
+              
+                <xsl:when test="1=2"/>
+                <xsl:otherwise>
+                    <xsl:element name="{local-name()}">
+                        <!--<xsl:if test="$input_obj_fid">
+                             <!-\-<xsl:attribute name="input_obj_fid_name" select="$input_obj_fid/name()"/>-\->
+                             <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>
+                        </xsl:if>-->
+                        <!--<xsl:copy-of select="namespace::node()"/>-->
+                        <xsl:for-each select="@*">
+                            <xsl:choose>
+                                <xsl:when test="name()='fid'"/>
+                                <xsl:when test="name()='xml_id'"/>
+                                <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="enter_to_ph">-->
+                                    <xsl:choose>
+                                        <!--<xsl:when test="@xpath_token_filter and @xpath_token ">
+                                            <!-\- implementacja filtra dla czegos oddzielonego parametrem -\->
+                                            <xsl:variable name="xpath_token_filter" select="tokenize($input_obj_with_xpath/node()[local-name()=current()/@xpath],@xpath_token_filter)"/>
+                                            <xsl:for-each select=" tokenize(@xpath_token,' ')">
+                                                <xsl:variable name="xpath_token" select="number(.)"/>
+                                                <xsl:copy-of select="$xpath_token_filter[$xpath_token]"></xsl:copy-of>
+                                            </xsl:for-each>
+                                        </xsl:when>-->
+                                        <xsl:when test="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/*">
+                                            <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/*"/>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                            <xsl:copy-of select="$input_obj_with_xpath/node()[local-name()=current()/@xpath]/text()"/>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
+                                <!--</xsl:variable>-->
+                                <!--<xsl:copy-of select="$enter_to_ph"/>-->
+                            </xsl:when>
+                        </xsl:choose>
+                        <!--<xsl:comment>#1938 value of text()</xsl:comment>-->
+                        <!--XXXX <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:with-param name="feature_pos_parent" select="$feature_pos_parent"/>
+                            <xsl:with-param name="input_obj_fid" select="$input_obj_fid"/>
+                        </xsl:apply-templates>
+                    </xsl:element>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
+    </xsl:template>
+    <xsl:template  match="RelatedFeature" mode="after_first_ant_assing_vars_childs">
+        <xsl:if test="$debug &gt; 2"><xsl:message>#1638 ignored @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>; @typeName=<xsl:value-of select="@typeName"/>; @xml_id=<xsl:value-of select="@xml_id"/>;  </xsl:message></xsl:if>
+    </xsl:template> <!-- to disable ignored maxOccurs=0 -->
+    
+    <xsl:template  match="RelatedFeature[not(@system_cache__appinfo:maxOccurs='0') or not($ignore_maxOccurs_0)]" 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"  />
+        <xsl:param name="feature_pos"   required="yes"/>
+        <xsl:param name="feature_pos_parent" required="yes"/>
+        <xsl:param name="input_obj_fid" required="yes"/>
+        <xsl:param name="xpath_query"/> <!-- + added test -->
+        <xsl:if test="$debug &gt; 2"><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></xsl:if>
+        <!-- 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,'/',$xml_id,'.',$feature_pos)"/> <!-- loop path too long ,'.',$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: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:if test="$debug &gt; 2"><xsl:message>[][][][][]\/\/\/\/\/\/\/\/\/\/\/ #1540  jest okazja do zrobienia bilda $feature_pos_parent = <xsl:value-of select="$feature_pos_parent"/> ; $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"/>;  match=RelatedFeature mode=after_first_ant_assing_vars_childs  </xsl:message></xsl:if>
+                <xsl:comment>#527 there we exec child dig</xsl:comment>
+              <!--  <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:attribute name="feature_pos" select="$feature_pos"/>
+                    <xsl:attribute name="feature_pos_parent" select="$feature_pos_parent"/>
+                    <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>-->
+                    <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeature" select=".">
+                        <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
+                    </xsl:apply-templates>
+                <!--</xsl:element>-->
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:if test="$debug &gt; 2"><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:if>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:template>
+    
+    <xsl:template  match="RelatedFeatureLoop" mode="after_first_ant_assing_vars_childs">
+        <xsl:if test="$debug &gt; 2"><xsl:message>#1718 ignored @maxOccurs=<xsl:value-of select="@system_cache__appinfo:maxOccurs"/>; @typeName=<xsl:value-of select="@typeName"/>; @xml_id=<xsl:value-of select="@xml_id"/>; </xsl:message></xsl:if>
+    </xsl:template>
+    <xsl:template  match="RelatedFeatureLoop[not(@system_cache__appinfo:maxOccurs='0') or not($ignore_maxOccurs_0)]" 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"  />
+        <xsl:param name="feature_pos"   required="yes"/>
+        <xsl:param name="feature_pos_parent" required="yes"/>
+        <xsl:param name="input_obj_fid" required="yes"/>
+        <xsl:param name="xpath_query"/> <!-- + added test -->
+        <xsl:if test="$debug &gt; 2"><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></xsl:if>
+        <!-- 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,'/',$xml_id,'.',$feature_pos)"/> <!-- loop path too long ,'.',$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: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:if test="$debug &gt; 2"><xsl:message>[][][][][]\/\/\/\/\/\/\/\/\/\/\/ #1540  jest okazja do zrobienia bilda $feature_pos_parent = <xsl:value-of select="$feature_pos_parent"/> ; $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"/>;  match=RelatedFeature mode=after_first_ant_assing_vars_childs  </xsl:message></xsl:if>
+                <xsl:comment>#527 there we exec child dig</xsl:comment>
+               <!-- <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:attribute name="feature_pos" select="$feature_pos"/>
+                    <xsl:attribute name="feature_pos_parent" select="$feature_pos_parent"/>
+                    <xsl:attribute name="fid" select="$input_obj_fid/@fid"/>-->
+                    <xsl:comment>#710 opening new Loop recurse instance for <xsl:value-of select="@typeName"/></xsl:comment>
+                    <xsl:apply-templates mode="get_wfs_recurse_xsl:wfs_response_RelatedFeatureLoop" select="get_wfs_recurse_xsl:GetsimpleSchema(@typeName)">
+                        <xsl:with-param name="input_obj_with_xpath" select="$input_obj_with_xpath"/>
+                        <xsl:with-param name="xpath" select="@xpath"/>
+                        <xsl:with-param name="xpath_value" select="@xpath_value"/>
+                    </xsl:apply-templates>
+                <!--</xsl:element>-->
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:if test="$debug &gt; 2"><xsl:message terminate="yes">#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:if>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </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 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:if test="$debug &gt; 2"><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>
+        <xsl:if test="$ignore_maxOccurs_0"><xsl:if test="$debug &gt; 2"><xsl:message terminate="no">#1344 test igrnore is true()=<xsl:value-of select="$ignore_maxOccurs_0"/>;</xsl:message></xsl:if></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>

+ 7 - 3
SE/schema/default_db_xml_cache.public/object_modeling_new_by_xml_schema.xsl

@@ -131,7 +131,7 @@
             <xsl:for-each select="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
                 <xsl:element name="{name()}">
                     <xsl:copy-of select="@*"/>
-                </xsl:element>
+                <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_add_xml_schema_child_annotation"/></xsl:element>
             </xsl:for-each>
             <xsl:variable name="current" select="element"/>
             <xsl:for-each select="$merge_complexType/element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
@@ -143,7 +143,7 @@
                         <xsl:element name="{name()}">
                             <xsl:attribute name="name" select="@name"/>
                             <xsl:attribute name="type" select="$merge_complexType/ancestor::node()/simpleType[@name= substring-after(current()/@type,':')]/restriction/@base" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
-                        </xsl:element>
+                        <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_add_xml_schema_child_annotation"/></xsl:element>
                     </xsl:otherwise>
                 </xsl:choose>
             </xsl:for-each>
@@ -165,4 +165,8 @@
     </xsl:template>-->
     
     
-</xsl:stylesheet>
+<xsl:template match="annotation" mode="system_cache__appinfo:object_modeling_new_add_xml_schema_child_annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*|comment()|text()" mode="system_cache__appinfo:object_modeling_new_add_xml_schema_child_annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:stylesheet>

+ 59 - 0
SE/schema/default_db_xml_cache.public/system_cache__appinfo/external_schema_targetNamespace.xsl

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    
+    xmlns:system_cache__resources_tree_required_occurs_raport="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/resources_tree_required_occurs_raport"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:function name="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace">
+        <xsl:param name="system_cache__appinfo:document-uri"/><!-- system_cache__appinfo:document-uri="external_schema/ksiegi_wieczyste/zsin_1013.xsd" -->
+        <xsl:value-of select="replace($system_cache__appinfo:document-uri,'(/|:)','__')"/>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix">
+        <xsl:param name="system_cache__appinfo:document-uri"/><!-- system_cache__appinfo:document-uri="external_schema/ksiegi_wieczyste/zsin_1013.xsd" -->
+        <xsl:value-of select="replace($system_cache__appinfo:document-uri,'(/|:|\.)','__')"/>
+    </xsl:function>
+    
+    
+    
+    <xsl:function name="system_cache__appinfo:object_install_se_ant_object.merge_external_targetNamespace">
+        <xsl:param name="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace"/><!-- system_cache__appinfo:document-uri="external_schema__x2F__ksiegi_wieczyste__x2F__zsin_1013.xsd" -->
+        <xsl:param name="name"/>
+        <xsl:value-of select="concat($system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace,'__',$name)"/>
+    </xsl:function>
+    
+    <xsl:template match="schema" mode="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace>
+            <xsl:choose>
+                <xsl:when test="@targetNamespace">
+                    <xsl:copy-of select="@targetNamespace"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace(../@system_cache__appinfo:document-uri)"/>
+                    <xsl:message>#35 detect. targetNamespace <xsl:value-of select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace(../@system_cache__appinfo:document-uri)"/></xsl:message>
+                </xsl:otherwise>
+            </xsl:choose>
+        </system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace>
+    </xsl:template>
+    
+    <xsl:function name="system_cache__appinfo:object_install_se_ant_object.create_targetNamespace">
+        <xsl:param name="targetNamespace"/> <!-- like external_schema__ksiegi_wieczyste__zsin_1013.xsd -->
+        <xsl:param name="generate_tables_from_external_root.path.last_token"/> <!-- like OSOBA  -->
+        <xsl:value-of select="concat($targetNamespace,'/',$generate_tables_from_external_root.path.last_token)"/>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__appinfo:object_install_se_ant_object.create_prefix">
+        <xsl:param name="prefix"/> <!-- like external_schema__ksiegi_wieczyste__zsin_1013.xsd -->
+        <xsl:param name="generate_tables_from_external_root.path.last_token"/> <!-- like OSOBA  -->
+        <xsl:value-of select="concat($prefix,'__x3a__',$generate_tables_from_external_root.path.last_token)"/>
+    </xsl:function>
+    
+    
+</xsl:stylesheet>

+ 2 - 2
SE/schema/default_db_xml_cache.public/system_cache__appinfo/postprocess.xsl

@@ -53,7 +53,7 @@
         </xsl:choose>
     </xsl:template>
     
-    <xsl:template mode="system_cache__appinfo:preprocess" match="gml_to_image">
+    <xsl:template mode="system_cache__appinfo:preprocess" match="gml_to_image|graph_to_image">
         <xsl:choose>
             <xsl:when test="@srcfile and @dstfile and @fileindex">
                 
@@ -66,7 +66,7 @@
                         <xsl:element name="{name()}">
                             <xsl:copy-of select="@*"/>
                             <property name="basedir" value="{$basedir}"/>
-                            <xsl:for-each select="property">
+                            <property name="uuid" value="{$uuid}"/><xsl:for-each select="property">
                                 <xsl:element name="{name()}">
                                     <xsl:attribute name="name" select="@name"/>
                                     <xsl:attribute name="value" select="$current_node/@*[name()= current()/@name]"/>

+ 13 - 0
SE/schema/default_db_xml_cache.public/truncate_special_and_do_uppercase.xsl

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:function name="system_cache__appinfo:truncate_special_and_do_uppercase">
+        <xsl:param name="group_value"/>
+        <xsl:value-of select="upper-case(translate($group_value, translate($group_value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', ''), ''))" />
+    </xsl:function>
+    
+</xsl:stylesheet>