Преглед изворни кода

praca nad zagniezdzeniami + style ktore chce upublicznic z ktorych maja korzystac ant templaty do robienia drukow i raportow

a.binder пре 9 година
родитељ
комит
de908d1dcb
33 измењених фајлова са 5319 додато и 3 уклоњено
  1. 29 3
      SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build.xml
  2. 77 0
      SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build_recurse_ant.xsl
  3. 223 0
      SE/schema/default_db_xml_cache.public/ADMIN_USERS__documents.xsl
  4. 612 0
      SE/schema/default_db_xml_cache.public/ADMIN_USERS__wyposazenie.xsl
  5. 306 0
      SE/schema/default_db_xml_cache.public/CRM_LISTA_ZASOBOW_OFFERS__options.xsl
  6. 168 0
      SE/schema/default_db_xml_cache.public/CRM_LISTA_ZASOBOW_tree.xsl
  7. 81 0
      SE/schema/default_db_xml_cache.public/IN7_MK_BAZA_DYSTRYBUCJI_tree.xsl
  8. 121 0
      SE/schema/default_db_xml_cache.public/PROCESY5_TO_BPMN_one_file.xsl
  9. 114 0
      SE/schema/default_db_xml_cache.public/PROCES_INCLUDE.xsl
  10. 17 0
      SE/schema/default_db_xml_cache.public/Pools.xsl
  11. 324 0
      SE/schema/default_db_xml_cache.public/TERYT_procesy5.xsl
  12. 396 0
      SE/schema/default_db_xml_cache.public/TERYT_terc_xml_import.xsl
  13. 50 0
      SE/schema/default_db_xml_cache.public/_procesy_gen.xsl
  14. 80 0
      SE/schema/default_db_xml_cache.public/_stanowiska_nazwy_gen_ant.xsl
  15. 165 0
      SE/schema/default_db_xml_cache.public/ant.xsl
  16. 154 0
      SE/schema/default_db_xml_cache.public/crm_lista_zasobow_to_xsd.xsl
  17. 137 0
      SE/schema/default_db_xml_cache.public/crm_proces_parse.xsl
  18. 201 0
      SE/schema/default_db_xml_cache.public/escaped_html_to_xml.xsl
  19. 226 0
      SE/schema/default_db_xml_cache.public/find_child_proces.xsl
  20. 92 0
      SE/schema/default_db_xml_cache.public/import_resource_table_xml_from_api.xsl
  21. 206 0
      SE/schema/default_db_xml_cache.public/procesy5_to_bpmn.xsl
  22. 138 0
      SE/schema/default_db_xml_cache.public/procesy_gen_include.xsl
  23. 138 0
      SE/schema/default_db_xml_cache.public/procesy_gen_include_single_proces.xsl
  24. 257 0
      SE/schema/default_db_xml_cache.public/procesy_to_bpmn.xsl
  25. 166 0
      SE/schema/default_db_xml_cache.public/procesy_to_bpmn_single_proces.xsl
  26. 256 0
      SE/schema/default_db_xml_cache.public/procesy_to_bpmn_subprocess.xsl
  27. 52 0
      SE/schema/default_db_xml_cache.public/procesy_to_cubetto.xsl
  28. 75 0
      SE/schema/default_db_xml_cache.public/stanowiska_nazwy_gen.xsl
  29. 43 0
      SE/schema/default_db_xml_cache.public/test_xsl-fo.xsl
  30. 145 0
      SE/schema/default_db_xml_cache.public/transform_z_sql.xsl
  31. 87 0
      SE/schema/default_db_xml_cache.public/web_ui.xsl
  32. 56 0
      SE/schema/default_db_xml_cache.public/wfs.xsl
  33. 127 0
      SE/schema/default_db_xml_cache.public/xlsx.xsl

+ 29 - 3
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build.xml

@@ -15,14 +15,18 @@
     <!-- przykladowy URL ktory przekazuje parametry do tego ANT -->
     <!--https://biuro.biall-net.pl/SE/version-git/index.php?_route=UrlAction_Ant&_task=ant&
         path=${default_db.in7_dziennik_koresp/test-get-wfs-xml} -  this is the place to keep ant build (directory name with build.xml)  
-        &namespace=p5_default_db:Rozdzielcza_test_bzyk_PE&featureID=123 - this is setting the <property name="url" value="${url}"/> - to point what is record/table to download
+        &namespace=p5_default_db:Rozdzielcza_test_bzyk_PE&featureID=123 - this is setting the 
+        <property name="url" value="${url}"/> - to point what is record/table to download
         <property name="uuid" value="${uuid}"/> it is automatically also set to enable uinque transaction and to allow to save data with user
         <property name="passwordBase64Basic" value="${passwordBase64Basic}"/> - this is also set - to enable communicate with API -
         <property name="DwebRootUrl" value="${$webRootUrl}"/> - this is the place where script is localized to easyli to target user GUI by href to generated output      
     />
     -->
     
-    
+    <!-- variables to first transform of doc for then get related features -->
+    <property name="build_recurse_ant.xsl" value="build_recurse_ant.xsl"/>
+    <property name="build_recurse_ant.xml" value="build_recurse_ant.xml"/><!-- build do wytworzenia pierwszego przetworzenia zagniezdzen -->
+    <property name="main_build_recurse_ant.dita" value="main_build_recurse_ant.dita"/>
  
     <property name="uuid" value="${uuid}"/>
     <property name="passwordBase64Basic" value="${passwordBase64Basic}"/>
@@ -33,6 +37,24 @@
     <tempfile property="out_task.dita" deleteonexit="no"  destdir="temp"/>
     <tempfile property="wfs_output" deleteonexit="no"  destdir="temp"  />
 
+
+   
+
+    <!-- wygenerowanie ant builda do sciagniecia niezbednego elementu na podstawie template main.dita i tam zagniezdzonego RelatedFeature-->
+    <target name="build_recurse_ant.xml">
+        <xslt basedir="./" style="${build_recurse_ant.xsl}" in="${wfs_output}"  destdir="./" out="${build_recurse_ant.xml}" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita}"/>
+        </xslt>
+    </target>
+
+
+
+
+
     <target name="get_related_feature">
         
         <exec executable="curl"  output="${wfs_output}" errorproperty="wfs_error" resultproperty="wfs_result">
@@ -49,8 +71,12 @@
              <arg value="echo &quot;${url}&quot; |sed 's/[a-zA-Z0-9]*.php.*//'"/>
         </exec>
         <echo message="ERROR__END"/>
+        
     </target>
-
+    
+    
+    
+    
 
 
     <target name="buildpdf" depends="get_related_feature">

+ 77 - 0
SE/schema/ant-url_action/default_db.in7_dziennik_koresp/test-druk/build_recurse_ant.xsl

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output indent="yes" />
+    <xsl:strip-space elements="*"/>
+    <!--
+    <property name="url" value="${url}"/> - to point what is record/table to download
+    <property name="uuid" value="${uuid}"/> it is automatically also set to enable uinque transaction and to allow to save data with user
+    <property name="passwordBase64Basic" value="${passwordBase64Basic}"/> - this is also set - to enable communicate with API -
+    <property name="DwebRootUrl" value="${$webRootUrl}"/> - this is the place where script is localized to easyli to target user GUI by href to generated output   -->
+    
+    <!-- variables to be set first by GUI first_request from executing API (php -> bash)-->
+    <xsl:param name="uuid" />
+    <xsl:param name="passwordBase64Basic" />
+    <xsl:param name="url" />
+    <xsl:param name="DwebRootUrl" /> 
+    
+    
+    
+    <!-- static project variables as default styles.dita/xsl and names-->
+    <xsl:param name="main_build_recurse_ant.dita" select="'main_build_recurse_ant.dita'"/>
+    <xsl:param name="build_recurse_ant.xsl" select="'build_recurse_ant.xsl'"/>
+    
+    
+    <xsl:template match="RelatedFeature" mode="first_input_ant" >
+    
+    <!--  template do przetworzenia dity w celu wykrycia:
+        <RelatedFeature xpath="ID_BILLING_OWNER" typeName="p5_default_db:BILLING_OWNER">
+        <ph>Nadawca:</ph><br/>
+        <ph xpath="name1"/><br/>
+        <ph xpath="name2"/><br/>
+        <ph xpath="miasto"/><br/>
+        <ph xpath="nr_rach"/><br/>
+        <ph xpath="BILLING_OWNER_EMAIL"/><br/>
+      </RelatedFeature>
+      
+      i wyrzucenia z tego pierwszego zadania ANT do otrzymania niezbednego .xml w celu jego podstawienia pod dite
+      w celu pozniejszego ponownego wyzwolenia tego template az do zakonczenia cyklu finalnego.
+      
+      Template powinien budować projekt ant do wyzwolenia z odpowiednimi parametrami dalszymi
+      
+    -->
+    
+    
+            <project basedir="." name="PRINT_TEMPLATE" default="buildpdf">
+                <property name="uuid" value="${uuid}"/>
+                <property name="passwordBase64Basic" value="${passwordBase64Basic}"/>
+                <property name="url" value="${url}"/>
+                <property name="DwebRootUrl" value="${$webRootUrl}"/>
+                
+                
+                <tempfile property="out_task.dita" deleteonexit="no"  destdir="temp"/>
+                <tempfile property="wfs_output" deleteonexit="no"  destdir="temp"  />
+                
+                <target name="get_related_feature">
+                    
+                    <exec executable="curl"  output="${wfs_output}" errorproperty="wfs_error" resultproperty="wfs_result">
+                        <arg line="-H 'Authorization: Basic ${passwordBase64Basic}' ${url}"/>
+                    </exec>
+                    <echo message="curl -H 'Authorization: Basic ${passwordBase64Basic}' '${url}'"/>
+                    
+                    <echo message="ERROR__START"/>
+                    <echo message="${wfs_error}"/>
+                    
+                    <echo> gues path of pdf is </echo>
+                    <exec  executable="bash" dir="." outputproperty="url_of_current_script">
+                        <arg value="-c"/>
+                        <arg value="echo &quot;${url}&quot; |sed 's/[a-zA-Z0-9]*.php.*//'"/>
+                    </exec>
+                    <echo message="ERROR__END"/>
+                </target>
+            </project>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 223 - 0
SE/schema/default_db_xml_cache.public/ADMIN_USERS__documents.xsl

@@ -0,0 +1,223 @@
+<?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:default_db="http://biuro.biall-net.pl/xmlschema_procesy5/default_db"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!--funkcje do generowania umow o prace itp -->
+    
+    
+    <xsl:import href="import_resource_table_xml_from_api.xsl"/>
+    <xsl:import href="form_occurs_max_sequence.xsl"/>
+    <xsl:import href="get_all_xsd.xsl"/>
+    <xsl:import href="CRM_LISTA_ZASOBOW_tree.xsl"/>
+    <xsl:import href="IN7_MK_BAZA_DYSTRYBUCJI_tree.xsl"/>
+    
+    
+    
+    <xsl:variable name="DEVICES">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'DEVICES'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="LDAP_GROUPS">
+        <!-- ID , NAME -->
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'LDAP_GROUPS'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="CRM_LISTA_ZASOBOW">
+        <!-- ID , A_LDAP_GID(LDAP_GROUPS)-->
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'CRM_LISTA_ZASOBOW'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="IN7_DZIENNIK_KORESP">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'IN7_DZIENNIK_KORESP'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="IN7_MK_BAZA_DYSTRYBUCJI">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'IN7_MK_BAZA_DYSTRYBUCJI'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="TELBOXES">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'TELBOXES'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="PROBLEMS">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'PROBLEMS'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="system_cache__appinfo:transform_cache__CRM_LISTA_ZASOBOW_tree">
+        <xsl:call-template name="system_cache__appinfo:transform_cache__CRM_LISTA_ZASOBOW_tree"/>
+    </xsl:variable>
+    <xsl:variable name="system_cache__appinfo:transform_cache__IN7_MK_BAZA_DYSTRYBUCJI_tree">
+        <xsl:call-template name="system_cache__appinfo:transform_cache__IN7_MK_BAZA_DYSTRYBUCJI_tree"/>
+    </xsl:variable>
+    
+    
+    <!-- @2015-08-03 - do skonczenia nie gotowy mozna skasowac -->
+    <xsl:template name="main">
+        <xsl:call-template name="ADMIN_USERS__umowa_o_prace"/>
+    </xsl:template>
+    
+    
+    
+    
+    
+    <xsl:template name="ADMIN_USERS__umowa_o_prace">
+      dupa
+    </xsl:template>
+    
+    
+    <!--<xsl:template name="ADMIN_USERS__umowa_o_prace">
+        
+        [1164].[2655].2012-03-22
+        
+        Umowa o pracę na okres próbny
+        
+        
+        zawarta w Gdańsku, w dniu YYYY-MM-DD pomiędzy:
+        
+        „Biall-net” Spółką z ograniczoną odpowiedzialnością, z siedzibą w Otominie przy ul.  Słonecznej 43, (80-174 Otomin) wpisaną do rejestru przedsiębiorców Krajowego Rejestru Sądowego pod numerem KRS: 0000210311, której dokumentacja przechowywana jest przez Sąd Rejonowy Gdańsk – Północ w Gdańsku, VII Wydział Gospodarczy KRS, o numerze NIP: 593-22-68-672,  REGON: 192120212, reprezentowaną przez: Arkadiusza Binder – Prezesa Zarządu, zwaną dalej „Pracodawcą”, 
+        
+        a
+        
+        IMIE-KLIKNIJ-2-RAZY NAZWISKO, synem/córką** SYN_CORKA , zamieszkałym w KOD_POCZTOWY MIASTO_ZAMIESZKANIA, przy ul. ULICA_ZAMIESZKANIA NUMER_ULICY / NR_MIESZK, o nr PESEL: PESEL legitymującym się dowodem osobistym o serii i numerze NUMER_DOWODU, wydanym przez DOWOD_WYDANY_PRZEZ, o numerze NIP: NIP_NUMER, zwanym dalej „Pracownikiem”, 
+        
+        zwanymi dalej łącznie „Stronami”, o treści następującej: 
+        
+        
+        § 1 Oświadczenia Pracownika
+        1. Pracownik oświadcza, iż posiada umiejętności oraz doświadczenie niezbędne do wykonywania pracy powierzonej mu przez Pracodawcę. 
+        2. Pracownik oświadcza, iż świadczoną przez niego pracę wykonywać będzie z należytą starannością, wymaganą przy powierzonych mu zadaniach. 
+        
+        § 2 Przedmiot Umowy 
+        1. Pracodawca zatrudnia Pracownika na okres próbny do OKRES_UMOWY_DO(**). 
+        2. Strony dopuszczają możliwość wcześniejszego rozwiązania umowy zgodnie z art. 34 K.P.
+        3. Dniem rozpoczęcia pracy jest DATA_ROZP_PRACY
+        
+        
+        § 3warunki Pracy 
+        1. Pracownik zatrudniony zostaje na stanowisku: STANOWISKO. 
+        2. Miejscem wykonywania pracy przez Pracownika jest teren województwa pomorskiego, w szczególności zaś biura handlowe Pracodawcy w Gdańsku oraz każdorazowa siedziba Pracodawcy, którą na chwilę zawierania niniejszej Umowy jest Otomin. W związku z zatrudnieniem Pracownika może on zostać zobowiązany do wykonywania pracy w innych miejscach w kraju i zagranicą wskazanych mu przez Pracodawcę.         
+        3. Pracownik jest zatrudniony w wymiarze ILOSC_ETATU_SLOWNIE etatu.
+        4. Pracownika obowiązuje podstawowy system czasu pracy.
+        
+        § 4 Wynagrodzenie 
+        Za wykonywaną pracę Pracownikowi przysługuje wynagrodzenie w wysokości WYNAGRODZENIE_BRUTTO brutto.
+        
+        § 5 Dodatkowe Obowiązki Pracownika
+        1. W związku ze świadczeniem na rzecz Pracodawcy pracy Pracownik zobowiązany jest się do:
+        a. zachowania w ścisłej tajemnicy wszelkich informacji dotyczących działalności oraz organizacji Pracodawcy, w szczególności lecz nie wyłącznie technologii przez niego stosowanych, danych osobowych oraz teleadresowych klientów i kontrahentów Pracodawcy, ich sytuacji finansowej, warunków współpracy, o których Pracownik poweźmie wiedzę w trakcie okresu stosunku pracy zwanymi dalej „Informacjami Poufnymi”,
+        b. podjęcia wszelkich niezbędnych działań mających na celu zapewnienie, aby żadna z osób trzecich, przez które rozumiana będzie każda osoba nie będąca Pracodawcą lub Pracownikiem nie weszła czy to odpłatnie czy nieodpłatnie w posiadanie Informacji Poufnych, w szczególności poprzez odpowiednie przechowywanie i archiwizację nośników pamięci oraz znajdujących się na nich plików komputerowych zawierających Informacje Poufne, jak również odpowiednie wykorzystywanie i przechowywanie sprzętu komputerowego,  
+        c. powstrzymania się od jakiegokolwiek wykorzystywania Informacji Poufnych dla potrzeb własnych lub innych niezwiązanych ściśle z aktualnie wykonywanymi obowiązkami pracowniczymi na rzecz Pracodawcy,
+        d. powstrzymania się od wynoszenia po za siedzibę Pracodawcy jakichkolwiek dokumentów w formie papierowej lub elektronicznej znajdujących się na nośnikach danych (płytach CD, DVD, jakichkolwiek kasetach, kartach pamięci, twardych dyskach, zarówno znajdujących się w komputerach jak i osobno, w tym również pamięciach USB z układem flash, tzw.pendrive’ach itp) zawierających Informacje Poufne. 
+        2. Obowiązki dotyczące zachowania poufności, o których mowa w ust.1 są nieograniczone w czasie i obowiązują także po zakończeniu stosunku pracy pomiędzy stronami z jakiegokolwiek powodu, chyba że Pracodawca w oświadczeniu złożonym pod rygorem nieważności w formie pisemnej w sposób wyraźny zwolni Pracownika z obowiązku zachowania takiego obowiązku. Pracownik nie jest upoważniony do jakiegokolwiek dodatkowego wynagrodzenia z tytułu zachowania w tajemnicy wyżej określonych informacji.
+        3. Naruszenie przez Pracownika obowiązków, o których mowa w ust.1-3 a także uporczywe lub szczególnie naganne naruszenie innych obowiązków Pracownika, stanowi ciężkie naruszenie obowiązków pracowniczych uprawniających Pracodawcę do rozwiązania umowy o pracę z Pracownikiem bez wypowiedzenia z winy Pracownika. 
+        4. Szczegółowy zakres odpowiedzialności materialnej Pracownika za mienie powierzone mu przez Pracodawcę może zostać określony w dodatkowej umowie o odpowiedzialności materialnej lub umowie o współodpowiedzialności materialnej pracowników. 
+        5. Szczegółowy zakres zakazu prowadzenia działalności konkurencyjnej przez Pracownika w trakcie trwania stosunku pracy, jak i po jego ustaniu może zostać określony w dodatkowej umowie o zakazie konkurencji.  
+        
+        § 6 Postanowienia Końcowe 
+        1. Wszelkie zmiany lub uzupełnienia niniejszej umowy winny być pod rygorem nieważności sporządzane na piśmie. 
+        2. Integralną część niniejszej umowy stanowi załącznik: nr 1 – obowiązek informacyjny Pracodawcy,
+        3. W zakresie nieuregulowanym w niniejszej umowie zastosowanie mają przepisy Kodeksu pracy oraz pozostałe bezwzględnie obowiązujące przepisy prawa polskiego jak również przepisy wewnętrzne obowiązujące u Pracodawcy.
+        4. Niniejsza umowa została sporządzona w dwóch jednobrzmiących egzemplarzach po jednym dla każdej ze stron. 
+        
+        Oświadczam, że egzemplarz niniejszej umowy otrzymałam i po zapoznaniu się z jej treścią zaproponowane mi warunki pracy i wynagrodzenia przyjmuję. Równocześnie przyjmuję do wiadomości treść artykułu 183a rozdz. 2a Kodeksu Pracy o treści: „Pracownicy powinni być równo traktowani w zakresie nawiązania i rozwiązania stosunku pracy, warunków zatrudnienia, awansowania oraz dostępu do szkolenia w celu podnoszenia kwalifikacji zawodowych, w szczególności bez względu na płeć, wiek, niepełnosprawność, rasę, religię, narodowość, przekonania polityczne, przynależność związkową, pochodzenie etniczne, wyznanie, orientację seksualną, a także bez względu na zatrudnienie na czas określony lub nieokreślony albo w pełnym lub w niepełnym wymiarze czasu pracy (…) dotyczącego m.in. równego traktowania kobiet i mężczyzn i oświadczam, że zobowiązuję się do przestrzegania porządku i dyscypliny pracy. 
+        
+        
+        
+        
+        Data:
+        
+        _________________						_________________
+        
+        /Pracodawca/						       	     /Pracownik/	
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        
+        [1164].[2665].2012-03-22
+        Załącznik nr 1 do umowy o pracę
+        
+        
+        
+        W związku z art.29 § 3 kodeksu pracy zobowiązującym Pracodawcę  do poinformowania na piśmie pracownika o dodatkowych warunkach zatrudnienia, Pracodawca niniejszym informuje:
+        
+        
+        1) W trakcie trwania pracy Pracownikowi przysługuje prawo do przerwy zgodnie z postanowieniami Kodeksu Pracy (Art. 134 KP). Każdorazowe skorzystanie z przerwy i opuszczenie stanowiska pracy musi zostać przez Pracownika zaznaczone w formularzu grafiku [formularz 1199].
+        2) Obowiązująca Pracownika dobowa norma czasu pracy nie może przekraczać 8 godzin, a tygodniowa norma czasu pracy wynosi 40 godzin w okresie rozliczeniowym nie przekraczającym 4 miesięcy. 
+        3) Pracownikowi w trakcie zatrudnienia przysługuje prawo do odpłatnego urlopu wypoczynkowego w wymiarze ustalonym zgodnie z art. 154 Kodeksu pracy.  
+        4) Przyporządkowanie: pozycji stanowiska pracy Pracownika w strukturze organizacyjnej Pracodawcy, jak również osoby bezpośredniego przełożonego Pracownika wskazane jest w aktualnym schemacie organizacyjnym określonym przez Zarząd Pracodawcy i udostępnionym w sposób zwyczajowo przyjęty, w szczególności poprzez umieszczenie go w sieci intranet Pracodawcy.   
+        5) Szczegółowy zakres obowiązków pracowniczych związanych ze stanowiskiem pracy na którym zatrudniony jest Pracownik wskazany jest każdorazowo w schemacie organizacyjnym określonym przez Zarząd Pracodawcy i udostępnionym w sposób zwyczajowo przyjęty, w szczególności poprzez umieszczenie go w sieci intranet Pracodawcy.  Aktualnie zakres obowiązków dostępny jest na adresie http://biuro.biall-net.pl/procesy5.php?task=CRM_WYSWIETL_OBOWIAZKI . Pracownik jest zobowiązany przynajmniej 1 raz w miesiącu do weryfikacji zadań dla swojego stanowiska. Ponadto zadania indywidualne dla pracownika, które dotyczą załatwiania konkretnych spraw wynikają z obiegu dokumentów i usankcjonowane są w Rejestrze Spraw. 
+        6) W razie szczególnych potrzeb Pracodawcy w myśl art. 151 Kodeksu pracy na polecenie przełożonego, Pracownik zobowiązuje się pracować za dodatkowym wynagrodzeniem, ponad ustawowy wymiar godzin, również w niedziele i pozostałe dni ustawowo wolne od pracy.
+        7) Potwierdzeniem przybycia i obecności w pracy jest podpisanie listy obecności.
+        8) Pracownik zobowiązany jest świadczyć pracę zgodnie z harmonogramem pracy ogłaszanym przez Pracodawcę. Pracodawca dokonuje ogłoszenia harmonogramu poprzez wywieszenie go w widocznym miejscu w siedzibie Pracodawcy lub w inny zwyczajowo przyjęty u niego sposób na siedem dni przed końcem miesiąca. 
+        9) Nieobecność w pracy należy niezwłocznie, lecz nie później niż drugiego dnia nieobecności zgłosić telefonicznie do bezpośredniego przełożonego Pracownika. Pracownik informuje pracodawcę o nieobecności w pracy i jej przyczynach w formie telefonicznej lub w formie e-mailowej. W przypadku nieobecności spowodowanej chorobą, zaświadczenie lekarskie potwierdzające brak możliwości wykonywania pracy należy dostarczyć w terminach wskazanych przez obowiązujące przepisy prawa Pracodawcy osobiście, przez pełnomocnika lub listem poleconym wysłanym na adres siedziby Pracodawcy. Wszelka nieobecność nieusprawiedliwiona w powyższy sposób będzie uważana za nieusprawiedliwioną. 
+        A) Za nieprzestrzeganie przez Pracownika ustalonej organizacji i porządku w procesie pracy, przepisów bezpieczeństwa i higieny pracy, przepisów przeciwpożarowych, a także przyjętego sposobu potwierdzania przybycia i obecności w pracy oraz usprawiedliwiania nieobecności w pracy, Pracodawca stosuje w zależności od rodzaju przewinienia karę upomnienia lub karę nagany. Za nieprzestrzeganie przez Pracownika przepisów bezpieczeństwa i higieny pracy, przepisów przeciwpożarowych, opuszczenie pracy bez usprawiedliwienia, stawienie się do pracy w stanie nietrzeźwości lub spożywanie alkoholu w czasie pracy – Pracodawca może zastosować również karę pieniężną w wysokości jednodniowego wynagrodzenia Pracownika za jedno przekroczenie lub za jeden dzień nieusprawiedliwionej nieobecności w pracy. Pracodawca wymierza poszczególne kary w trybie określonym w Rozdziale VI Kodeksu pracy.
+        10) Wynagrodzenie oraz pozostałe świadczenia pieniężne płatne będą na rachunek bankowy pracownika nr NUMER_KONTA_BANK Zmiana nr rachunku bankowego, na który wypłacane ma być wynagrodzenie dokonana na pisemny wniosek Pracownika, złożony za pokwitowaniem Pracodawcy bądź wysłany Pracodawcy przesyłką poleconą za zwrotnym poświadczeniem odbioru nie stanowi zmiany niniejszej Umowy. Pracodawca kwituje odbiór wynagrodzenia podpisem na liście płac. 
+        11) Wynagrodzenie płatne będzie z dołu, w ciągu pierwszych 10 dni następnego miesiąca kalendarzowego. W przypadku, gdy będzie to dzień wolny od pracy, wynagrodzenie będzie wypłacone w dzień poprzedzający.
+        12) Pora nocna u Pracodawcy obejmuje 8 godzin między godzinami 22.00 a 6.00. 
+        13) Pracownik nie jest objęty układem zbiorowym pracy. 
+        14) Pracodawca będzie prowadzić  monitorowanie  audio-video stanowiska pracy. Monitoring audio-video  w miejscu prowadzony będzie w sposób proaktywny i opierał się będzie na ocenie wydajności Pracownika. Zebrane w ten sposób informacje nie zostaną wykorzystane w żadnym innym celu. Monitoring audio-wideo jest zgodny z polskim prawem i uzasadniony jest ochroną systemu informatycznego oraz zapobieżeniu działań mogących zaszkodzić zakładowi pracy. Pracodawca wprowadzając monitoring  audio-video deklaruje się kierować zasadą adekwatności. Oznacza to, że podjęte środki będą proporcjonalne do celu jaki zamierza osiągnąć stosując go i w sposób jak najmniejszy ingerować w prywatność pracownika.
+        15) Pracownik zatrudniany na okres próbny jest zobowiązany w tym okresie odbyć szkolenia oraz testy stanowiskowe. 
+        16) Pracownicy zatrudnieni na czas określony zobowiązani są do okresowego (przynajmniej jeden raz na kwartał) zdawania testów stanowiskowych jakie są aktualnie skojarzone z ich stanowiskiem pracy w systemie jakości/dokumentacji procesów. 
+        17) Pracownik kwituje odbiór wyposażenia i uprawnień na karcie obiegowej, po zakończeniu stosunku pracy powinien oddać pobrane wyposażenie w terminie 3-ch dni. Po tym terminie Pracodawca obciąży pracownika kosztami wynoszącymi tyle, ile wyniesie koszt odtworzenia brakującego wyposażenia (zakupu nowego sprzętu). W przypadku kiedy pracownik zagubi (lub nie odda) kluczy do zamków, jakie otrzymał w tym samym terminie – pracownik będzie musiał pokryć koszty wymiany zamków oraz wytworzenia kluczy , jakie funkcjonowały wcześniej w tych zamkach. 
+        
+        Data:
+        _________________						_________________
+        /Pracodawca/						       /Pracownik/	
+        
+        Gdańsk dnia YYYY-MM-DD
+        
+        
+        
+        
+        OŚWIADCZENIE
+        
+        Oświadczam, że podejmuję się pieczy nad mieniem t.j. środki pieniężne, dowody KP i KW powierzonymi mi przez Pracodawcę (BIALL-NET sp.  z o.o. Otomin ul. Słoneczna 43 80-174 Gdańsk)   . Ponadto zobowiązuję się do pieczy nad mieniem, które zostanie przez pracodawcę dostarczone w czasie trwania odpowiedzialności materialnej. 
+        Przyjmuję odpowiedzialność materialną za szkodę spowodowaną powstaniem niedoboru, uszkodzeniem lub zniszczeniem powierzonego mi mienia. 
+        Zobowiązuję się do przestrzegania przepisów w zakresie prowadzenia operacji kasowych. 
+        
+        Oświadczenie zostało sporządzone w 2-ch jednobrzmiących egzemplarzach, po jednym dla każdej ze stron .
+        
+        
+        IMIE-KLIKNIJ-2-RAZY 
+        NAZWISKO
+        
+        _________________						_________________
+        
+        /Pracodawca/							       /Pracownik/	
+        
+        
+        
+    </xsl:template>-->
+    
+    
+    
+    
+    
+    
+    
+</xsl:stylesheet>

+ 612 - 0
SE/schema/default_db_xml_cache.public/ADMIN_USERS__wyposazenie.xsl

@@ -0,0 +1,612 @@
+<?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"
+    xmlns:default_db="http://biuro.biall-net.pl/xmlschema_procesy5/default_db"
+    xmlns:default_db__ADMIN_USERS="default_db:ADMIN_USERS"
+    xmlns:default_db__CRM_LISTA_ZASOBOW_OFFERS="default_db:CRM_LISTA_ZASOBOW_OFFERS"
+    xmlns:default_db__CRM_LISTA_ZASOBOW="default_db:CRM_LISTA_ZASOBOW"
+    xmlns:default_db__DEVICES="default_db:DEVICES"
+    xmlns:default_db__TELBOXES="default_db:TELBOXES"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!--funkcje do generowania umow o prace itp -->
+    
+    
+    <xsl:import href="import_resource_table_xml_from_api.xsl"/>
+    <xsl:import href="form_occurs_max_sequence.xsl"/>
+    <xsl:import href="get_all_xsd.xsl"/>
+    <xsl:import href="CRM_LISTA_ZASOBOW_tree.xsl"/>
+    <xsl:import href="IN7_MK_BAZA_DYSTRYBUCJI_tree.xsl"/>
+    <xsl:import href="resources_tree_required_occurs_raport.xsl"/>
+    <xsl:import href="CRM_LISTA_ZASOBOW_OFFERS__options.xsl"/>
+   
+    
+    <xsl:variable name="ADMIN_USERS">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'ADMIN_USERS'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+    <xsl:variable name="DEVICES">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'DEVICES'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+    <xsl:variable name="system_cache__appinfo:_build_resources_tree_with_instances_refs">
+        <xsl:call-template name="system_cache__appinfo:_build_resources_tree_with_instances_refs"/>
+    </xsl:variable>
+    
+    <xsl:variable name="CRM_LISTA_ZASOBOW">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'CRM_LISTA_ZASOBOW'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+    <xsl:template name="main">
+        <!--<xsl:variable name="test">
+            <ADMIN_USERS>
+                <ID>9</ID>
+                <ADM_ACCOUNT>a.binder</ADM_ACCOUNT>
+                <ADM_NAME/>
+                <ADM_PHONE/>
+                <ADM_ADDRESS_CITY/>
+                <ADM_ADDRESS_STREET/>
+                <ADM_ADDRESS_HOUSE/>
+            </ADMIN_USERS>
+        </xsl:variable>-->
+        
+        <xsl:apply-templates mode="default_db:ADMIN_USERS" select="$ADMIN_USERS//item[ID='11' or ID='9' or ADM_ACCOUNT='remiszewskim' or ADM_ACCOUNT='crash' or ID='4889' or ID='5141' or ADM_ACCOUNT='mateusz.klimek' or ID='5318' or ADM_ACCOUNT='dojlidom' ]"/>
+        <!--<xsl:result-document href="../default_db.instance.xml/transformed/ADMIN_USERS__wyposazenie_all.html"> 
+            <xsl:call-template name="wyposazenie_all"/>
+        </xsl:result-document>-->
+        <xsl:result-document href="../default_db.instance.xml/transformed/ADMIN_USERS__wyposazenie__allowed_functions.xml">
+            <default_db__ADMIN_USERS:allowed_functions>
+                <xsl:apply-templates mode="default_db__ADMIN_USERS:allowed_functions" select="$ADMIN_USERS//item[ID='11' or ID='9' or ADM_ACCOUNT='remiszewskim' or ADM_ACCOUNT='crash' or ID='4889']"/>
+            </default_db__ADMIN_USERS:allowed_functions>
+        </xsl:result-document>
+        
+        
+    </xsl:template>
+    
+    <!-- funkcja do wyzwolenia podczas chodzenia przez GUI po tabeli rekordow w ADMIN_USERS wykrywajaca dla ktorych rekordow mozna wyzwolic jakas funkcje -->
+    <xsl:template match="node()" mode="default_db__ADMIN_USERS:allowed_functions">
+        <xsl:choose>
+            <xsl:when test="ID and A_STATUS!='DELETED'">
+                <system_cache__appinfo:apply-templates>
+                    <xsl:attribute name="mode" select="'default_db:ADMIN_USERS'"/>
+                    <xsl:attribute name="output" select="'html'"/>
+                    <xsl:attribute name="description" select="'wyposazenie pracownika widok html'"/>
+                    <source_record>
+                        <xsl:copy-of select="ID"/>
+                    </source_record>
+                </system_cache__appinfo:apply-templates>
+            </xsl:when>
+        </xsl:choose>
+        <!-- TODO jakos by to ograniczyc/podlaczyc do widoku biezacej listy elementow - czyli musze wiedziec, ze mam wiecej elementow na ekranie -czyli jakis count(node())&gt;1 ? -->
+        <system_cache__appinfo:call-template>
+            <xsl:attribute name="name" select="'wyposazenie_all'"/>
+            <xsl:attribute name="output" select="'html'"/>
+            <xsl:attribute name="description" select="'wyposazenie wszystkich pracownikow widok html'"/>
+            <source_record>
+                <xsl:comment>TODO tutaj jakas lista rekordow lub filtr dla ktorego to jest dostepne jako caly ekran lub kawalek</xsl:comment>
+            </source_record>
+        </system_cache__appinfo:call-template>
+    </xsl:template>
+    
+    
+    <xsl:template match="node()" mode="default_db:ADMIN_USERS">
+        <xsl:variable name="ADMIN_USERS_node" select="current()"/>
+            <xsl:variable name="ADMIN_USERS__wyposazenie">
+                <xsl:call-template name="wyposazenie_i_braki_for_user">
+                    <xsl:with-param name="ADMIN_USERS_node" select="$ADMIN_USERS_node"/>
+                </xsl:call-template>
+            </xsl:variable>
+        <xsl:result-document href="{concat('../default_db.instance.xml/transformed/ADMIN_USERS__wyposazenie_',$ADMIN_USERS_node/ID,'.xml')}">
+            <xsl:copy-of select="$ADMIN_USERS__wyposazenie"></xsl:copy-of>
+        </xsl:result-document>
+        <xsl:apply-templates mode="wyposazenie_html" select="$ADMIN_USERS__wyposazenie">
+            <xsl:with-param name="ADMIN_USERS_node" select="$ADMIN_USERS_node"/>
+        </xsl:apply-templates>        
+    </xsl:template>
+    
+    <xsl:template name="wyposazenie_i_braki_for_user">
+        <xsl:param name="ADMIN_USERS_node" required="yes"/>
+        <ADMIN_USERS__wyposazenie>
+            <xsl:attribute name="ADMIN_USERS_ID" select="$ADMIN_USERS_node/ID"></xsl:attribute>
+            <wyposazenie>
+                <xsl:for-each select="$system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[ name()!='ERROR_NOT_ENOUGH' and @RESOURCE  and @TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID ]  ">
+                    <xsl:copy-of select="."/>
+                </xsl:for-each>
+            </wyposazenie>
+            <braki>
+                <xsl:for-each-group select="$system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[ name()='ERROR_NOT_ENOUGH' and @TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID ]" group-by="@ID" >
+                    <ERROR_NOT_ENOUGH>
+                        <xsl:for-each select="@*">
+                            <xsl:attribute name="{name()}" select="."/>
+                        </xsl:for-each>
+                        <xsl:copy-of select="DESC"/>
+                             <xsl:call-template name="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource">
+                                 <xsl:with-param name="default_db__CRM_LISTA_ZASOBOW:ID" select="@ID"/>
+                             </xsl:call-template>
+                    </ERROR_NOT_ENOUGH>
+                </xsl:for-each-group>
+            </braki>            
+            <errors_all_structures>
+                <!-- wykrycie bledow w postaci nie odnalezionych numerow INSTANCES[@ID], podczas gdy ich RESOURCE_ID bylo w drzewie-->
+                <DEVICES>
+                    <xsl:for-each select="$DEVICES//item">
+                        <xsl:variable name="ID" select="ID"/>
+                        <xsl:variable name="CRM_LISTA_ZASOBOW_ID" select="CRM_LISTA_ZASOBOW_ID"/>
+                        <xsl:choose>
+                            <xsl:when test="CRM_LISTA_ZASOBOW_ID=''">
+                                <ERROR_NOT_SET_RESOURCE_ID>
+                                    <xsl:attribute name="ID" select="$ID"/>                                
+                                </ERROR_NOT_SET_RESOURCE_ID>
+                            </xsl:when>
+                            <xsl:when test="$system_cache__appinfo:_build_resources_tree_with_instances_refs//DEVICES[@RESOURCE=$CRM_LISTA_ZASOBOW_ID]">
+                                <xsl:choose>
+                                    <xsl:when test="$system_cache__appinfo:_build_resources_tree_with_instances_refs//DEVICES[@RESOURCE=$CRM_LISTA_ZASOBOW_ID and @ID=$ID]">
+                                        <!--  <OK_INSTANCE_FOUND>
+                                        <xsl:attribute name="ID" select="$ID"></xsl:attribute>
+                                    </OK_INSTANCE_FOUND>-->
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <ERROR_INSTANCE_NOT_FOUND_IN_TREE>
+                                            <xsl:attribute name="ID" select="$ID"/> 
+                                            <xsl:attribute name="CRM_LISTA_ZASOBOW_ID" select="$CRM_LISTA_ZASOBOW_ID"/>
+                                            <xsl:attribute name="TYPE" select="$CRM_LISTA_ZASOBOW//item[ID=$CRM_LISTA_ZASOBOW_ID]/TYPE"/>
+                                            <xsl:attribute name="A_STATUS" select="$CRM_LISTA_ZASOBOW//item[ID=$CRM_LISTA_ZASOBOW_ID]/A_STATUS"/>
+                                            <xsl:choose>
+                                                <xsl:when test="$system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@ID=$CRM_LISTA_ZASOBOW_ID and name()='ERROR_NOT_ENOUGH']/@TREE_ADMIN_USERS_ID">
+                                                    <xsl:variable name="TREE_ADMIN_USERS_ID" select="string-join($system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@ID=$CRM_LISTA_ZASOBOW_ID and name()='ERROR_NOT_ENOUGH']/@TREE_ADMIN_USERS_ID,' ')"/>
+                                                    <xsl:attribute name="TREE_ADMIN_USERS_ID" select="distinct-values(tokenize($TREE_ADMIN_USERS_ID,' '))"/>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    <xsl:variable name="TREE_ADMIN_USERS_ID" select="string-join($system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@RESOURCE=$CRM_LISTA_ZASOBOW_ID and name()='DEVICES']/@TREE_ADMIN_USERS_ID,' ')"/>
+                                                    <xsl:attribute name="TREE_ADMIN_USERS_ID" select="distinct-values(tokenize($TREE_ADMIN_USERS_ID,' '))"/>
+                                                </xsl:otherwise>
+                                            </xsl:choose>
+                                            <DESC><xsl:value-of select="$CRM_LISTA_ZASOBOW//item[ID=$CRM_LISTA_ZASOBOW_ID]/DESC"/></DESC> 
+                                            <xsl:copy-of select="T_DEVICE_TYPE"/>
+                                            <xsl:copy-of select="T_DEVICE_INFO"/>
+                                            <xsl:copy-of select="T_DEVICE_SERIAL"/>
+                                        </ERROR_INSTANCE_NOT_FOUND_IN_TREE>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                            </xsl:when>
+                        </xsl:choose>
+                    </xsl:for-each>
+                </DEVICES>
+                <TELBOXES>
+                    <xsl:for-each select="$TELBOXES//item">
+                        <xsl:variable name="ID" select="ID"/>
+                        <xsl:variable name="CRM_LISTA_ZASOBOW_ID" select="CRM_LISTA_ZASOBOW_ID"/>
+                        <xsl:choose>
+                            <xsl:when test="CRM_LISTA_ZASOBOW_ID=''">
+                                <ERROR_NOT_SET_RESOURCE_ID>
+                                    <xsl:attribute name="ID" select="$ID"/>                                
+                                </ERROR_NOT_SET_RESOURCE_ID>
+                            </xsl:when>
+                            <xsl:when test="$system_cache__appinfo:_build_resources_tree_with_instances_refs//TELBOXES[@RESOURCE=$CRM_LISTA_ZASOBOW_ID]">
+                                <xsl:choose>
+                                    <xsl:when test="$system_cache__appinfo:_build_resources_tree_with_instances_refs//TELBOXES[@RESOURCE=$CRM_LISTA_ZASOBOW_ID and @ID=$ID]">
+                                        <!--  <OK_INSTANCE_FOUND>
+                                        <xsl:attribute name="ID" select="$ID"></xsl:attribute>
+                                    </OK_INSTANCE_FOUND>-->
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <ERROR_INSTANCE_NOT_FOUND_IN_TREE>
+                                            <xsl:attribute name="ID" select="$ID"/> 
+                                            <xsl:attribute name="CRM_LISTA_ZASOBOW_ID" select="$CRM_LISTA_ZASOBOW_ID"/>
+                                            <xsl:attribute name="TYPE" select="$CRM_LISTA_ZASOBOW//item[ID=$CRM_LISTA_ZASOBOW_ID]/TYPE"/>
+                                            <xsl:attribute name="A_STATUS" select="$CRM_LISTA_ZASOBOW//item[ID=$CRM_LISTA_ZASOBOW_ID]/A_STATUS"/>
+                                            <xsl:choose>
+                                                <xsl:when test="$system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@ID=$CRM_LISTA_ZASOBOW_ID and name()='ERROR_NOT_ENOUGH']/@TREE_ADMIN_USERS_ID">
+                                                    <xsl:variable name="TREE_ADMIN_USERS_ID" select="string-join($system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@ID=$CRM_LISTA_ZASOBOW_ID and name()='ERROR_NOT_ENOUGH']/@TREE_ADMIN_USERS_ID,' ')"/>
+                                                    <xsl:attribute name="TREE_ADMIN_USERS_ID" select="distinct-values(tokenize($TREE_ADMIN_USERS_ID,' '))"/>
+                                                </xsl:when>
+                                                <xsl:otherwise>
+                                                    <xsl:variable name="TREE_ADMIN_USERS_ID" select="string-join($system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@RESOURCE=$CRM_LISTA_ZASOBOW_ID and name()='DEVICES']/@TREE_ADMIN_USERS_ID,' ')"/>
+                                                    <xsl:attribute name="TREE_ADMIN_USERS_ID" select="distinct-values(tokenize($TREE_ADMIN_USERS_ID,' '))"/>
+                                                </xsl:otherwise>
+                                            </xsl:choose>
+                                            <DESC><xsl:value-of select="$CRM_LISTA_ZASOBOW//item[ID=$CRM_LISTA_ZASOBOW_ID]/DESC"/></DESC> 
+                                            <xsl:copy-of select="T_TELBOX_NAME"/>
+                                        </ERROR_INSTANCE_NOT_FOUND_IN_TREE>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                            </xsl:when>
+                        </xsl:choose>
+                    </xsl:for-each>
+                </TELBOXES>
+            </errors_all_structures>
+            <braki_all_structures>
+                <xsl:for-each-group select="$system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[ name()='ERROR_NOT_ENOUGH']" group-by="@ID" >
+                    <ERROR_NOT_ENOUGH>
+                        <xsl:for-each select="@*">
+                            <xsl:attribute name="{name()}" select="."/>
+                        </xsl:for-each>
+                        <xsl:copy-of select="DESC"/>
+                        <xsl:call-template name="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource">
+                             <xsl:with-param name="default_db__CRM_LISTA_ZASOBOW:ID" select="@ID"/>
+                        </xsl:call-template>
+                    </ERROR_NOT_ENOUGH>
+                </xsl:for-each-group>
+            </braki_all_structures>
+        </ADMIN_USERS__wyposazenie>
+    </xsl:template>
+    
+    
+    
+    <xsl:template name="wyposazenie_all">
+        <html>
+            <head>Wyposazenia</head>
+            <body>
+                <xsl:for-each select="$ADMIN_USERS//item[A_STATUS='NORMAL' and EMPLOYEE_TYPE='Pracownik']">
+                    <xsl:variable name="ADMIN_USERS_node" select="current()"/>
+                    <xsl:variable name="ADMIN_USERS__wyposazenie">
+                        <xsl:call-template name="wyposazenie_i_braki_for_user">
+                            <xsl:with-param name="ADMIN_USERS_node" select="$ADMIN_USERS_node"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                   <!-- <xsl:result-document href="{concat('../default_db.instance.xml/transformed/ADMIN_USERS__wyposazenie_all_',$ADMIN_USERS_node/ID,'.xml')}">
+                       <xsl:copy-of select="$ADMIN_USERS__wyposazenie"></xsl:copy-of>
+                     </xsl:result-document>-->
+                    <xsl:apply-templates mode="wyposazenie_inside" select="$ADMIN_USERS__wyposazenie">
+                        <xsl:with-param name="ADMIN_USERS_node" select="$ADMIN_USERS_node"/>
+                    </xsl:apply-templates>
+                </xsl:for-each>
+            </body>
+        </html>
+    </xsl:template>
+    
+    
+    <xsl:template match="node()" mode="wyposazenie_inside">
+        <xsl:param name="ADMIN_USERS_node"/>
+        Wyposażenie aktualnie przydzielone: dla <xsl:value-of select="$ADMIN_USERS_node/ADM_NAME"/> (ID:<xsl:value-of select="$ADMIN_USERS_node/ID"/>/Login:<xsl:value-of select="$ADMIN_USERS_node/ADM_ACCOUNT"/>)
+        <table border="1" cellpadding="2" cellspacing="2" width="100%">
+            <tr>
+                <th>Typ</th>
+                <th>Nr zasobu</th>
+                <th>Nazwa</th>
+                <th>Opis</th>
+                <th>Producent</th>
+                <th>Wartość</th>
+                <th>Właściciel</th>
+                <th>Oznaczenie</th>
+            </tr>
+            <xsl:for-each-group select="/ADMIN_USERS__wyposazenie/wyposazenie//node()[@RESOURCE and @TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID and (name()!='ADMIN_USERS' or @source!='ALIAS') ]" group-by="concat(@ID,'-',@RESOURCE)">
+                <tr>
+                    <td><xsl:value-of select="name()"/></td>
+                    <td><xsl:value-of select="@RESOURCE"/></td>
+                    <td><xsl:value-of select="@ID"/></td>
+                    <td><xsl:value-of select="DESC"/></td>
+                    <td>
+                        <xsl:if test="T_DEVICE_TYPE">&#160;<xsl:value-of select="T_DEVICE_TYPE"/></xsl:if>
+                        <xsl:if test="T_DEVICE_INFO">&#160;<xsl:value-of select="T_DEVICE_INFO"/></xsl:if>
+                        &#160;<xsl:value-of select="@A_STATUS"/>
+                        <xsl:if test="ADM_PHONE"><pre> tel: <xsl:value-of select="ADM_PHONE"/></pre></xsl:if>
+                    </td>
+                    <td><xsl:value-of select="T_PRODUCER"/></td>
+                    <td><xsl:value-of select="F_BILL_COST"/></td>
+                    <td><xsl:value-of select="T_OWNER"/></td>
+                    <td><xsl:value-of select="T_DEVICE_SERIAL"/>
+                        &#160;<xsl:value-of select="T_TELBOX_NAME"/>
+                    </td>
+                </tr>
+            </xsl:for-each-group>
+        </table>
+        <br/>
+        Wyposażenie aktualnie brakujące:
+        <table border="1" cellpadding="2" cellspacing="2"  width="100%">
+            <tr>
+                <th>Typ</th>
+                <th>Nr zasobu</th>
+                <th>Ile brakuje</th>
+                <th>Nazwa</th>                        
+            </tr>
+            <xsl:for-each select="/ADMIN_USERS__wyposazenie/braki//ERROR_NOT_ENOUGH[@TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID]">
+                <tr>
+                    <td><xsl:value-of select="@TYPE"/></td>
+                    <td><xsl:value-of select="@ID"/></td>
+                    <td><xsl:value-of select="@minOccurs - @system_cache__resources_tree_required_occurs_raport:Occurs"/></td>
+                    <td><xsl:value-of select="DESC"/></td>
+                    <td></td>
+                </tr>
+            </xsl:for-each>
+        </table>
+        <hr>
+        <br>
+        </br>
+        </hr>
+    </xsl:template>
+    
+    
+    <xsl:template match="node()" mode="wyposazenie_html">
+        <xsl:param name="ADMIN_USERS_node"/>
+        <xsl:result-document href="{concat('../default_db.instance.xml/transformed/ADMIN_USERS__wyposazenie_',$ADMIN_USERS_node/ID,'.html')}">
+        <html>
+            <head>Wykaz wyposazenie dla pracownika <xsl:value-of select="$ADMIN_USERS_node/ADM_NAME"/> (ID:<xsl:value-of select="$ADMIN_USERS_node/ID"/>/Login:<xsl:value-of select="$ADMIN_USERS_node/ADM_ACCOUNT"/>)</head>
+            <body>
+                Wyposażenie aktualnie przydzielone:
+                <table border="1" cellpadding="2" cellspacing="2" width="100%">
+                   <tr>
+                       <th>Typ</th>
+                       <th>Nr zasobu</th>
+                       <th>ID</th>
+                       <th>Nazwa</th>
+                       <th>Opis</th>
+                       <th>Producent</th>
+                       <th>Wartość</th>
+                       <th>Właściciel</th>
+                       <th>Oznaczenie</th>
+                   </tr>
+                    <xsl:for-each-group select="/ADMIN_USERS__wyposazenie/wyposazenie//node()[@RESOURCE and @TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID and (name()!='ADMIN_USERS') ]" group-by="concat(@ID,'-',@RESOURCE)">
+                       <tr>
+                           <td><xsl:value-of select="name()"/></td>
+                           <td><xsl:value-of select="@RESOURCE"/></td>
+                           <td><xsl:value-of select="@ID"/></td>
+                           <td><xsl:value-of select="DESC"/></td>
+                           <td>
+                               <xsl:if test="T_DEVICE_TYPE">&#160;<xsl:value-of select="T_DEVICE_TYPE"/></xsl:if>
+                               <xsl:if test="T_DEVICE_INFO">&#160;<xsl:value-of select="T_DEVICE_INFO"/></xsl:if>
+                               &#160;<xsl:value-of select="@A_STATUS"/><pre> </pre>
+                               <xsl:if test="ADM_PHONE"><pre> tel: <xsl:value-of select="ADM_PHONE"/></pre></xsl:if>
+                           </td>
+                           <td><xsl:value-of select="T_PRODUCER"/></td>
+                           <td><xsl:value-of select="F_BILL_COST"/></td>
+                           <td><xsl:value-of select="T_OWNER"/></td>
+                           <td><xsl:value-of select="T_DEVICE_SERIAL"/>
+                               &#160;<xsl:value-of select="T_TELBOX_NAME"/>
+                           </td>
+                       </tr>
+                   </xsl:for-each-group>
+                    
+                        <tr>
+                            <td/>
+                            <td/>
+                            <td/>
+                            <td>Suma kosztów wyposazenia</td>
+                            <td/>
+                            <td/>
+                            <td><!--<xsl:value-of select="sum(/ADMIN_USERS__wyposazenie/wyposazenie//node()[@RESOURCE and @TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID and (name()!='ADMIN_USERS' or @source!='ALIAS') and F_BILL_COST&gt;0]/F_BILL_COST)"/>-->
+                                <xsl:variable name="suma">
+                                    <xsl:for-each-group select="/ADMIN_USERS__wyposazenie/wyposazenie//node()[@RESOURCE and @TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID and (name()!='ADMIN_USERS' or @source!='ALIAS') and F_BILL_COST&gt;0]/F_BILL_COST" group-by="concat(../@ID,../@RESOURCE)">
+                                        <xsl:copy-of select="."/>
+                                    </xsl:for-each-group>
+                                </xsl:variable>
+                                <xsl:value-of select="sum($suma/F_BILL_COST)"/>
+                            </td>
+                            <td/>
+                            <td/>
+                        </tr>
+                    
+                </table>
+                
+                Podległy personel:
+                <table border="1" cellpadding="2" cellspacing="2" width="100%">
+                    <tr>
+                        <th>Typ</th>
+                        <th>Nr zasobu</th>
+                        <th>ID</th>
+                        <th>Nazwa</th>
+                        <th>Opis</th>
+                        <th>Producent</th>
+                        <th>Wartość</th>
+                        <th>Właściciel</th>
+                        <th>Oznaczenie</th>
+                    </tr>
+                    <xsl:for-each-group select="/ADMIN_USERS__wyposazenie/wyposazenie//node()[@RESOURCE and @TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID and (name()='ADMIN_USERS' and @source!='ALIAS') ]" group-by="concat(@ID,'-',@RESOURCE)">
+                        <tr>
+                            <td><xsl:value-of select="name()"/></td>
+                            <td><xsl:value-of select="@RESOURCE"/></td>
+                            <td><xsl:value-of select="@ID"/></td>
+                            <td><xsl:value-of select="DESC"/></td>
+                            <td>
+                                <xsl:if test="T_DEVICE_TYPE">&#160;<xsl:value-of select="T_DEVICE_TYPE"/></xsl:if>
+                                <xsl:if test="T_DEVICE_INFO">&#160;<xsl:value-of select="T_DEVICE_INFO"/></xsl:if>
+                                &#160;<xsl:value-of select="@A_STATUS"/><pre> </pre>
+                                <xsl:if test="ADM_PHONE"><pre> tel: <xsl:value-of select="ADM_PHONE"/></pre></xsl:if>
+                            </td>
+                            <td><xsl:value-of select="T_PRODUCER"/></td>
+                            <td><xsl:value-of select="F_BILL_COST"/></td>
+                            <td><xsl:value-of select="T_OWNER"/></td>
+                            <td><xsl:value-of select="T_DEVICE_SERIAL"/>
+                                &#160;<xsl:value-of select="T_TELBOX_NAME"/>
+                            </td>
+                        </tr>
+                    </xsl:for-each-group>
+                </table>
+               
+                
+                
+                <br/>
+                Wyposażenie aktualnie brakujące:
+                <table border="1" cellpadding="2" cellspacing="2"  width="100%">
+                    <tr>
+                        <th>Typ</th>
+                        <th>Nr zasobu</th>
+                        <th>Ile brakuje</th>
+                        <th>Nazwa</th> 
+                        <th>Możliwość pobrania z</th> 
+                        <th>Możliwość zamówienia z</th>
+                    </tr>
+                    <xsl:for-each select="/ADMIN_USERS__wyposazenie/braki//ERROR_NOT_ENOUGH[@TREE_ADMIN_USERS_ID=$ADMIN_USERS_node/ID]">
+                        <tr>
+                            <td><xsl:value-of select="@TYPE"/></td>
+                            <td><xsl:value-of select="@ID"/></td>
+                            <td><xsl:value-of select="@minOccurs - @system_cache__resources_tree_required_occurs_raport:Occurs"/></td>
+                            <td><xsl:value-of select="DESC"/></td>
+                            <td>    
+                               
+                                <xsl:for-each select="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource/INSTANCES/PARENTS/RESOURCE/node()[@ID and @A_STATUS!='OFF_HARD' and @A_STATUS!='DELETED' and @A_STATUS!='WAITING']">
+                                    Źródła nadrzędne<br/><font size="-3">
+                                    typ:<xsl:value-of select="name()"/>;<br/>
+                                    RESOURCE:<xsl:value-of select="@RESOURCE"/>;<br/>
+                                    ID:<xsl:value-of select="@ID"/>;<br/>
+                                    STATUS:<xsl:value-of select="@A_STATUS"/>;<br/>
+                                        <xsl:for-each select="child::*">
+                                            <xsl:value-of select="name()"/>:<xsl:value-of select="text()"/><br/>
+                                        </xsl:for-each>
+                                    </font>
+                                    <hr/>
+                                </xsl:for-each>
+                               
+                                <xsl:for-each select="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource/INSTANCES/SIBLING/RESOURCE/node()[@ID and @A_STATUS!='OFF_HARD' and @A_STATUS!='DELETED' and @A_STATUS!='WAITING']">
+                                        Źródła równorzędne<br/><font size="-3">
+                                        typ:<xsl:value-of select="name()"/>;<br/>
+                                        RESOURCE:<xsl:value-of select="@RESOURCE"/>;<br/>
+                                        ID:<xsl:value-of select="@ID"/>;<br/>
+                                        STATUS:<xsl:value-of select="@A_STATUS"/>;<br/>
+                                            <xsl:for-each select="child::*">
+                                                <xsl:value-of select="name()"/>:<xsl:value-of select="text()"/><br/>
+                                            </xsl:for-each>
+                                    </font>
+                                    <hr/>
+                                </xsl:for-each>
+                                
+                                <xsl:for-each select="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource/INSTANCES/CHILDS/RESOURCE/node()[@ID and @A_STATUS!='OFF_HARD' and @A_STATUS!='DELETED' and @A_STATUS!='WAITING']">
+                                        Źródła dziedziczące<br/><font size="-3">
+                                        typ:<xsl:value-of select="name()"/>;<br/>
+                                        RESOURCE:<xsl:value-of select="@RESOURCE"/>;<br/>
+                                        ID:<xsl:value-of select="@ID"/>;<br/>
+                                        STATUS:<xsl:value-of select="@A_STATUS"/>;<br/>
+                                            <xsl:for-each select="child::*">
+                                                <xsl:value-of select="name()"/>:<xsl:value-of select="text()"/><br/>
+                                            </xsl:for-each>
+                                    </font>
+                                    <hr/>
+                                </xsl:for-each>
+                            </td>
+                            <td>
+                                <xsl:for-each select="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource/OFFERS/PARENTS/node()[@ID and @A_STATUS!='OFF_HARD' and @A_STATUS!='DELETED' and @A_STATUS!='WAITING']">
+                                    <font size="-3">
+                                        Oferta/ID:<xsl:value-of select="@ID"/>;<br/>
+                                        Dostawca:<xsl:copy-of select="COMPANIES_ID"/>;<br/>
+                                        STATUS:<xsl:value-of select="@A_STATUS"/>;<br/>
+                                        Oferta/Przelicznik/min.il.:<xsl:copy-of select="OFFER_UNIT_TYPE"/>/<xsl:copy-of select="OFFER_UNIT_TO_RESOURCE_UNIT_RATIO"/>/<xsl:copy-of select="OFFER_MIN_QTY"/>;<br/>
+                                        Cena[dost]/[zasob]:<xsl:copy-of select="OFFER_PRICE_PER_UNIT"/>/<xsl:copy-of select="OFFER_PRICE_PER_RESOURCE_UNIT"/>;<br/>
+                                        jakość:<xsl:copy-of select="OFFERED_QUALITY"/>
+                                    </font>
+                                    <hr/>
+                                </xsl:for-each>
+                                
+                            </td>
+                        </tr>
+                    </xsl:for-each>
+                </table>
+                <br>
+                    Niewłaściwie przydzielone do struktury urządzenia podlegające strukturalnie pod pracownika:
+                </br>
+                <table border="1" cellpadding="2" cellspacing="2"  width="100%">
+                    <tr>
+                        <th>Typ</th>
+                        <th>Nr zasobu</th>
+                        <th>Nr rekordu w urządzeniach</th>
+                        <th>Nazwa</th>                        
+                    </tr>
+                    <xsl:for-each select="/ADMIN_USERS__wyposazenie/errors_all_structures/DEVICES/ERROR_INSTANCE_NOT_FOUND_IN_TREE[contains(concat(' ',@TREE_ADMIN_USERS_ID,' ') , concat(' ',$ADMIN_USERS_node/ID,' '))]">
+                        <xsl:variable name="CRM_LISTA_ZASOBOW_ID" select="@CRM_LISTA_ZASOBOW_ID"/>
+                        <tr>
+                            <td><xsl:value-of select="@TYPE"/></td>
+                            <td><xsl:value-of select="@CRM_LISTA_ZASOBOW_ID"/></td>
+                            <td><xsl:value-of select="@ID"/></td>
+                            <td> <xsl:copy-of select="T_DEVICE_TYPE"/>
+                                <xsl:copy-of select="T_DEVICE_INFO"/>
+                                <xsl:copy-of select="T_DEVICE_SERIAL"/></td>
+                            <td></td>
+                        </tr>
+                    </xsl:for-each>
+                </table>
+                <br>
+                Brakujące elementy w całej strukturze firmy
+                </br>
+                <table border="1" cellpadding="2" cellspacing="2"  width="100%">
+                    <tr>
+                    <th>Typ</th>
+                    <th>Nr zasobu</th>
+                    <th>Ile jest</th>
+                    <th>Ile ma byc</th>
+                    <th>Ile brakuje</th>
+                    <th>Nazwa</th> 
+                    <th>Możliwość pobrania</th>
+                    </tr>
+                    <xsl:for-each-group select="/ADMIN_USERS__wyposazenie/braki_all_structures//ERROR_NOT_ENOUGH[@TYPE='URZADZENIE' or @TYPE='DOSTEP-ZAMEK-ELEKTRONICZNY' or @TYPE='OZNACZENIE_LOKALIZACJI' or @TYPE='APLIKACJA' or @TYPE='SOFTWARE' or @TYPE='ALARM-SATEL' or @TYPE='SZAFA' or @TYPE='SEJF' or @TYPE='SEGREGATOR' or @TYPE='KUWETA' or @TYPE='NARZEDZIE' or @TYPE='DOSTEP-KLUCZ'  or @TYPE='DOSTEP-KARTA' or @TYPE='DOSTEP-ZAMEK' or @TYPE='MATERIAL_REKLAMOWY' or @TYPE='SERWER' or @TYPE='MATERIAL_EKSPLOATACYJNY' or @TYPE='PIECZATKA'  or @TYPE='PLYTA_CD' or @TYPE='KOMPUTER' or @TYPE='URZADZENIA_I_OZNACZENIA_BHP']" group-by="@ID">
+                        <tr>
+                            <td><xsl:value-of select="@TYPE"/></td>
+                            <td><xsl:value-of select="@ID"/></td>
+                            <td><xsl:value-of select="@system_cache__resources_tree_required_occurs_raport:Occurs"/></td>
+                            <td><xsl:value-of select="@minOccurs"/></td>
+                            <td><xsl:value-of select="@minOccurs - @system_cache__resources_tree_required_occurs_raport:Occurs"/></td>
+                            <td><xsl:value-of select="DESC"/></td>
+                            <td>
+                                
+                                
+                                <xsl:for-each select="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource/INSTANCES/PARENTS/RESOURCE/node()[@ID and @A_STATUS!='OFF_HARD' and @A_STATUS!='DELETED' and @A_STATUS!='WAITING']">
+                                    Źródło: nadrzędne<br/>
+                                    <font size="-3">
+                                        typ:<xsl:value-of select="name()"/>;<br/>
+                                        RESOURCE:<xsl:value-of select="@RESOURCE"/>;<br/>
+                                        ID:<xsl:value-of select="@ID"/>;<br/>
+                                        STATUS:<xsl:value-of select="@A_STATUS"/>;<br/>
+                                        T_DEVICE_TYPE:<xsl:copy-of select="T_DEVICE_TYPE"/>;<br/>
+                                        T_DEVICE_INFO:<xsl:copy-of select="T_DEVICE_INFO"/>;<br/>
+                                        T_DEVICE_SERIAL:<xsl:copy-of select="T_DEVICE_SERIAL"/>
+                                    </font>
+                                    <hr/>
+                                </xsl:for-each>
+                               
+                                <xsl:for-each select="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource/INSTANCES/SIBLING/RESOURCE/node()[@ID and @A_STATUS!='OFF_HARD' and @A_STATUS!='DELETED' and @A_STATUS!='WAITING']">
+                                    Źródła równorzędne<br/>
+                                    <font size="-3">
+                                        typ:<xsl:value-of select="name()"/>;<br/>
+                                        RESOURCE:<xsl:value-of select="@RESOURCE"/>;<br/>
+                                        ID:<xsl:value-of select="@ID"/>;<br/>
+                                        STATUS:<xsl:value-of select="@A_STATUS"/>;<br/>
+                                        T_DEVICE_TYPE:<xsl:copy-of select="T_DEVICE_TYPE"/>;<br/>
+                                        T_DEVICE_INFO:<xsl:copy-of select="T_DEVICE_INFO"/>;<br/>
+                                        T_DEVICE_SERIAL:<xsl:copy-of select="T_DEVICE_SERIAL"/>
+                                    </font>
+                                    <hr/>
+                                </xsl:for-each>
+                                
+                                <xsl:for-each select="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource/INSTANCES/CHILDS/RESOURCE/node()[@ID and @A_STATUS!='OFF_HARD' and @A_STATUS!='DELETED' and @A_STATUS!='WAITING']">
+                                    Źródła dziedziczące<br/><font size="-3">
+                                        typ:<xsl:value-of select="name()"/>;<br/>
+                                        RESOURCE:<xsl:value-of select="@RESOURCE"/>;<br/>
+                                        ID:<xsl:value-of select="@ID"/>;<br/>
+                                        STATUS:<xsl:value-of select="@A_STATUS"/>;<br/>
+                                        T_DEVICE_TYPE:<xsl:copy-of select="T_DEVICE_TYPE"/>;<br/>
+                                        T_DEVICE_INFO:<xsl:copy-of select="T_DEVICE_INFO"/>;<br/>
+                                        T_DEVICE_SERIAL:<xsl:copy-of select="T_DEVICE_SERIAL"/>
+                                    </font>
+                                    <hr/>
+                                </xsl:for-each>
+ 
+                            </td>
+                        </tr>
+                    </xsl:for-each-group>
+                </table>
+            </body>
+        </html>
+        </xsl:result-document>
+        
+    </xsl:template>
+    
+    
+  
+    
+    
+    
+    
+    
+    
+    
+</xsl:stylesheet>

+ 306 - 0
SE/schema/default_db_xml_cache.public/CRM_LISTA_ZASOBOW_OFFERS__options.xsl

@@ -0,0 +1,306 @@
+<?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:default_db="http://biuro.biall-net.pl/xmlschema_procesy5/default_db"
+    xmlns:default_db__CRM_LISTA_ZASOBOW_OFFERS="default_db:CRM_LISTA_ZASOBOW_OFFERS"
+    xmlns:default_db__CRM_LISTA_ZASOBOW="default_db:CRM_LISTA_ZASOBOW"
+    xmlns:default_db__CRM_LISTA_ZASOBOW_ALIASY_view="default_db:CRM_LISTA_ZASOBOW_ALIASY_view"
+    xmlns:system_cache__resources_tree_required_occurs_raport="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/resources_tree_required_occurs_raport"
+    xmlns:default_db__DEVICES="default_db:DEVICES"
+    xmlns:default_db__REMOTE_ACCESS_ACCOUNTS="default_db:REMOTE_ACCESS_ACCOUNTS"
+    xmlns:default_db__TELBOXES="default_db:TELBOXES"
+    xmlns:default_db__USERS2_OFFERS_GROUPS="default_db:USERS2_OFFERS_GROUPS"
+    xmlns:default_db__USERS2_OFFERS_COSTS_GROUPS="default_db:USERS2_OFFERS_COSTS_GROUPS"
+    xmlns:default_db__USERS2_OFFERS="default_db:USERS2_OFFERS"
+    xmlns:default_db__ADMIN_USERS="default_db:ADMIN_USERS"
+    xmlns:default_db__MK_Rewiry="default_db:MK_Rewiry"
+    xmlns:default_db__BUILDINGS="default_db:BUILDINGS"
+    xmlns:default_db__IN7_MK_BAZA_DYSTRYBUCJI="default_db:IN7_MK_BAZA_DYSTRYBUCJI"
+    
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!--funkcje do obslugi ofert i zamowien na wyposazenie @2015-08-27 TODO  -->
+    
+    
+    <xsl:import href="import_resource_table_xml_from_api.xsl"/>
+    <xsl:import href="form_occurs_max_sequence.xsl"/>
+    <xsl:import href="resources_tree_required_occurs_raport.xsl"/>
+    
+    <xsl:variable name="system_cache__appinfo:_build_resources_tree_with_instances_refs">
+        <xsl:call-template name="system_cache__appinfo:_build_resources_tree_with_instances_refs"/>
+    </xsl:variable>
+    
+    <xsl:variable name="CRM_LISTA_ZASOBOW">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'CRM_LISTA_ZASOBOW'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+    <xsl:variable name="CRM_LISTA_ZASOBOW_OFFERS">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'CRM_LISTA_ZASOBOW_OFFERS'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+    <xsl:variable name="CRM_LISTA_ZASOBOW_ALIASY_view">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'CRM_LISTA_ZASOBOW_ALIASY_view'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+    
+    
+    
+    <xsl:template name="main">
+        
+        
+        
+        <!--<xsl:result-document href="../default_db.instance.xml/transformed/default_db__CRM_LISTA_ZASOBOW_OFFERS__allowed_functions.xml">
+            <default_db__CRM_LISTA_ZASOBOW_OFFERS:allowed_functions>
+                <!-\-<xsl:apply-templates mode="default_db__ADMIN_USERS:allowed_functions" select="$ADMIN_USERS//item[ID='11' or ID='9' or ADM_ACCOUNT='remiszewskim' or ADM_ACCOUNT='crash' or ID='4889']"/>-\->
+            </default_db__CRM_LISTA_ZASOBOW_OFFERS:allowed_functions>
+        </xsl:result-document>-->
+        
+        
+        <xsl:call-template name="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource">
+            <xsl:with-param name="default_db__CRM_LISTA_ZASOBOW:ID" select="'21275'"/>
+        </xsl:call-template>
+        
+    </xsl:template>
+    
+    
+    <xsl:template name="default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource">
+        <!-- @2015-08-28 bindera: ta funkcja powinna pokazac dostepne opcje dla danego zasobu- 
+            czy da sie go zrewitalizowac z rodzica, czy sa dostepne dzieci, oraz pokazac dostepne opcje dla zasobu, 
+            rocdzicow oraz dzieci -->
+        <xsl:param name="default_db__CRM_LISTA_ZASOBOW:ID" required="yes"/>
+        <xsl:param name="system_cache__resources_tree_required_occurs_raport:Occurs"/>
+        <xsl:param name="default_db__CRM_LISTA_ZASOBOW:minOccurs" select="$CRM_LISTA_ZASOBOW//item[ID=$default_db__CRM_LISTA_ZASOBOW:ID]/minOccurs"/>
+        <xsl:param name="default_db__CRM_LISTA_ZASOBOW:maxOccurs" select="$CRM_LISTA_ZASOBOW//item[ID=$default_db__CRM_LISTA_ZASOBOW:ID]/maxOccurs"/>
+        
+        
+        <xsl:variable name="default_db__CRM_LISTA_ZASOBOW_ALIASY_view:CHILDS" select="$CRM_LISTA_ZASOBOW_ALIASY_view//item[CRM_LISTA_ZASOBOW_ID=$default_db__CRM_LISTA_ZASOBOW:ID]/CHILDS"/>
+        <xsl:variable name="default_db__CRM_LISTA_ZASOBOW_ALIASY_view:PATH" select="$CRM_LISTA_ZASOBOW_ALIASY_view//item[CRM_LISTA_ZASOBOW_ID=$default_db__CRM_LISTA_ZASOBOW:ID]/PATH"/>
+       
+       
+        <xsl:variable name="RESOURCE_PARENTS_CHILDS">
+            <!-- powiazania zasobow aby mozna bylo szukac ofert zakupu powiazanych oraz 
+                     wolnych stanow do pobrania z parentow , parentow parentow lub childsow? -->
+            <xsl:for-each select="tokenize($default_db__CRM_LISTA_ZASOBOW_ALIASY_view:CHILDS,',')">
+                <RESOURCE>
+                    <xsl:attribute name="source" select="'CHILDS'"/>
+                    <xsl:value-of select="."/>
+                </RESOURCE>
+            </xsl:for-each>
+            <xsl:for-each select="tokenize($default_db__CRM_LISTA_ZASOBOW_ALIASY_view:PATH,',')">
+                <RESOURCE>
+                    <xsl:attribute name="source" select="'PARENTS'"/>
+                    <xsl:value-of select="."/>
+                </RESOURCE>
+            </xsl:for-each>
+        </xsl:variable>
+       
+       
+        <xsl:comment>98: run for default_db__CRM_LISTA_ZASOBOW:ID:<xsl:value-of select="$default_db__CRM_LISTA_ZASOBOW:ID"/>;</xsl:comment>
+       
+        <!--<xsl:result-document href="../default_db.instance.xml/transformed/default_db__CRM_LISTA_ZASOBOW_OFFERS__show_offers_for_resource.xml">-->
+       <default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource>
+             
+        <!-- szukam ofert  -->
+             <OFFERS>
+                     <xsl:for-each select="$CRM_LISTA_ZASOBOW_OFFERS//item[CRM_LISTA_ZASOBOW_ID=$default_db__CRM_LISTA_ZASOBOW:ID]">
+                         <DIRECT>
+                             <xsl:attribute name="ID" select="ID"/>
+                             <xsl:attribute name="A_STATUS" select="A_STATUS"/>
+                             <xsl:attribute name="A_CLASSIFIED" select="A_CLASSIFIED"/>
+                             <xsl:attribute name="A_ADM_COMPANY" select="A_ADM_COMPANY"/>
+                             <xsl:copy-of select="COMPANIES_ID"/>
+                             <xsl:copy-of select="ID_PROJECT"/>
+                             <xsl:copy-of select="RESOURCE_UNIT_TYPE"/>
+                             <xsl:copy-of select="OFFER_UNIT_TYPE"/>
+                             <xsl:copy-of select="OFFER_UNIT_TO_RESOURCE_UNIT_RATIO"/>
+                             <xsl:copy-of select="OFFER_MIN_QTY"/>
+                             <xsl:copy-of select="RESOURCE_MIN_QTY_BY_MIN_OFFER_QTY"/>
+                             <xsl:copy-of select="OFFER_PRICE_PER_UNIT"/>
+                             <xsl:copy-of select="OFFER_PRICE_PER_RESOURCE_UNIT"/>
+                             <xsl:copy-of select="OFFERED_QUALITY"/>
+                         </DIRECT>
+                     </xsl:for-each>
+                     <xsl:for-each select="$RESOURCE_PARENTS_CHILDS/RESOURCE[@source='PARENTS']"> 
+                             <xsl:variable name="PARENTS_record" select="."/>
+                                  <xsl:for-each select="$CRM_LISTA_ZASOBOW_OFFERS//item[CRM_LISTA_ZASOBOW_ID=$PARENTS_record]">
+                                      <PARENTS>
+                                          <xsl:attribute name="ID" select="ID"/>
+                                          <xsl:attribute name="A_STATUS" select="A_STATUS"/>
+                                          <xsl:attribute name="A_CLASSIFIED" select="A_CLASSIFIED"/>
+                                          <xsl:attribute name="A_ADM_COMPANY" select="A_ADM_COMPANY"/>
+                                          <xsl:copy-of select="COMPANIES_ID"/>
+                                          <xsl:copy-of select="ID_PROJECT"/>
+                                          <xsl:copy-of select="RESOURCE_UNIT_TYPE"/>
+                                          <xsl:copy-of select="OFFER_UNIT_TYPE"/>
+                                          <xsl:copy-of select="OFFER_UNIT_TO_RESOURCE_UNIT_RATIO"/>
+                                          <xsl:copy-of select="OFFER_MIN_QTY"/>
+                                          <xsl:copy-of select="RESOURCE_MIN_QTY_BY_MIN_OFFER_QTY"/>
+                                          <xsl:copy-of select="OFFER_PRICE_PER_UNIT"/>
+                                          <xsl:copy-of select="OFFER_PRICE_PER_RESOURCE_UNIT"/>
+                                          <xsl:copy-of select="OFFERED_QUALITY"/>
+                                      </PARENTS>
+                                  </xsl:for-each>
+                      </xsl:for-each>
+                     <xsl:for-each select="$RESOURCE_PARENTS_CHILDS/RESOURCE[@source='CHILDS']"> 
+                            <xsl:variable name="CHILDS_record" select="."/>
+                            <xsl:for-each select="$CRM_LISTA_ZASOBOW_OFFERS//item[CRM_LISTA_ZASOBOW_ID=$CHILDS_record]">
+                                <CHILDS>
+                                    <xsl:attribute name="ID" select="ID"/>
+                                    <xsl:attribute name="A_STATUS" select="A_STATUS"/>
+                                    <xsl:attribute name="A_CLASSIFIED" select="A_CLASSIFIED"/>
+                                    <xsl:attribute name="A_ADM_COMPANY" select="A_ADM_COMPANY"/>
+                                    <xsl:copy-of select="COMPANIES_ID"/>
+                                    <xsl:copy-of select="ID_PROJECT"/>
+                                    <xsl:copy-of select="RESOURCE_UNIT_TYPE"/>
+                                    <xsl:copy-of select="OFFER_UNIT_TYPE"/>
+                                    <xsl:copy-of select="OFFER_UNIT_TO_RESOURCE_UNIT_RATIO"/>
+                                    <xsl:copy-of select="OFFER_MIN_QTY"/>
+                                    <xsl:copy-of select="RESOURCE_MIN_QTY_BY_MIN_OFFER_QTY"/>
+                                    <xsl:copy-of select="OFFER_PRICE_PER_UNIT"/>
+                                    <xsl:copy-of select="OFFER_PRICE_PER_RESOURCE_UNIT"/>
+                                    <xsl:copy-of select="OFFERED_QUALITY"/>
+                                </CHILDS>
+                            </xsl:for-each>
+                     </xsl:for-each>
+             </OFFERS>
+           
+         <!-- szukam opcji zabrania skads - przesuniecia z rodzicow-->  
+            <INSTANCES>
+                <PARENTS>
+                <xsl:for-each select="$RESOURCE_PARENTS_CHILDS/RESOURCE[@source='PARENTS']"> 
+                    <xsl:variable name="PARENTS_record" select="."/>
+                    <RESOURCE><xsl:attribute name="ID" select="$PARENTS_record"/>
+                        <xsl:comment>166:Szukam<xsl:value-of select="$PARENTS_record"/>;</xsl:comment>
+                         <xsl:for-each-group select="$system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@RESOURCE=$PARENTS_record]" group-by="@ID">
+                            <xsl:apply-templates mode="default_db__CRM_LISTA_ZASOBOW_OFFERS:copy-without-ERROR_NOT_ENOUGH" select="current()"/>
+                        </xsl:for-each-group>
+                    </RESOURCE>
+                </xsl:for-each>
+                </PARENTS>
+                <CHILDS>
+                    <xsl:for-each select="$RESOURCE_PARENTS_CHILDS/RESOURCE[@source='CHILDS']"> 
+                        <xsl:variable name="CHILDS_record" select="."/>
+                        <RESOURCE><xsl:attribute name="ID" select="$CHILDS_record"/>
+                        <xsl:comment>166:Szukam<xsl:value-of select="$CHILDS_record"/>;</xsl:comment>
+                            <xsl:for-each-group select="$system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@RESOURCE=$CHILDS_record]" group-by="@ID">
+                                <xsl:apply-templates mode="default_db__CRM_LISTA_ZASOBOW_OFFERS:copy-without-ERROR_NOT_ENOUGH" select="current()"/>
+                            </xsl:for-each-group>
+                        </RESOURCE>
+                    </xsl:for-each>
+                </CHILDS>
+                <SIBLING>
+                    <RESOURCE>
+                        <xsl:attribute name="ID" select="$default_db__CRM_LISTA_ZASOBOW:ID"/>
+                        <xsl:for-each-group select="$system_cache__appinfo:_build_resources_tree_with_instances_refs//node()[@RESOURCE=$default_db__CRM_LISTA_ZASOBOW:ID]" group-by="@ID">
+                            <xsl:apply-templates mode="default_db__CRM_LISTA_ZASOBOW_OFFERS:copy-without-ERROR_NOT_ENOUGH" select="current()"/>
+                        </xsl:for-each-group>
+                     </RESOURCE>
+                </SIBLING>
+            </INSTANCES>
+         
+       </default_db__CRM_LISTA_ZASOBOW_OFFERS:show_offers_for_resource>
+       <!--</xsl:result-document>-->
+        
+    </xsl:template>
+    
+    
+   
+    <xsl:template match="node()[name()!='']" mode="default_db__CRM_LISTA_ZASOBOW_OFFERS:copy-without-ERROR_NOT_ENOUGH">
+        <xsl:element name="{name()}">
+            <xsl:for-each select="@*">
+                <xsl:attribute name="{name()}" select="."/>
+            </xsl:for-each>
+            <xsl:for-each select="child::*[name()!='ERROR_NOT_ENOUGH']">
+                <xsl:if test="text() and not(@*)">
+                    <xsl:element name="{name()}">
+                        <xsl:value-of select="text()"/>
+                    </xsl:element>
+                </xsl:if>
+            </xsl:for-each>
+        </xsl:element>
+    </xsl:template>
+   
+    <!-- @2015-09-01 kolejna propozycja funkcji do wywolywania podczas widoku tabeli aby system wyswietlil dalsze instrukcje do przetwarzania dla GUI etc..-->
+    <xsl:template match="node()" mode="default_db__CRM_LISTA_ZASOBOW_OFFERS:table_functions">
+        <xsl:param name="todo_PAGE_LIMIT"/>
+        <xsl:param name="todo_PAGE_NUMBER"/>
+        <xsl:param name="todo_FILTER"/>
+        <!-- albo moze tak ? -->
+        <xsl:param name="todo_RECORDS_ID"/>
+        
+        <xsl:variable name="todo_RECORS_ID_to_parse">
+            <xsl:choose>
+                <xsl:when test="$todo_FILTER">
+                    <!-- jezeli podano do funkcji parametr numerow ID rekordow - TODO jaka struktura - array, numery @ID po spacji? -->
+                    <xsl:value-of select="$todo_FILTER"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <!-- todo trzeba odpytac API o rekordy spelniajace ten filtr-->
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        
+        <!-- wyzwalam dla listy tego co widac na ekranie UI transformacje, ktora zwroci XML z oznacznikami rekordow ID , kolumnami etc, ktore powinno przetworzyc GUI javascript -->
+        <xsl:apply-templates mode="default_db__CRM_LISTA_ZASOBOW_OFFERS:allowed_functions" select="$todo_FILTER"/>
+        
+        
+    </xsl:template>
+    
+    
+    <!-- funkcja do wyzwolenia podczas chodzenia przez GUI po tabeli rekordow w ADMIN_USERS wykrywajaca dla ktorych rekordow mozna wyzwolic jakas funkcje -->
+    <xsl:template match="node()" mode="default_db__CRM_LISTA_ZASOBOW_OFFERS:allowed_functions">
+        <!-- 
+         2015-09-01 todo , powinna tutaj zostac wyzwolona struktura dla roznych przewidzianych miesc GUI, tj. 
+          - lewa strona akcji edycja itp;
+          - gorna strona filtrow - jakies zestawienia, wydruki
+          - dolna stopka - podsumowania
+          - opcjonalne dodatkowe stopki
+        -->
+        <xsl:choose>
+            <xsl:when test="ID and A_STATUS!='DELETED'">
+                <system_cache__appinfo:apply-templates>
+                    <xsl:attribute name="mode" select="'default_db:ADMIN_USERS'"/>
+                    <xsl:attribute name="output" select="'html'"/>
+                    <xsl:attribute name="description" select="'wyposazenie pracownika widok html'"/>
+                    <source_record>
+                        <xsl:copy-of select="ID"/>
+                    </source_record>
+                </system_cache__appinfo:apply-templates>
+            </xsl:when>
+        </xsl:choose>
+        <!-- TODO jakos by to ograniczyc/podlaczyc do widoku biezacej listy elementow - czyli musze wiedziec, ze mam wiecej elementow na ekranie -czyli jakis count(node())&gt;1 ? -->
+        <system_cache__appinfo:call-template>
+            <xsl:attribute name="name" select="'wyposazenie_all'"/>
+            <xsl:attribute name="output" select="'html'"/>
+            <xsl:attribute name="description" select="'wyposazenie wszystkich pracownikow widok html'"/>
+            <source_record>
+                <xsl:comment>TODO tutaj jakas lista rekordow lub filtr dla ktorego to jest dostepne jako caly ekran lub kawalek</xsl:comment>
+            </source_record>
+        </system_cache__appinfo:call-template>
+    </xsl:template>
+    
+    
+        
+   
+    
+    
+  
+    
+    
+    
+    
+    
+    
+    
+</xsl:stylesheet>

+ 168 - 0
SE/schema/default_db_xml_cache.public/CRM_LISTA_ZASOBOW_tree.xsl

@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:import href="form_occurs_max_sequence.xsl"/>
+    
+    <xsl:variable name="CRM_LISTA_ZASOBOW">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'CRM_LISTA_ZASOBOW'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+    
+    <xsl:variable name="LDAP_GROUPS">
+        <!-- ID , NAME -->
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'LDAP_GROUPS'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+    
+    <!-- robi glowne drzewo typow zasobow do przetwarzania razem z aliasami wirtualnymi i zwyklymi -->
+    <xsl:template name="system_cache__appinfo:CRM_LISTA_ZASOBOW_tree">
+        <xsl:param name="parent_id"/>
+        <xsl:param name="alias_id"/>
+        <xsl:param name="ALIAS_MODE"/>
+        <xsl:param name="looppath"/>
+        
+       
+        
+        <xsl:for-each select="$CRM_LISTA_ZASOBOW//item[PARENT_ID=$parent_id]">
+            <xsl:sort select="SORT_PRIO"/>
+            
+            <xsl:choose>
+                <xsl:when test="substring-before($looppath,concat('/',ID,'/'))">
+                    <xsl:message terminate="no">ERROR stylesheet is looping!<xsl:value-of select="$looppath"/></xsl:message>
+                    <xsl:comment>ERROR stylesheet is looping!<xsl:value-of select="$looppath"/></xsl:comment>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:choose>
+                        <xsl:when test="ALIAS_ID and ALIAS_MODE='VIRTUAL'">
+                            <tree_item>
+                                <xsl:variable name="ID" select="ID"/>
+                                <xsl:attribute name="ID" select="ID"/>
+                                <xsl:attribute name="TYPE" select="TYPE"/>
+                                <xsl:attribute name="minOccurs" select="system_cache__appinfo:form_occurs_max_sequence(minOccurs)"/>
+                                <xsl:attribute name="LDAP_GROUP_NAME" select="$LDAP_GROUPS//item/NAME[../ID=$ID]"/>
+                                <xsl:attribute name="A_ADM_COMPANY" select="A_ADM_COMPANY"/>
+                                <xsl:attribute name="A_CLASSIFIED" select="A_CLASSIFIED"/>
+                                <xsl:attribute name="A_RECORD_UPDATE_DATE" select="A_RECORD_UPDATE_DATE"/>
+                                <xsl:if test="string-length(ALIAS_ID)!=0">
+                                    <xsl:attribute name="ALIAS_ID" select="ALIAS_ID"/> 
+                                    <xsl:attribute name="ALIAS_MODE" select="ALIAS_MODE"/>
+                                </xsl:if>
+                                <DESC><xsl:value-of select="DESC"/></DESC>
+                                <!--<instances>
+                                    <xsl:apply-templates mode="detect_resource_type" select=".">
+                                        <xsl:with-param name="RESOURCE_ID" select="ALIAS_ID"/>
+                                    </xsl:apply-templates>
+                                </instances>-->
+                                <xsl:call-template name="system_cache__appinfo:CRM_LISTA_ZASOBOW_tree">
+                                    <xsl:with-param name="parent_id" select="ID"/>
+                                    <xsl:with-param name="alias_id" select="ALIAS_ID"/>
+                                    <xsl:with-param name="ALIAS_MODE" select="ALIAS_MODE"/>
+                                    <xsl:with-param name="looppath" select="concat($looppath,'/',ID)"/>
+                                </xsl:call-template>
+                            </tree_item>
+                        </xsl:when>
+                        
+                        <xsl:otherwise>
+                            <tree_item>
+                                <xsl:variable name="ID" select="ID"/>
+                                <xsl:attribute name="ID" select="ID"/>
+                                <xsl:attribute name="TYPE" select="TYPE"/>
+                                <xsl:attribute name="minOccurs" select="system_cache__appinfo:form_occurs_max_sequence(minOccurs)"/>
+                                <xsl:attribute name="LDAP_GROUP_NAME" select="$LDAP_GROUPS//item/NAME[../ID=$ID]"/>
+                                <xsl:attribute name="A_ADM_COMPANY" select="A_ADM_COMPANY"/>
+                                <xsl:attribute name="A_CLASSIFIED" select="A_CLASSIFIED"/>
+                                <xsl:attribute name="A_RECORD_UPDATE_DATE" select="A_RECORD_UPDATE_DATE"/>
+                                <xsl:if test="string-length(ALIAS_ID)!=0">
+                                    <xsl:attribute name="ALIAS_ID" select="ALIAS_ID"/> 
+                                    <xsl:attribute name="ALIAS_MODE" select="ALIAS_MODE"/>
+                                </xsl:if>
+                                <DESC><xsl:value-of select="DESC"/></DESC>
+                                <!--<instances>
+                                    <xsl:apply-templates mode="detect_resource_type" select="."/>
+                                </instances>-->
+                                <xsl:call-template name="system_cache__appinfo:CRM_LISTA_ZASOBOW_tree">
+                                    <xsl:with-param name="parent_id" select="ID"/>
+                                    <xsl:with-param name="alias_id" select="ALIAS_ID"/>
+                                    <xsl:with-param name="ALIAS_MODE" select="ALIAS_MODE"/>
+                                    <xsl:with-param name="looppath" select="concat($looppath,'/',ID)"/>
+                                </xsl:call-template>
+                            </tree_item>
+                        </xsl:otherwise>
+                    </xsl:choose>                   
+                </xsl:otherwise>
+            </xsl:choose>
+            
+        </xsl:for-each>
+        
+        <xsl:if test="$alias_id&gt;'0'">
+            <xsl:for-each select="$CRM_LISTA_ZASOBOW//item[ID=$alias_id]">
+                <xsl:sort select="SORT_PRIO"/>
+                <xsl:choose>
+                    <xsl:when test="substring-before($looppath,concat('/',ID,'/'))">
+                        <xsl:message terminate="no">ERROR stylesheet is looping!<xsl:value-of select="$looppath"/></xsl:message>
+                        <xsl:comment>ERROR stylesheet is looping!<xsl:value-of select="$looppath"/></xsl:comment>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <tree_item>
+                            <xsl:variable name="ID" select="ID"/>
+                            <xsl:attribute name="source" select="'ALIAS'"/>
+                            <xsl:attribute name="source_alias_mode" select="$ALIAS_MODE"/>
+                            <xsl:attribute name="ID" select="ID"/>
+                            <xsl:attribute name="TYPE" select="TYPE"/>
+                            <xsl:attribute name="LDAP_GROUP_NAME" select="$LDAP_GROUPS//item/NAME[../ID=$ID]"/>
+                            <xsl:attribute name="A_ADM_COMPANY" select="A_ADM_COMPANY"/>
+                            <xsl:attribute name="A_CLASSIFIED" select="A_CLASSIFIED"/>
+                            <xsl:attribute name="A_RECORD_UPDATE_DATE" select="A_RECORD_UPDATE_DATE"/>
+                            <xsl:attribute name="minOccurs" select="system_cache__appinfo:form_occurs_max_sequence(minOccurs)"/>
+                            
+                                <xsl:attribute name="ALIAS_ID" select="$alias_id"/> 
+                                <xsl:attribute name="ALIAS_MODE" select="$ALIAS_MODE"/>
+                            
+                            <DESC><xsl:value-of select="DESC"/></DESC>
+                            <xsl:call-template name="system_cache__appinfo:CRM_LISTA_ZASOBOW_tree">
+                                <xsl:with-param name="parent_id" select="ID"/>
+                                <xsl:with-param name="alias_id" select="ALIAS_ID"/>
+                                <xsl:with-param name="ALIAS_MODE" select="ALIAS_MODE"/>
+                                <xsl:with-param name="looppath" select="concat($looppath,'/',ID)"/>
+                            </xsl:call-template>
+                        </tree_item>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:for-each>
+        </xsl:if>
+        
+    </xsl:template>
+    <xsl:template name="system_cache__appinfo:transform_cache__CRM_LISTA_ZASOBOW_tree">        
+        <xsl:choose>
+            <xsl:when test="unparsed-text-available('../default_db.instance.xml/transformed/CRM_LISTA_ZASOBOW_tree.xml')">
+                <xsl:copy-of select="doc('../default_db.instance.xml/transformed/CRM_LISTA_ZASOBOW_tree.xml')"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:variable name="CRM_LISTA_ZASOBOW_tree">
+                    <system_cache__appinfo:CRM_LISTA_ZASOBOW_tree>
+                        <xsl:call-template name="system_cache__appinfo:CRM_LISTA_ZASOBOW_tree">
+                            <xsl:with-param name="parent_id" select="''"/>
+                            <xsl:with-param name="looppath" select="''"/>
+                            <!--<xsl:with-param name="alias_id" select="$CRM_LISTA_ZASOBOW//item/ALIAS_ID[../PARENT_ID=$parent_id]"/>-->
+                        </xsl:call-template>
+                    </system_cache__appinfo:CRM_LISTA_ZASOBOW_tree>
+                </xsl:variable>
+                <xsl:result-document href="../default_db.instance.xml/transformed/CRM_LISTA_ZASOBOW_tree.xml">
+                    <xsl:copy-of select="$CRM_LISTA_ZASOBOW_tree"></xsl:copy-of>
+                </xsl:result-document>
+                <xsl:copy-of select="$CRM_LISTA_ZASOBOW_tree"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 81 - 0
SE/schema/default_db_xml_cache.public/IN7_MK_BAZA_DYSTRYBUCJI_tree.xsl

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:import href="form_occurs_max_sequence.xsl"/>
+    <xsl:import href="import_resource_table_xml_from_api.xsl"/>
+    
+    <xsl:variable name="IN7_MK_BAZA_DYSTRYBUCJI">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'IN7_MK_BAZA_DYSTRYBUCJI'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <!-- robi glowne drzewo typow zasobow do przetwarzania razem z aliasami wirtualnymi i zwyklymi -->
+    
+    <xsl:template name="system_cache__appinfo:IN7_MK_BAZA_DYSTRYBUCJI_tree">
+        <xsl:param name="parent_id"/>
+        <xsl:param name="alias_id"/>
+        <xsl:param name="ALIAS_MODE"/>
+        <xsl:param name="looppath"/>
+        
+       
+        
+        <xsl:for-each select="$IN7_MK_BAZA_DYSTRYBUCJI//item[P_ID=$parent_id]">
+            <xsl:sort select="SORT_PRIO"/>
+            <xsl:choose>
+                <xsl:when test="substring-before($looppath,concat('/',ID,'/'))">
+                    <xsl:message terminate="no">ERROR stylesheet is looping!<xsl:value-of select="$looppath"/></xsl:message>
+                    <xsl:comment>ERROR stylesheet is looping!<xsl:value-of select="$looppath"/></xsl:comment>
+                </xsl:when>
+                <xsl:otherwise>
+                            <tree_item>
+                                <xsl:attribute name="ID" select="ID"/>
+                                <xsl:attribute name="M_DIST_TYPE" select="M_DIST_TYPE"/>
+                                <xsl:attribute name="A_ADM_COMPANY" select="A_ADM_COMPANY"/>
+                                <xsl:attribute name="A_CLASSIFIED" select="A_CLASSIFIED"/>
+                                <xsl:attribute name="A_RECORD_UPDATE_DATE" select="A_RECORD_UPDATE_DATE"/>
+                                <M_DIST_DESC><xsl:value-of select="M_DIST_DESC"/></M_DIST_DESC>
+                                <!--<instances>
+                                    <xsl:apply-templates mode="detect_resource_type" select="."/>
+                                </instances>-->
+                                
+                                <xsl:call-template name="system_cache__appinfo:IN7_MK_BAZA_DYSTRYBUCJI_tree">
+                                    <xsl:with-param name="parent_id" select="ID"/>
+                                    <xsl:with-param name="looppath" select="concat($looppath,'/',ID)"/>
+                                </xsl:call-template>
+                            </tree_item>
+                </xsl:otherwise>
+            </xsl:choose>
+            
+        </xsl:for-each>
+        
+        
+    </xsl:template>
+    
+    <xsl:template name="system_cache__appinfo:transform_cache__IN7_MK_BAZA_DYSTRYBUCJI_tree">        
+        <xsl:choose>
+            <xsl:when test="unparsed-text-available('../default_db.instance.xml/transformed/IN7_MK_BAZA_DYSTRYBUCJI_tree.xml')">
+                <xsl:copy-of select="doc('../default_db.instance.xml/transformed/IN7_MK_BAZA_DYSTRYBUCJI_tree.xml')"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:variable name="IN7_MK_BAZA_DYSTRYBUCJI_tree">
+                    <system_cache__appinfo:IN7_MK_BAZA_DYSTRYBUCJI_tree>
+                        <xsl:call-template name="system_cache__appinfo:IN7_MK_BAZA_DYSTRYBUCJI_tree">
+                            <xsl:with-param name="parent_id" select="''"/>
+                            <xsl:with-param name="looppath" select="''"/>
+                        </xsl:call-template>
+                    </system_cache__appinfo:IN7_MK_BAZA_DYSTRYBUCJI_tree>
+                </xsl:variable>
+                <xsl:result-document href="../default_db.instance.xml/transformed/IN7_MK_BAZA_DYSTRYBUCJI_tree.xml">
+                    <xsl:copy-of select="$IN7_MK_BAZA_DYSTRYBUCJI_tree"></xsl:copy-of>
+                </xsl:result-document>
+                <xsl:copy-of select="$IN7_MK_BAZA_DYSTRYBUCJI_tree"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 121 - 0
SE/schema/default_db_xml_cache.public/PROCESY5_TO_BPMN_one_file.xsl

@@ -0,0 +1,121 @@
+<?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:exslt="http://exslt.org/common"
+    exclude-result-prefixes="xs exslt"
+    version="2.0"
+    >
+    
+    <xsl:output indent="yes" omit-xml-declaration="no" version="1.0" encoding="UTF-8" method="xml"/>
+    <xsl:include href="find_child_proces.xsl"/>
+    <xsl:include href="Pools.xsl"/>
+    <xsl:include href="crm_proces_parse.xsl"/>
+    <xsl:include href="procesy_gen_include.xsl"/>
+    <xsl:include href="procesy_gen_include_single_proces.xsl"/>
+    <xsl:include href="stanowiska_nazwy_gen.xsl"/>
+    <!-- <xsl:include href="procesy_to_cubetto.xsl"/>  -->
+    <xsl:include href="procesy_to_bpmn.xsl"/>
+   <!-- <xsl:include href="procesy_to_bpmn_subprocess.xsl"/> -->
+    <xsl:include href="procesy_to_bpmn_single_proces.xsl"/>
+    <!-- config -->
+    <xsl:variable name="procesy_gen_outfile" select="'_procesy_gen.xml'"/>
+    <xsl:variable name="stanowiska_do_procesu_gen_outfile" select="'_stanowiska_do_procesu_gen.xml'"/>
+    <xsl:variable name="stanowiska_nazwy_gen_outfile" select="'_stanowiska_nazwy_gen.xml'"/>  
+    <xsl:variable name="output_bpmn_file" select="'_test_procesy5.bpmn'"/>  
+   <!--  <xsl:variable name="output_bpmn_subprocess_file" select="'_test_procesy5_subprocess.bpmn'"/> -->
+    <xsl:variable name="output_bpmn_single_proces_file" select="'_test_procesy5_single_proces.bpmn'"/> 
+    <!-- wybranie od jakiego momentu rysowac drzewo procesow -->
+    <xsl:variable name="get_proces_tree_id" select="'994'"/>
+    
+   
+   
+    <xsl:template match="/">
+        <xsl:variable name="_procesy_gen">
+            <xsl:call-template name="detect_tree_or_init">
+                    <xsl:with-param name="get_proces_tree_id" select="$get_proces_tree_id"/>
+                </xsl:call-template>
+            
+        </xsl:variable>
+       <!-- wygenerowanie procesow do wykrycia torow i stanowisk -->
+        <xsl:if test="element-available('xsl:result-document')">
+	        <xsl:result-document href="{$procesy_gen_outfile}" indent="yes" omit-xml-declaration="no" version="1.0"   encoding="UTF-8" method="xml">
+	           <xsl:for-each select="exslt:node-set($_procesy_gen)/*">
+	           <xsl:copy-of select="/"/>
+	        </xsl:for-each>
+	        </xsl:result-document>
+         </xsl:if>
+       <!-- wygenerowanie lanes -->
+        <xsl:variable name="procesy_gen_include">
+            <xsl:for-each select="exslt:node-set($_procesy_gen)">
+                <xsl:call-template name="procesy_gen_include"/>
+            </xsl:for-each>
+        </xsl:variable>
+        <xsl:variable name="procesy_gen_include_single_proces">
+            <xsl:for-each select="exslt:node-set($_procesy_gen)">
+                <xsl:call-template name="procesy_gen_include_single_proces"/>
+            </xsl:for-each>
+        </xsl:variable>
+         <!-- <xsl:copy-of select="$procesy_gen_include/*"/> -->    
+        
+        <xsl:if test="element-available('xsl:result-document')">
+	        <xsl:result-document  href="{$stanowiska_do_procesu_gen_outfile}"  indent="yes" omit-xml-declaration="no" version="1.0"   encoding="UTF-8" method="xml">
+	            <xsl:for-each select="exslt:node-set($procesy_gen_include)/*">
+	                <xsl:copy-of select="/"/>
+	            </xsl:for-each>
+	        </xsl:result-document>  
+         </xsl:if>
+        <!-- wykrycie nazw stanowisk na podstawie $procesy_gen_include -->  
+        <xsl:variable name="stanowiska_nazwy_gen">
+            <xsl:for-each select="exslt:node-set($procesy_gen_include)">
+                <xsl:call-template name="stanowiska_nazwy_gen"/>
+            </xsl:for-each>
+        </xsl:variable>
+        <xsl:if test="element-available('xsl:result-document')">
+	        <xsl:result-document  href="{$stanowiska_nazwy_gen_outfile}"  indent="yes" omit-xml-declaration="no" version="1.0"   encoding="UTF-8" method="xml">
+	            <xsl:for-each select="exslt:node-set($stanowiska_nazwy_gen)/*">
+	                <xsl:copy-of select="/"/>
+	            </xsl:for-each>
+	        </xsl:result-document>
+        </xsl:if>
+        <!-- transform do bpmn xml -->
+       
+            <!-- <xsl:for-each select="exslt:node-set($procesy_gen_include)/*">
+                 <xsl:copy-of select="/"/>   
+            </xsl:for-each> -->
+            
+            <!-- <xsl:for-each select="exslt:node-set($stanowiska_nazwy_gen)/*">
+                <xsl:call-template name="procesy_to_bpmn_subprocess">
+                    <xsl:with-param name="procesy_gen_include" select="$procesy_gen_include"/>
+                </xsl:call-template>
+            </xsl:for-each>
+            -->
+        
+        <xsl:if test="element-available('xsl:result-document')">
+            <xsl:result-document  href="{$output_bpmn_file}"  indent="yes" omit-xml-declaration="no" version="1.0"   encoding="UTF-8" method="xml">
+              <xsl:for-each select="exslt:node-set($stanowiska_nazwy_gen)/*">
+                  <xsl:call-template name="procesy_to_bpmn">
+                      <xsl:with-param name="procesy_gen_include" select="$procesy_gen_include"/>
+                  </xsl:call-template>
+              </xsl:for-each>
+          </xsl:result-document>
+        </xsl:if>   
+      
+       <!-- <xsl:if test="element-available('xsl:result-document')">
+            <xsl:result-document  href="{$output_bpmn_single_proces_file}"  indent="yes" omit-xml-declaration="no" version="1.0"   encoding="UTF-8" method="xml"> -->
+                
+                    <xsl:call-template name="procesy_to_bpmn_single_proces">
+                         <xsl:with-param name="procesy_gen_include" select="$procesy_gen_include_single_proces"/>
+                    </xsl:call-template>
+                
+         <!--  </xsl:result-document>
+        </xsl:if> -->   
+      
+           
+            
+            
+    </xsl:template>
+    
+    
+    
+    
+</xsl:stylesheet>

+ 114 - 0
SE/schema/default_db_xml_cache.public/PROCES_INCLUDE.xsl

@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs system_cache__appinfo"
+    version="2.0">
+    
+    <xsl:param name="DEFAULTS__SERVER_ADDRESS" select="'biuro.biall-net.pl/SE/version-git/'"/><!--  parametr do wyrzucenia w defaults - do umozliwienia szybkiego wchodzenia do systemu powiazania szkolenia -->
+    
+    
+    <xsl:param name="CRM_PROCES.xml"  required="yes"/>
+    <!--<xsl:import href="../../default_db.instance.xml/"/>-->
+    <xsl:include href="escaped_html_to_xml.xsl"/>
+    
+    
+    
+    <xsl:template  match="text()" mode="PROCES_INCLUDE">
+        <xsl:param name="ID_PROCES" required="yes"/><!-- to be set to retrieve process tree -->
+        parsed  PROCES:<xsl:value-of select="$ID_PROCES"/>; proces to include is <xsl:value-of select="."/>;
+        
+        <xsl:apply-templates mode="PROCES_TO_DITA" select="$CRM_PROCES.xml/data/items/item[ID=$ID_PROCES]"/>
+        <xsl:apply-templates mode="CRM_PROCES_STEP" select="$CRM_PROCES.xml/data/items/item[PARENT_ID=$ID_PROCES]">
+            <xsl:sort select="SORT_PRIO"/>
+        </xsl:apply-templates>
+        
+    </xsl:template>
+    
+    <xsl:template mode="CRM_PROCES_STEP" match="node()">
+        <!--        CRM_PROCES_STEP dla ID <xsl:value-of select="ID"/> ;-->
+        <xsl:variable name="ID" select="ID"/>
+        <ul>
+            <xsl:for-each select=".">
+                <xsl:sort select="SORT_PRIO"/>
+             
+                 <li>
+                <xsl:apply-templates mode="PROCES_TO_DITA">
+                    <xsl:with-param name="ID" select="$ID"/>
+                </xsl:apply-templates>
+                 
+    <!--            Try to goto  item/PARENT_ID=<xsl:value-of select="current()/ID"/>-->  
+                 <xsl:apply-templates mode="CRM_PROCES_STEP" select="$CRM_PROCES.xml/data/items/item[PARENT_ID=$ID and A_STATUS!='DELETED']"/>
+                 </li>
+             
+            </xsl:for-each>
+        </ul>
+        
+    </xsl:template>
+    
+    <xsl:template mode="PROCES_TO_DITA" match="ID">
+        <xref href="https://{$DEFAULTS__SERVER_ADDRESS}/procesy5.php?task=CRM_PROCES&amp;filtr_id={current()}&amp;filtr_ids=%2B&amp;filtr_ob=%2B&amp;filtr_img=%2B" format="html" scope="external"><xsl:value-of select="."/></xref>
+    </xsl:template>
+    <xsl:template mode="PROCES_TO_DITA" match="DESC">
+        <xsl:param name="ID"/>
+        <term><!--ID: <xsl:apply-templates mode="PROCES_TO_DITA_STRIP_HTML" select="../ID/text()"/><xsl:value-of select="'  '"/>--> <xsl:apply-templates mode="PROCES_TO_DITA_STRIP_HTML"/></term>
+    </xsl:template>
+    <xsl:template mode="PROCES_TO_DITA" match="OPIS">
+        OPIS: <xsl:apply-templates mode="PROCES_TO_DITA_STRIP_HTML"/>
+    </xsl:template>
+    
+    <xsl:template mode="PROCES_TO_DITA" match="*"/>
+        
+    
+    
+    <xsl:template match="*" mode="PROCES_TO_DITA_STRIP_HTML"/>
+    <xsl:template match="text()" mode="PROCES_TO_DITA_STRIP_HTML">
+        <xsl:param name="limit"/>
+        <xsl:variable name="parse_content">
+        <xsl:choose>
+            <xsl:when test=".='&#xD;'"/>
+            <xsl:otherwise><xsl:call-template name="system_cache__appinfo:escaped_html_to_xml" exclude-result-prefixes="#all" extension-element-prefixes="">
+                <xsl:with-param name="html" select="."/>
+            </xsl:call-template></xsl:otherwise>
+        </xsl:choose>
+        </xsl:variable>
+        <xsl:apply-templates select="$parse_content" mode="CONVERT_HTML_TO_DITA_CONTENT"/>
+    </xsl:template>
+    
+    <xsl:template match="text()" mode="PROCES_TO_DITA_STRIP_HTML_TITLE">
+        <xsl:param name="limit"/>
+        <xsl:variable name="parse_title">
+        <xsl:choose>
+            <xsl:when test=".='&#xD;'"/>
+            <xsl:otherwise><xsl:call-template name="system_cache__appinfo:escaped_html_to_xml" exclude-result-prefixes="#all" extension-element-prefixes="">
+                <xsl:with-param name="html" select="."/>
+            </xsl:call-template></xsl:otherwise>
+        </xsl:choose>
+        </xsl:variable>
+        <xsl:copy-of select="$parse_title"/>
+    </xsl:template>
+    
+    
+    <xsl:template match="text()" mode="CONVERT_HTML_TO_DITA_CONTENT">
+        <p><xsl:copy-of select="."/></p>
+    </xsl:template>
+    
+    <xsl:template match="br" mode="CONVERT_HTML_TO_DITA_CONTENT">
+        <xsl:param name="ph_used"/>
+        <xsl:choose>
+            <xsl:when test="$ph_used">
+                <p/>
+                <xsl:apply-templates mode="CONVERT_HTML_TO_DITA_CONTENT"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <p/><xsl:apply-templates mode="CONVERT_HTML_TO_DITA_CONTENT">
+                    <xsl:with-param name="ph_used" select="true()"/>
+                </xsl:apply-templates>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    
+    
+</xsl:stylesheet>

+ 17 - 0
SE/schema/default_db_xml_cache.public/Pools.xsl

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+
+    <!-- template uzywane do wykrycia jakie zasoby sa w procesie przy glownym wywolaniu -->
+    <xsl:template name="Pools">
+        <xsl:param name="proces_id" />
+        <xsl:for-each select="document('CRM_WSKAZNIK.xml')/data/items/item[A_STATUS!='DELETED' and ID_PROCES=$proces_id]">
+            <xsl:element name="ID_ZASOB">
+                <xsl:value-of select="ID_ZASOB"/>
+            </xsl:element>
+           
+        </xsl:for-each>
+    </xsl:template>
+</xsl:stylesheet>

+ 324 - 0
SE/schema/default_db_xml_cache.public/TERYT_procesy5.xsl

@@ -0,0 +1,324 @@
+<?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:Types__x3A__TERYT="https://biuro.biall-net.pl/wfs/default_db/Types/TERYT.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+   
+    <xsl:output method="xml" indent="yes"/>
+    
+    <xsl:variable name="TERC_xml" select="doc('../public_instance.xml/teryt.gov.pl/TERC.xml')"/> 
+    <xsl:variable name="SIMC_xml" select="doc('../public_instance.xml/teryt.gov.pl/SIMC.xml')"/>
+    <xsl:variable name="ULIC_xml" select="doc('../public_instance.xml/teryt.gov.pl/ULIC.xml')"/>
+    <xsl:variable name="Types__x3A__TERYT:DB_TABLES">
+        <Types__x3A__TERYT:DB_TABLES>
+            <Types__x3A__TERYT:TERC_WOJ string="NAZWA" id="WOJ"/>
+            <Types__x3A__TERYT:TERC_POW string="NAZWA" id="POW"/>
+            <Types__x3A__TERYT:TERC_GMI string="NAZWA" id="GMI"/>
+            <Types__x3A__TERYT:SIMC_SYM string="NAZWA" id="SYM"/>
+            <Types__x3A__TERYT:SIMC_SYMPOD string="NAZWA" id="SYM"/>
+            <Types__x3A__TERYT:ULIC string="NAZWA_1" id="SYM_UL"/>
+        </Types__x3A__TERYT:DB_TABLES>
+    </xsl:variable>
+    
+    
+    
+    <xsl:param name="select_WOJ" select="'22'"/>
+    
+    
+    <xsl:function name="Types__x3A__TERYT:concat_string_cond">
+        <xsl:param name="concat_string" required="yes"/>
+        <xsl:param name="NAZWA" required="yes"/>
+        <xsl:param name="RM" required="yes"/>
+        <xsl:param name="parent_NAZWA"/>
+        
+        <xsl:variable name="NAZWA_no_sp" select="replace($NAZWA,' ','_')"/>
+        <xsl:variable name="separ">
+            <xsl:choose>
+                <xsl:when test="$concat_string=''"/>
+                <xsl:otherwise>__</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="concat_string">
+            <xsl:choose>
+                <xsl:when test="$RM='99' or  $RM='03' or $NAZWA=$parent_NAZWA ">
+                    <xsl:value-of select="$concat_string"/>
+                </xsl:when> <!-- Jezeli czesc miasta to nie wyswietlac-->
+                <xsl:otherwise>
+                    <xsl:value-of select="concat($concat_string,$separ,$NAZWA_no_sp)"/>
+                </xsl:otherwise>    
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:value-of select="$concat_string"/>
+    </xsl:function>
+    
+    
+    <xsl:template name="main">
+        <Types__x3A__TERYT>
+        <xsl:apply-templates mode="Types__x3A__TERYT:TERC_WOJ" select="$TERC_xml">
+            <xsl:with-param name="main_WOJ" select="'POMORSKIE'"/>
+            <xsl:with-param name="main_POW" select="'gdański'"/>
+        </xsl:apply-templates>
+        </Types__x3A__TERYT>
+    </xsl:template>
+    
+    
+    <xsl:template name="upload_to_MySql">
+        <xsl:variable name="TERYT_procesy5.xml" select="doc('../public_instance.xml/teryt.gov.pl/TERYT_procesy5.xml')"/>
+        <xsl:variable name="Types__x3A__TERYT:upload_to_MySql">
+        <Types__x3A__TERYT:upload_to_MySql>#!/bin/bash
+            echo type_username
+            read username
+            echo type_passw
+            read -s passwd
+            
+           <!-- echo "drop table if exists \`_TERYT_DB_PL\`;" |mysql -u$username -p$passwd -hse.dev.webone.pl -DSES_USERS2
+            echo "
+            CREATE TABLE IF NOT EXISTS \`_TERYT_DB_PL\` (
+            \`TYP\` varchar(15) NOT NULL,
+            \`TYP_ID\` int(15) NOT NULL,
+            \`concat_string\` varchar(100) NOT NULL
+            ) ENGINE=MyISAM DEFAULT CHARSET=latin2 
+            " |mysql -u$username -p$passwd -hse.dev.webone.pl -DSES_USERS2-->
+            <xsl:for-each select="$Types__x3A__TERYT:DB_TABLES/Types__x3A__TERYT:DB_TABLES/*">
+            echo "drop table if exists \`_TERYT_DB_PL__<xsl:value-of select="local-name()"/>\`;" |mysql -u$username -p$passwd -hse.dev.webone.pl -DSES_USERS2
+            echo "
+            CREATE TABLE IF NOT EXISTS \`_TERYT_DB_PL__<xsl:value-of select="local-name()"/>\` (
+            \`ID\` int(15) NOT NULL,
+            \`NAZWA\` varchar(100) NOT NULL,
+            \`concat_string\` varchar(100) NOT NULL
+            ) ENGINE=MyISAM DEFAULT CHARSET=latin2 
+            " |mysql -u$username -p$passwd -hse.dev.webone.pl -DSES_USERS2
+            </xsl:for-each>
+            
+            
+            
+               <!--<xsl:for-each-group select="$TERYT_procesy5.xml//*[@concat_string]" group-by="@concat_string">
+                   echo "insert into \`_TERYT_DB_PL\` ( \`TYP\`,\`TYP_ID\`, \`concat_string\`) values ( 
+                   <xsl:choose>
+                       <xsl:when test="local-name()='ULIC'">'SYM_UL','<xsl:value-of select="SYM_UL"/>','<xsl:value-of select="@concat_string"/>'</xsl:when>
+                       <xsl:when test="local-name()='SYM_POD'">'SYM_POD','<xsl:value-of select="SYM_POD"/>','<xsl:value-of select="@concat_string"/>'</xsl:when>
+                       <xsl:when test="local-name()='SIMC_SYM'">'SIMC_SYM','<xsl:value-of select="SYM"/>','<xsl:value-of select="@concat_string"/>'</xsl:when>
+                       <xsl:when test="local-name()='TERC_GMI'">'GMI','<xsl:value-of select="GMI"/>','<xsl:value-of select="@concat_string"/>'</xsl:when>
+                       <xsl:when test="local-name()='TERC_POW'">'POW','<xsl:value-of select="POW"/>','<xsl:value-of select="@concat_string"/>'</xsl:when>
+                       <xsl:when test="local-name()='TERC_WOJ'">'WOJ','<xsl:value-of select="WOJ"/>','<xsl:value-of select="@concat_string"/>'</xsl:when>
+                   </xsl:choose> )" |mysql -u$username -p$passwd -hse.dev.webone.pl -DSES_USERS2
+               </xsl:for-each-group>-->
+            <!--<xsl:for-each-group select="$TERYT_procesy5.xml//*[@concat_string]" group-by="@concat_string">
+                echo "insert into \`_TERYT_DB_PL\` ( \`TERC_WOJ\`,\`TERC_POW\`,\`TERC_GMI\`,\`SIMC_SYM\`,\`SYM_POD\`,\`SYM_UL\`, `\NAZWA_TERYT`\, \`TYP\`,\`TYP_ID\`,\`concat_string\`) values ( 
+                '<xsl:value-of select="parent::node()[local-name()='TERC_WOJ']/WOJ"/>',
+                '<xsl:value-of select="parent::node()[local-name()='TERC_POW']/POW"/>',
+                '<xsl:value-of select="parent::node()[local-name()='TERC_GMI']/TERC_GMI"/>',
+                '<xsl:value-of select="parent::node()[local-name()='SIMC_SYM']/SIMC_SYM"/>',
+                '<xsl:value-of select="parent::node()[local-name()='SIMC_SYMPOD']/SIMC_SYMPOD"/>',
+                '<xsl:value-of select="SYM_UL"/>',
+                <xsl:choose>
+                    <xsl:when test="local-name()='ULIC'">'SYM_UL','<xsl:value-of select="SYM_UL"/>'</xsl:when>
+                    <xsl:when test="local-name()='SYM_POD'">'SYM_POD','<xsl:value-of select="SYM_POD"/>'</xsl:when>
+                    <xsl:when test="local-name()='SIMC_SYM'">'SIMC_SYM','<xsl:value-of select="SYM"/>'</xsl:when>
+                    <xsl:when test="local-name()='TERC_GMI'">'GMI','<xsl:value-of select="GMI"/>'</xsl:when>
+                    <xsl:when test="local-name()='TERC_POW'">'POW','<xsl:value-of select="POW"/>'</xsl:when>
+                    <xsl:when test="local-name()='TERC_WOJ'">'WOJ','<xsl:value-of select="WOJ"/>'</xsl:when>
+                </xsl:choose>
+                ,'<xsl:value-of select="@concat_string"/>' )" |mysql -u$username -p$passwd -hse.dev.webone.pl -DSES_USERS2
+            </xsl:for-each-group>-->
+            <xsl:for-each-group select="$TERYT_procesy5.xml//*[@concat_string]" group-by="@concat_string">
+                <xsl:variable name="curr_node_name" select="local-name()"/>
+                echo "insert into \`_TERYT_DB_PL__<xsl:value-of select="local-name()"/>\`
+                <!--<xsl:choose>
+                    <xsl:when test="local-name()='ULIC'">'SYM_UL'</xsl:when>
+                    <xsl:when test="local-name()='SYM_POD'">'SYM_POD'</xsl:when>
+                    <xsl:when test="local-name()='SIMC_SYM'">'SIMC_SYM'</xsl:when>
+                    <xsl:when test="local-name()='TERC_GMI'">'GMI'</xsl:when>
+                    <xsl:when test="local-name()='TERC_POW'">'POW'</xsl:when>
+                    <xsl:when test="local-name()='TERC_WOJ'">'WOJ'</xsl:when>
+                </xsl:choose>-->
+                 ( \`ID\`,\`NAZWA\`,\`concat_string\`) values ( 
+                 '<xsl:value-of select="node()[name()=$Types__x3A__TERYT:DB_TABLES/Types__x3A__TERYT:DB_TABLES/node()[local-name()=$curr_node_name]/@id]/text()"/>'
+                ,'<xsl:value-of select="node()[name()=$Types__x3A__TERYT:DB_TABLES/Types__x3A__TERYT:DB_TABLES/node()[local-name()=$curr_node_name]/@string]/text()"/>'
+                 ,'<xsl:value-of select="@concat_string"/>' )" |mysql -u$username -p$passwd -hse.dev.webone.pl -DSES_USERS2
+                echo <xsl:value-of select="@concat_string"/>
+            </xsl:for-each-group>
+        </Types__x3A__TERYT:upload_to_MySql>
+        </xsl:variable>
+        <xsl:copy-of select="$Types__x3A__TERYT:upload_to_MySql"/>
+        <xsl:result-document href="../default_db.instance.xml/Types__x3A__TERYT__upload_to_MySql.sh" omit-xml-declaration="yes">
+            <xsl:copy-of select="$Types__x3A__TERYT:upload_to_MySql/Types__x3A__TERYT:upload_to_MySql/text()" copy-namespaces="no"/>
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+    <!--<xsl:template match="teryt" mode="Types__x3A__TERYT:TERC_WOJ">
+        <!-\-<xsl:apply-templates mode="Types__x3A__TERYT:TERC_WOJ"/>-\->
+    </xsl:template>-->
+    <!--<xsl:template match="catalog" mode="Types__x3A__TERYT:TERC_WOJ">
+        <!-\-<xsl:apply-templates mode="Types__x3A__TERYT:TERC_WOJ"/>-\->
+        <catalog/>
+    </xsl:template>-->
+    
+    
+    
+    <xsl:template mode="Types__x3A__TERYT:TERC_WOJ" match="row[col[@name='POW']/.='' and col[@name='WOJ']=$select_WOJ     ]"> <!-- filtr dla pomorskiego  and col[@name='WOJ']='22' -->
+        <xsl:param name="main_WOJ"/>
+        <xsl:param name="main_POW"/>
+        <xsl:variable name="concat_string">
+            <xsl:choose>
+                <xsl:when test="col[@name='NAZWA']=$main_WOJ"/>
+                <xsl:otherwise>
+                    <xsl:value-of select="col[@name='NAZWA']"/>
+                </xsl:otherwise>    
+            </xsl:choose>
+        </xsl:variable>
+        <Types__x3A__TERYT:TERC_WOJ><xsl:if test="$concat_string!=''"><xsl:attribute name="concat_string" select="$concat_string"/></xsl:if>
+            <xsl:attribute name="WOJ" select="col[@name='NAZWA']"/>
+            <xsl:element name="WOJ"><xsl:value-of select="col[@name='WOJ']"/></xsl:element>
+            <xsl:element name="NAZWA"><xsl:value-of select="col[@name='NAZWA']"/></xsl:element>
+            <xsl:element name="NAZDOD"><xsl:value-of select="col[@name='NAZDOD']"/></xsl:element>
+                    <xsl:apply-templates mode="Types__x3A__TERYT:TERC_POW" select="parent::node()/node()[col[@name='WOJ']=current()/col[@name='WOJ'] ]">
+                        <xsl:with-param name="concat_string" select="$concat_string"/>
+                        <xsl:with-param name="main_POW" select="$main_POW"/>
+                    </xsl:apply-templates>
+        </Types__x3A__TERYT:TERC_WOJ>
+    </xsl:template>
+    
+    
+    <xsl:template mode="Types__x3A__TERYT:TERC_WOJ" match="row"/> <!-- filtr do ignore-->
+   
+    <xsl:template mode="Types__x3A__TERYT:TERC_POW" match="row[col[@name='POW']/.!='' and col[@name='GMI']/.=''     ]"> <!-- filtr dla Pruszcz Gdanski  and col[@name='POW']='04' -->
+        <xsl:param name="concat_string"/>
+        <xsl:param name="main_POW"/>
+        <xsl:variable name="concat_string">
+            <xsl:choose>
+                <xsl:when test="col[@name='NAZWA']=$main_POW"/>
+                <xsl:when test="$concat_string=''">
+                    <xsl:value-of select="col[@name='NAZWA']"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="concat($concat_string,'__',col[@name='NAZWA'])"/>
+                </xsl:otherwise>    
+            </xsl:choose>
+        </xsl:variable>
+        <Types__x3A__TERYT:TERC_POW>
+            <xsl:if test="$concat_string!=''"><xsl:attribute name="concat_string" select="$concat_string"/></xsl:if>
+            <xsl:attribute name="POW" select="col[@name='NAZWA']"/>
+            <xsl:element name="POW"><xsl:value-of select="col[@name='POW']"/></xsl:element>
+            <xsl:element name="NAZWA"><xsl:value-of select="col[@name='NAZWA']"/></xsl:element>
+            <xsl:element name="NAZDOD"><xsl:value-of select="col[@name='NAZDOD']"/></xsl:element>
+            <xsl:apply-templates mode="Types__x3A__TERYT:TERC_GMI" select="parent::node()/node()[col[@name='WOJ']=current()/col[@name='WOJ']  and  col[@name='POW']=current()/col[@name='POW']]">
+                <xsl:with-param name="concat_string" select="$concat_string"/>
+                <xsl:with-param name="parent_NAZWA" select="col[@name='NAZWA']"/>
+            </xsl:apply-templates> <!--current()/col[@name='WOJ']  and  col[@name='POW']=current()/col[@name='POW']     -->
+        </Types__x3A__TERYT:TERC_POW>
+    </xsl:template>
+   
+   
+    <xsl:template mode="Types__x3A__TERYT:TERC_GMI" match="row[col[@name='POW']/.!='' and col[@name='GMI']/.!='' ]">
+        <xsl:param name="concat_string"/>
+        <xsl:param name="parent_NAZWA"/>
+        <xsl:variable name="concat_string" select="Types__x3A__TERYT:concat_string_cond($concat_string,col[@name='NAZWA'],col[@name='RODZ'],$parent_NAZWA)"/>
+        <Types__x3A__TERYT:TERC_GMI><xsl:attribute name="concat_string" select="$concat_string"/><xsl:attribute name="GMI" select="col[@name='NAZWA']"/>
+            <xsl:element name="GMI"><xsl:value-of select="col[@name='GMI']"/></xsl:element>
+            <xsl:element name="NAZWA"><xsl:value-of select="col[@name='NAZWA']"/></xsl:element>
+            <xsl:element name="NAZDOD"><xsl:value-of select="col[@name='NAZDOD']"/></xsl:element>
+            <xsl:element name="RODZ"><xsl:value-of select="col[@name='RODZ']"/></xsl:element>
+            <!--<xsl:apply-templates mode="Types__x3A__TERYT:TERC_GMI" select="$SIMC_xml//row[col[@name='WOJ']='22'  and  col[@name='POW']='04' and   col[@name='GMI']='03'      ] "/>-->    <!-- $SIMC_xml//row[col[@name='WOJ']=current()/col[@name='WOJ']  and  col[@name='POW']=current()/col[@name='POW']       ] -->
+            <xsl:variable name="WOJ" select="col[@name='WOJ']"/>
+            <xsl:variable name="POW" select="col[@name='POW']"/>
+            <xsl:variable name="GMI" select="col[@name='GMI']"/>
+            <xsl:call-template name="Types__x3A__TERYT:SYMC">
+                <xsl:with-param name="WOJ" select="$WOJ"/>
+                <xsl:with-param name="POW" select="$POW"/>
+                <xsl:with-param name="GMI" select="$GMI"/>
+                <xsl:with-param name="concat_string" select="$concat_string"/>
+                <xsl:with-param name="parent_NAZWA" select="col[@name='NAZWA']"/>
+            </xsl:call-template>
+        </Types__x3A__TERYT:TERC_GMI>
+    </xsl:template>
+    
+    <xsl:template name="Types__x3A__TERYT:SYMC">
+        <xsl:param name="concat_string" />
+        <xsl:param name="parent_NAZWA"/>
+        <xsl:param name="WOJ" required="yes"/>
+        <xsl:param name="POW" required="yes"/>
+        <xsl:param name="GMI" required="yes"/>
+        <xsl:for-each select="$SIMC_xml//row[col[@name='WOJ']=$WOJ  and  col[@name='POW']=$POW   and  col[@name='GMI']=$GMI  and  col[@name='SYM']=col[@name='SYMPOD']   ]">
+            <xsl:variable name="concat_string" select="Types__x3A__TERYT:concat_string_cond($concat_string,col[@name='NAZWA'],col[@name='RM'],$parent_NAZWA)"/>
+            <!--<found><xsl:value-of select="col[@name='NAZWA']"/></found>-->
+            <Types__x3A__TERYT:SIMC_SYM><xsl:attribute name="concat_string" select="$concat_string"/><xsl:attribute name="SYM" select="col[@name='NAZWA']"/>
+                <!--<xsl:element name="GMI"><xsl:value-of select="col[@name='GMI']"/></xsl:element>-->
+                <xsl:element name="NAZWA"><xsl:value-of select="col[@name='NAZWA']"/></xsl:element>
+                <xsl:element name="SYM"><xsl:value-of select="col[@name='SYM']"/></xsl:element>
+                <xsl:element name="RM"><xsl:value-of select="col[@name='RM']"/></xsl:element>
+                <!--<xsl:element name="SYMPOD"><xsl:value-of select="col[@name='SYMPOD']"/></xsl:element>-->
+                <!--<xsl:apply-templates mode="Types__x3A__TERYT:SIMC_SYMPOD" select="$SIMC_xml//row[col[@name='SYMPOD']=current()/../col[@name='SYM'] ]"/>-->
+                <xsl:for-each select="$SIMC_xml//row[ col[@name='SYMPOD']=current()/node()[@name='SYM']  and  col[@name='SYM']!=col[@name='SYMPOD']   ]">
+                    <xsl:variable name="concat_string" select="Types__x3A__TERYT:concat_string_cond($concat_string,col[@name='NAZWA'],col[@name='RM'],$parent_NAZWA)"/>
+                    <Types__x3A__TERYT:SIMC_SYMPOD><xsl:attribute name="concat_string" select="$concat_string"/><xsl:attribute name="SYMPOD" select="col[@name='NAZWA']"/>
+                        <xsl:element name="GMI"><xsl:value-of select="col[@name='GMI']"/></xsl:element>
+                        <xsl:element name="NAZWA"><xsl:value-of select="col[@name='NAZWA']"/></xsl:element>
+                        <xsl:element name="SYM"><xsl:value-of select="col[@name='SYM']"/></xsl:element>
+                        <xsl:element name="SYMPOD"><xsl:value-of select="col[@name='SYMPOD']"/></xsl:element>
+                        <xsl:element name="RM"><xsl:value-of select="col[@name='RM']"/></xsl:element>
+                        <xsl:call-template name="Types__x3A__TERYT:ULIC">
+                            <xsl:with-param name="SYM" select="col[@name='SYM']"/>
+                            <xsl:with-param name="concat_string" select="$concat_string"/>
+                        </xsl:call-template>
+                    </Types__x3A__TERYT:SIMC_SYMPOD>
+                </xsl:for-each>
+                <xsl:call-template name="Types__x3A__TERYT:ULIC"><xsl:with-param name="SYM" select="col[@name='SYM']"/>
+                    <xsl:with-param name="concat_string" select="$concat_string"/>
+                </xsl:call-template>
+            </Types__x3A__TERYT:SIMC_SYM>
+        </xsl:for-each>
+        <!--<xsl:apply-templates mode="Types__x3A__TERYT:SIMC_SYM" select="$SIMC_xml//row[col[@name='WOJ']=$WOJ  and  col[@name='POW']=$POW   and  col[@name='GMI']=$GMI  and  col[@name='SYM']=col[@name='SYMPOD']   ]/ *  "/>--> <!-- bierzemy miejscowosci glowne and  col[@name='SYM']=col[@name='SYMPOD']   -->
+    </xsl:template>
+    
+    
+    <!--<xsl:template mode="Types__x3A__TERYT:SIMC_SYM" match="*">
+        <Types__x3A__TERYT:SIMC_SYM>
+            <xsl:element name="GMI"><xsl:value-of select="../col[@name='GMI']"/></xsl:element>
+            <xsl:element name="NAZWA"><xsl:value-of select="../col[@name='NAZWA']"/></xsl:element>
+            <xsl:element name="SYM"><xsl:value-of select="../col[@name='SYM']"/></xsl:element>
+            <xsl:element name="SYMPOD"><xsl:value-of select="../col[@name='SYMPOD']"/></xsl:element>
+            <!-\-<xsl:apply-templates mode="Types__x3A__TERYT:SIMC_SYMPOD" select="$SIMC_xml//row[col[@name='SYMPOD']=current()/../col[@name='SYM'] ]"/>-\->
+            <!-\-<xsl:call-template name="Types__x3A__TERYT:ULIC"><xsl:with-param name="SYM" select="col[@name='SYM']"/></xsl:call-template>-\->
+        </Types__x3A__TERYT:SIMC_SYM>
+    </xsl:template>-->
+   
+   
+    <!--<xsl:template mode="Types__x3A__TERYT:SIMC_SYMPOD" match="row">
+        <Types__x3A__TERYT:SIMC_SYMPOD>
+            <xsl:element name="GMI"><xsl:value-of select="col[@name='GMI']"/></xsl:element>
+            <xsl:element name="NAZWA"><xsl:value-of select="col[@name='NAZWA']"/></xsl:element>
+            <xsl:element name="SYMPOD"><xsl:value-of select="col[@name='SYMPOD']"/></xsl:element>
+            <xsl:call-template name="Types__x3A__TERYT:ULIC"><xsl:with-param name="SYM" select="col[@name='SYMPOD']"/></xsl:call-template>
+        </Types__x3A__TERYT:SIMC_SYMPOD>
+    </xsl:template>-->
+   
+   
+    <xsl:template name="Types__x3A__TERYT:ULIC" >
+        <xsl:param name="SYM" required="yes"/>
+        <xsl:param name="concat_string" />
+        <xsl:for-each select="$ULIC_xml//row[col[@name='SYM']=$SYM]">
+            <xsl:variable name="concat_string" select="Types__x3A__TERYT:concat_string_cond($concat_string,col[@name='NAZWA_1'],'0','')"/>             
+            <Types__x3A__TERYT:ULIC><xsl:attribute name="concat_string" select="$concat_string"/><xsl:attribute name="ULIC" select="col[@name='NAZWA_1']"/>
+                <xsl:element name="SYM_UL"><xsl:value-of select="col[@name='SYM_UL']"/></xsl:element>
+                <xsl:element name="CECHA"><xsl:value-of select="col[@name='CECHA']"/></xsl:element>
+                <xsl:element name="NAZWA_1"><xsl:value-of select="col[@name='NAZWA_1']"/></xsl:element>
+                <xsl:element name="NAZWA_2"><xsl:value-of select="col[@name='NAZWA_2']"/></xsl:element>
+            </Types__x3A__TERYT:ULIC>
+        </xsl:for-each>
+    </xsl:template>
+   
+    <xsl:template mode="#all" match="row"/>
+    
+    
+    <!--<xsl:template mode="Types__x3A__TERYT:TERC_WOJ" match="*">
+        <empty/>
+    </xsl:template>-->
+    
+    
+    <xsl:template match="text()" mode="#all"/>
+    
+</xsl:stylesheet>

+ 396 - 0
SE/schema/default_db_xml_cache.public/TERYT_terc_xml_import.xsl

@@ -0,0 +1,396 @@
+<?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:TERC_WOJ_POW_GMI_xml_main="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/TERC_WOJ_POW_GMI_xml_main.xsd"
+    xmlns:TERYT_terc_xml_import_after_main="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/TERYT_terc_xml_import_after_main.xsd"
+    exclude-result-prefixes="xs TERC_WOJ_POW_GMI_xml_main"
+    version="2.0">
+    <xsl:output method="xml" indent="yes"/>
+    
+    
+    <!-- @2016-10-24 tworze inny plik na rzecz bezposredniego przerabiania plikow teryt - ten jest do wywalenia -->
+    <!-- @2015-05-20 by Arkadiusz Binder template do importu danych z terytu XML do zbudowania drzewa XML do importu 
+        do bazy obiektow stworzonej w schemacie teryt.xsd 
+    Wszelkie Prawa Zastrzezone BIALL-NET sp. z o.o. Procesy5.pl
+    -->
+    <!--<xsl:import-schema namespace="TERC_WOJ_POW_GMI_xml" schema-location="TERYT_terc_xml_import.xsd"/>-->
+    
+   
+   
+    
+    <xsl:template name="main">
+       
+        <xsl:variable name="TERC_xml"><xsl:apply-templates mode="TERC" select="doc('../public_instance.xml/teryt.gov.pl/TERC.xml')"/></xsl:variable>
+        <xsl:variable name="SIMC_xml"><xsl:apply-templates mode="SIMC" select="doc('../public_instance.xml/teryt.gov.pl/SIMC.xml')"/></xsl:variable>
+        <xsl:variable name="ULIC_xml"><xsl:apply-templates mode="ULIC" select="doc('../public_instance.xml/teryt.gov.pl/ULIC.xml')"/></xsl:variable>
+        
+        
+        <xsl:variable name="TERC_WOJ_POW_GMI_xml_main:main">
+            <xsl:choose>
+                <xsl:when test="unparsed-text-available('../public_instance.xml/teryt.gov.pl/TERYT_main.xml')">
+                    <xsl:copy-of select="doc('../public_instance.xml/teryt.gov.pl/TERYT_main.xml')"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <TERC_WOJ_POW_GMI_xml_main:main>
+                        <xsl:apply-templates mode="ULIC_SYM" select="$ULIC_xml"/>
+                        <xsl:apply-templates mode="SIMC_SYM_SYMPOD" select="$SIMC_xml"/>
+                        <xsl:apply-templates mode="TERC_WOJ" select="$TERC_xml"/>
+                    </TERC_WOJ_POW_GMI_xml_main:main>
+                </xsl:otherwise>
+            </xsl:choose>            
+        </xsl:variable>
+        
+        <xsl:choose>
+            <xsl:when test="unparsed-text-available('../public_instance.xml/teryt.gov.pl/TERYT_main.xml')"/>
+            <xsl:otherwise>
+                <xsl:result-document href="../public_instance.xml/teryt.gov.pl/TERYT_main.xml">
+                    <xsl:copy-of select="$TERC_WOJ_POW_GMI_xml_main:main"/>
+                </xsl:result-document>
+            </xsl:otherwise>
+        </xsl:choose>
+
+            
+        <xsl:variable name="ULIC_SYM_xml"><xsl:apply-templates mode="ULIC_SYM" select="$ULIC_xml"/></xsl:variable>
+        <xsl:variable name="SIMC_SYM_SYMPOD_xml"><xsl:apply-templates mode="SIMC_SYM_SYMPOD" select="$SIMC_xml"/></xsl:variable>
+        <xsl:variable name="TERC_WOJ_POW_GMI_xml"><xsl:apply-templates mode="TERC_WOJ" select="$TERC_xml"/></xsl:variable>
+        <!--<ULIC_SYM_xml><xsl:copy-of select="$ULIC_SYM_xml"/></ULIC_SYM_xml>-->
+        <!--<SIMC_SYM_SYMPOD_xml><xsl:copy-of select="$SIMC_SYM_SYMPOD_xml"/></SIMC_SYM_SYMPOD_xml>-->
+        
+            <!--<xsl:call-template name="TERC_WOJ_POW_GMI_xml">
+                <xsl:with-param name="TERC_WOJ_POW_GMI_xml" select="$TERC_WOJ_POW_GMI_xml" />
+                <xsl:with-param name="SIMC_SYM_SYMPOD_xml" select="$SIMC_SYM_SYMPOD_xml"/>
+                <xsl:with-param name="ULIC_SYM_xml" select="$ULIC_SYM_xml"/>
+            </xsl:call-template>-->
+        <xsl:result-document href="../public_instance.xml/teryt.gov.pl/TERYT_after_main.xml">
+            <xsl:apply-templates mode="TERC_WOJ_POW_GMI_xml_main" select="$TERC_WOJ_POW_GMI_xml_main:main">
+                <xsl:with-param name="TERC_WOJ_POW_GMI_xml" select="$TERC_WOJ_POW_GMI_xml" />
+                <xsl:with-param name="SIMC_SYM_SYMPOD_xml" select="$SIMC_SYM_SYMPOD_xml"/>
+                <xsl:with-param name="ULIC_SYM_xml" select="$ULIC_SYM_xml"/>
+            </xsl:apply-templates>
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+    <xsl:template match="TERC_WOJ_POW_GMI_xml_main:main" mode="TERC_WOJ_POW_GMI_xml_main">
+        <TERYT_terc_xml_import_after_main:after_main xmlns:TERYT_terc_xml_import_after_main="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/TERYT_terc_xml_import_after_main.xsd">
+            <xsl:for-each select="TERC_WOJ">
+            <TERYT_terc_xml_import_after_main:WOJ xmlns:TERYT_terc_xml_import_after_main="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/TERYT_terc_xml_import_after_main.xsd">
+                <xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."/></xsl:for-each>
+                <xsl:copy-of select="child::*" copy-namespaces="no" />
+                <!-- dorzucam powiaty-->
+                <xsl:variable name="WOJ" select="@WOJ"/>
+                <xsl:for-each select="/TERC_WOJ_POW_GMI_xml_main:main/TERC_POW[@WOJ=$WOJ]">
+                    <TERYT_terc_xml_import_after_main:POW><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                        <xsl:copy-of select="child::*" copy-namespaces="no"/>
+                        <!-- dorzucam gminy -->
+                        <xsl:variable name="POW" select="@POW"/>
+                        <xsl:for-each select="/TERC_WOJ_POW_GMI_xml_main:main/TERC_GMI[@WOJ=$WOJ and @POW=$POW and @GMI='01']">
+                            <TERYT_terc_xml_import_after_main:GMI><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                                <xsl:copy-of select="child::*" copy-namespaces="no"/>
+                                <!-- dorzucam miejscowosci -->
+                                <xsl:variable name="GMI" select="@GMI"/>
+                                <xsl:for-each select="/TERC_WOJ_POW_GMI_xml_main:main/SIMC_SYM[@WOJ=$WOJ and @POW=$POW and @GMI=$GMI]">
+                                    <xsl:if test="position()&lt;2">
+                                         <TERYT_terc_xml_import_after_main:SYM><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                                             <xsl:copy-of select="child::*" copy-namespaces="no"/>
+                                             <!-- dorzucam ulice dla SYM -->
+                                             <xsl:variable name="SYM" select="@SYM"/>
+                                             <xsl:for-each select="/TERC_WOJ_POW_GMI_xml_main:main/ULIC_SYM[@WOJ=$WOJ and @POW=$POW and @GMI=$GMI and @SYM=$SYM]">
+                                                 <xsl:if test="position()&lt;2">
+                                                 <TERYT_terc_xml_import_after_main:ULIC><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="." exclude-result-prefixes="#all"></xsl:attribute></xsl:for-each>
+                                                     <xsl:copy-of select="child::*" copy-namespaces="no"/>
+                                                 </TERYT_terc_xml_import_after_main:ULIC>
+                                                 </xsl:if>
+                                             </xsl:for-each>
+                                         </TERYT_terc_xml_import_after_main:SYM>
+                                    </xsl:if>
+                                    <!-- dorzucam miejscowosci sympod - ignoruje powiazania SYMPOD -->
+                                    <!--<xsl:variable name="SYM" select="@SYM"/>-->
+                                    <xsl:for-each select="/TERC_WOJ_POW_GMI_xml_main:main/SIMC_SYMPOD[@WOJ=$WOJ and @POW=$POW and @GMI=$GMI]">
+                                        <xsl:if test="position()&lt;2">
+                                        <TERYT_terc_xml_import_after_main:SYMPOD><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                                            <xsl:copy-of select="child::*" copy-namespaces="no"/>
+                                            <!-- dorzucam ulice dla SYMPOD -->
+                                            <xsl:variable name="SYM" select="@GMI"/>
+                                            <xsl:for-each select="/TERC_WOJ_POW_GMI_xml_main:main/ULIC_SYM[@WOJ=$WOJ and @POW=$POW and @GMI=$GMI and @SYM=$SYM]">
+                                                <xsl:if test="position()&lt;2">
+                                                <TERYT_terc_xml_import_after_main:ULIC><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                                                    <xsl:copy-of select="child::*" copy-namespaces="no"/>
+                                                </TERYT_terc_xml_import_after_main:ULIC>
+                                                </xsl:if>
+                                            </xsl:for-each>
+                                        </TERYT_terc_xml_import_after_main:SYMPOD>   
+                                        </xsl:if>
+                                    </xsl:for-each>
+                                </xsl:for-each>
+                            </TERYT_terc_xml_import_after_main:GMI>
+                        </xsl:for-each>
+                    </TERYT_terc_xml_import_after_main:POW>
+                </xsl:for-each>
+            </TERYT_terc_xml_import_after_main:WOJ>
+        </xsl:for-each>
+        </TERYT_terc_xml_import_after_main:after_main>
+    </xsl:template>
+    
+    <xsl:template match="teryt" mode="#all">
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>
+    <xsl:template match="catalog" mode="#all">
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>
+    <xsl:template match="row" mode="TERC">
+                <TERC>
+                    <xsl:for-each select="col">
+                        <xsl:choose>
+                            <xsl:when test="position()=1">
+                                <WOJ><xsl:value-of select="."/></WOJ>
+                            </xsl:when>
+                            <xsl:when test="position()=2">
+                                <POW><xsl:value-of select="."/></POW>
+                            </xsl:when>
+                            <xsl:when test="position()=3">
+                                <GMI><xsl:value-of select="."/></GMI>
+                            </xsl:when>
+                            <xsl:when test="position()=4">
+                                <RODZ><xsl:value-of select="."/></RODZ>
+                            </xsl:when>
+                            <xsl:when test="position()=5">
+                                <TERYT_terc_xml_import_after_main:NAZWA><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:NAZWA>
+                            </xsl:when>
+                            <xsl:when test="position()=6">
+                                <TERYT_terc_xml_import_after_main:NAZDOD><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:NAZDOD>
+                            </xsl:when>
+                            <xsl:when test="position()=7">
+                                <TERYT_terc_xml_import_after_main:STAN_NA><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:STAN_NA>
+                            </xsl:when>
+                        </xsl:choose>
+                    </xsl:for-each>
+                </TERC>
+    </xsl:template>
+    <xsl:template match="row" mode="SIMC">
+        <SIMC>
+            <xsl:for-each select="col">
+                <xsl:choose>
+                    <xsl:when test="position()=1">
+                        <WOJ><xsl:value-of select="."/></WOJ>
+                    </xsl:when>
+                    <xsl:when test="position()=2">
+                        <POW><xsl:value-of select="."/></POW>
+                    </xsl:when>
+                    <xsl:when test="position()=3">
+                        <GMI><xsl:value-of select="."/></GMI>
+                    </xsl:when>
+                    <xsl:when test="position()=4">
+                        <RODZ_GMI><xsl:value-of select="."/></RODZ_GMI>
+                    </xsl:when>
+                    <xsl:when test="position()=5">
+                        <RM><xsl:value-of select="."/></RM>
+                    </xsl:when>
+                    <xsl:when test="position()=6">
+                        <MZ><xsl:value-of select="."/></MZ>
+                    </xsl:when>
+                    <xsl:when test="position()=7">
+                        <TERYT_terc_xml_import_after_main:NAZWA><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:NAZWA>
+                    </xsl:when>
+                    <xsl:when test="position()=8">
+                        <SYM><xsl:value-of select="."/></SYM>
+                    </xsl:when>
+                    <xsl:when test="position()=9">
+                        <SYMPOD><xsl:value-of select="."/></SYMPOD>
+                    </xsl:when>
+                    <xsl:when test="position()=10">
+                        <TERYT_terc_xml_import_after_main:STAN_NA><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:STAN_NA>
+                    </xsl:when>
+                </xsl:choose>
+            </xsl:for-each>
+        </SIMC>
+    </xsl:template>
+    <xsl:template match="row" mode="ULIC">
+        <ULIC>
+            <xsl:for-each select="col">
+                <xsl:choose>
+                    <xsl:when test="position()=1">
+                        <WOJ><xsl:value-of select="."/></WOJ>
+                    </xsl:when>
+                    <xsl:when test="position()=2">
+                        <POW><xsl:value-of select="."/></POW>
+                    </xsl:when>
+                    <xsl:when test="position()=3">
+                        <GMI><xsl:value-of select="."/></GMI>
+                    </xsl:when>
+                    <xsl:when test="position()=4">
+                        <RODZ_GMI><xsl:value-of select="."/></RODZ_GMI>
+                    </xsl:when>
+                    <xsl:when test="position()=5">
+                        <SYM><xsl:value-of select="."/></SYM>
+                    </xsl:when>
+                    <xsl:when test="position()=6">
+                        <SYM_UL><xsl:value-of select="."/></SYM_UL>
+                    </xsl:when>
+                    <xsl:when test="position()=7">
+                        <TERYT_terc_xml_import_after_main:CECHA><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:CECHA>
+                    </xsl:when>
+                    <xsl:when test="position()=8">
+                        <TERYT_terc_xml_import_after_main:NAZWA_1><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:NAZWA_1>
+                    </xsl:when>
+                    <xsl:when test="position()=9">
+                        <TERYT_terc_xml_import_after_main:NAZWA_2><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:NAZWA_2>
+                    </xsl:when>
+                    <xsl:when test="position()=9">
+                        <TERYT_terc_xml_import_after_main:STAN_NA><xsl:value-of select="."/></TERYT_terc_xml_import_after_main:STAN_NA>
+                    </xsl:when>
+                </xsl:choose>
+            </xsl:for-each>
+        </ULIC>
+    </xsl:template>
+    <xsl:template match="ULIC" mode="ULIC_SYM">        
+                <ULIC_SYM>
+                  <!--  <xsl:attribute name="key" select="concat(WOJ,'-',POW,'-',GMI,'-',SYM,'-',SYM_UL)"/>
+                    <xsl:attribute name="rkey" select="concat(WOJ,'-',POW,'-',GMI,'-',SYM)"/>-->
+                    <xsl:attribute name="WOJ" select="WOJ"/>
+                    <xsl:attribute name="POW" select="POW"/>
+                    <xsl:attribute name="GMI" select="GMI"/>
+                    <xsl:attribute name="SYM" select="SYM"/>
+                    <xsl:attribute name="SYM_UL" select="SYM_UL"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:CECHA"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZWA_1"/>
+                    <xsl:if test="TERYT_terc_xml_import_after_main:NAZWA_2/text()"><xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZWA_2"/></xsl:if>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:STAN_NA"/>
+                </ULIC_SYM>
+    </xsl:template>
+    <xsl:template match="SIMC" mode="SIMC_SYM_SYMPOD">        
+        <xsl:choose>
+            <xsl:when test="SYM=SYMPOD">
+                <SIMC_SYM>
+                <!--    <xsl:attribute name="key" select="concat(WOJ,'-',POW,'-',GMI,'-',SYM)"/>
+                    <xsl:attribute name="rkey" select="concat(WOJ,'-',POW,'-',GMI)"/>-->
+                    <xsl:attribute name="WOJ" select="WOJ"/>
+                    <xsl:attribute name="POW" select="POW"/>
+                    <xsl:attribute name="GMI" select="GMI"/>
+                    <xsl:attribute name="SYM" select="SYM"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:RODZ_GMI"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:RM"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:MZ"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZWA"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:STAN_NA"/>
+                </SIMC_SYM>
+            </xsl:when>
+            <xsl:otherwise>
+                <SIMC_SYMPOD>
+                 <!--   <xsl:attribute name="key" select="concat(WOJ,'-',POW,'-',GMI,'-',SYM)"/>
+                    <xsl:attribute name="rkey" select="concat(WOJ,'-',POW,'-',GMI)"/>-->
+                    <xsl:attribute name="WOJ" select="WOJ"/>
+                    <xsl:attribute name="POW" select="POW"/>
+                    <xsl:attribute name="GMI" select="GMI"/>
+                    <xsl:attribute name="SYM" select="SYM"/>
+                    <xsl:attribute name="SYMPOD" select="SYMPOD"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:RODZ_GMI"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:RM"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:MZ"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZWA"/>
+                    <xsl:copy-of select="TERYT_terc_xml_import_after_main:STAN_NA"/>
+                </SIMC_SYMPOD>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template match="TERC" mode="TERC_WOJ">        
+            <xsl:choose>
+                <xsl:when test="POW='' and GMI='' and RODZ=''">
+                    <TERC_WOJ>
+                        <!--<xsl:attribute name="key" select="WOJ"/>-->
+                        <xsl:attribute name="WOJ" select="WOJ"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZWA"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZDOD"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:STAN_NA"/>
+                    </TERC_WOJ>
+                </xsl:when>
+                <xsl:when test=" GMI='' and RODZ=''">
+                    <TERC_POW>
+                        <!--<xsl:attribute name="key" select="concat(WOJ,'-',POW)"/>-->
+                        <!--<xsl:attribute name="rkey" select="WOJ"/>-->
+                        <xsl:attribute name="POW" select="POW"/>
+                        <xsl:attribute name="WOJ" select="WOJ"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZWA"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZDOD"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:STAN_NA"/>
+                    </TERC_POW>
+                </xsl:when>
+                <xsl:otherwise>
+                    <TERC_GMI>
+                      <!--  <xsl:attribute name="key" select="concat(WOJ,'-',POW,'-',GMI)"/>
+                        <xsl:attribute name="rkey" select="concat(WOJ,'-',POW)"/>-->
+                        <xsl:attribute name="POW" select="POW"/>
+                        <xsl:attribute name="WOJ" select="WOJ"/>
+                        <xsl:attribute name="GMI" select="GMI"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZWA"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:NAZDOD"/>
+                        <xsl:copy-of select="TERYT_terc_xml_import_after_main:STAN_NA"/>
+                    </TERC_GMI>
+                </xsl:otherwise>
+            </xsl:choose>
+    </xsl:template>
+    
+    
+    <!--<xsl:template name="TERC_WOJ_POW_GMI_xml">
+        <xsl:param name="TERC_WOJ_POW_GMI_xml" required="yes"/>
+        <xsl:param name="SIMC_SYM_SYMPOD_xml" required="yes"/>
+        <xsl:param name="ULIC_SYM_xml" required="yes"/>
+        <TERC_WOJ_POW_GMI_xml>
+        <xsl:for-each select="$TERC_WOJ_POW_GMI_xml/teryt/TERC_WOJ">
+           <WOJ><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+            <xsl:copy-of select="child::*"/>
+            <!-\- dorzucam powiaty-\->
+            <xsl:variable name="WOJ" select="@WOJ"/>
+            <xsl:for-each select="$TERC_WOJ_POW_GMI_xml/teryt/TERC_POW[@WOJ=$WOJ]">
+                <POW><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                    <xsl:copy-of select="child::*"/>
+                    <!-\- dorzucam gminy -\->
+                    <xsl:variable name="POW" select="@POW"/>
+                    <xsl:for-each select="$TERC_WOJ_POW_GMI_xml/teryt/TERC_GMI[@WOJ=$WOJ and @POW=$POW]">
+                        <GMI><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                            <xsl:copy-of select="child::*"/>
+                            <!-\- dorzucam miejscowosci -\->
+                            <xsl:variable name="GMI" select="@GMI"/>
+                            <xsl:for-each select="$SIMC_SYM_SYMPOD_xml/teryt/SIMC_SYM[@WOJ=$WOJ and @POW=$POW and @GMI=$GMI]">
+                                <SYM><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                                    <xsl:copy-of select="child::*"/>
+                                    <!-\- dorzucam ulice dla SYM -\->
+                                    <xsl:variable name="SYM" select="@SYM"/>
+                                    <xsl:for-each select="$ULIC_SYM_xml/teryt/ULIC_SYM[@WOJ=$WOJ and @POW=$POW and @GMI=$GMI and @SYM=$SYM]">
+                                        <ULIC><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                                            <xsl:attribute name="SYM_UL" select="SYM_UL"/>
+                                            <xsl:copy-of select="child::*"/>
+                                        </ULIC>
+                                    </xsl:for-each>
+                                </SYM>
+                                <!-\- dorzucam miejscowosci sympod - ignoruje powiazania SYMPOD -\->
+                                <!-\-<xsl:variable name="SYM" select="@SYM"/>-\->
+                                <xsl:for-each select="$SIMC_SYM_SYMPOD_xml/teryt/SIMC_SYMPOD[@WOJ=$WOJ and @POW=$POW and @GMI=$GMI]">
+                                <SYMPOD><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                                        <xsl:copy-of select="child::*"/>
+                                        <!-\- dorzucam ulice dla SYMPOD -\->
+                                        <xsl:variable name="SYM" select="@GMI"/>
+                                     <xsl:for-each select="$ULIC_SYM_xml/teryt/ULIC_SYM[@WOJ=$WOJ and @POW=$POW and @GMI=$GMI and @SYM=$SYM]">
+                                            <ULIC><xsl:for-each select="@*"><xsl:attribute name="{name()}" select="."></xsl:attribute></xsl:for-each>
+                                                <xsl:attribute name="SYM_UL" select="SYM_UL"/>
+                                                <xsl:copy-of select="child::*"/>
+                                            </ULIC>
+                                        </xsl:for-each>
+                                    </SYMPOD>    
+                                </xsl:for-each>
+                            </xsl:for-each>
+                        </GMI>
+                    </xsl:for-each>
+                </POW>
+            </xsl:for-each>
+           </WOJ>
+        </xsl:for-each>
+        </TERC_WOJ_POW_GMI_xml>
+        
+        
+        
+    </xsl:template>-->
+    
+    <xsl:template match="*" mode="#all"/>
+    <xsl:template match="text()" mode="#all"/>
+</xsl:stylesheet>

+ 50 - 0
SE/schema/default_db_xml_cache.public/_procesy_gen.xsl

@@ -0,0 +1,50 @@
+<?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:exslt="http://exslt.org/common"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+    <xsl:strip-space elements="*"/>
+    
+
+    <xsl:template match="/">
+      
+          
+        <xsl:element name="root">
+        <xsl:for-each select="root/Proces">
+             
+            <xsl:for-each select="pools">
+              
+                     <xsl:variable name="child">
+                         <xsl:value-of select="child"/>
+                     </xsl:variable> 
+               
+                     <xsl:for-each select="ID_ZASOB">
+                         <xsl:element name="lane">
+                            <xsl:element name="ID_ZASOB">
+                                  <xsl:value-of select="node()"/>
+                              </xsl:element>
+                             <xsl:element name="id_proces_init">
+                                 <xsl:value-of select="$child"/>
+                             </xsl:element>
+                             <xsl:element name="tasks">
+                                 <xsl:for-each select="../../childs">
+                                     <xsl:element name="task">
+                                         <xsl:value-of select="child"/>
+                                     </xsl:element>
+                                 </xsl:for-each>
+                             </xsl:element>
+                             
+                         </xsl:element>   
+                  </xsl:for-each>
+                
+            </xsl:for-each>
+        </xsl:for-each>    
+       
+        </xsl:element>
+   
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 80 - 0
SE/schema/default_db_xml_cache.public/_stanowiska_nazwy_gen_ant.xsl

@@ -0,0 +1,80 @@
+<?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:exslt="http://exslt.org/common"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+    <xsl:strip-space elements="*"/>
+    <xsl:key name="zasob" match="/root/lane/ID_ZASOB" use="." />
+    <!-- <xsl:key name="ID_ZASOB" match="ID" use="." /> -->
+ 
+    <xsl:variable name="zasoby_cache" select="document('CRM_LISTA_ZASOBOW.xml')/data/items/item"/>
+ 
+ 
+    <xsl:template name="get_zasob_desc">
+      <xsl:param name="id_zasob"/>
+      <xsl:for-each select="document('CRM_LISTA_ZASOBOW.xml')/data/items/item[ID=$id_zasob and TYPE='STANOWISKO']">
+        <xsl:element name="zasoby">
+          <xsl:element name="ID_ZASOB">
+              <xsl:value-of select="$id_zasob"/>
+          </xsl:element>
+          <xsl:element name="DESC">
+              <xsl:value-of select="DESC"/>
+          </xsl:element>
+          <xsl:element name="TYPE">
+              <xsl:value-of select="TYPE"/>
+          </xsl:element>
+          <xsl:element name="PATH">
+              <xsl:value-of select="path"/>
+          </xsl:element>
+        </xsl:element>
+      </xsl:for-each>
+  </xsl:template>
+  
+ 
+    
+    
+    
+    <!-- [generate-id()=generate-id(key('ID_ZASOB',.)[1])] -->
+ 
+    
+    <xsl:template name="get_zasob_desc_cached">
+        <xsl:param name="id_zasob"/>
+        <xsl:for-each select="$zasoby_cache[ID=$id_zasob]">  
+            <xsl:element name="zasoby">
+                <xsl:element name="ID_ZASOB">
+                    <xsl:value-of select="$id_zasob"/>
+                </xsl:element>
+                <xsl:element name="DESC">
+                    <xsl:value-of select="DESC"/>
+                </xsl:element>
+                <xsl:element name="TYPE">
+                    <xsl:value-of select="TYPE"/>
+                </xsl:element>
+                <xsl:element name="PATH">
+                    <xsl:value-of select="path"/>
+                </xsl:element>
+            </xsl:element>
+       </xsl:for-each>  
+        
+        
+   </xsl:template>
+    
+    
+    <xsl:template match="/">
+        
+       
+        
+        <!-- [generate-id() = generate-id(key('zasob',.)[1])] -->
+        <xsl:for-each select="/root/lane/ID_ZASOB[generate-id() = generate-id(key('zasob',.)[1])]">
+         <xsl:sort select="."/>
+                  <xsl:element name="curr">
+                      <xsl:value-of select="."/>
+                  </xsl:element>
+                     <xsl:call-template name="get_zasob_desc_cached">
+                          <xsl:with-param name="id_zasob" select="."/>
+                      </xsl:call-template>     
+        </xsl:for-each>
+    </xsl:template>
+</xsl:stylesheet>

+ 165 - 0
SE/schema/default_db_xml_cache.public/ant.xsl

@@ -0,0 +1,165 @@
+<?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:Types__x3A__ant="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd"
+    xmlns:Types__x3A__POPC="https://biuro.biall-net.pl/wfs/default_db/Types/POPC.xsd"
+    xmlns:Types__x3A__wfs="https://biuro.biall-net.pl/wfs/default_db/Types/wfs.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:param name="wget" select="'/opt/local/bin/wget'"/>
+    <xsl:param name="csv2xml" select="'/opt/local/bin/csv2xml'"/>
+    <xsl:param name="curl" select="'/opt/local/bin/curl'"/>
+    <xsl:param name="Types__x3A__wfs:username" required="yes" />
+    <xsl:param name="Types__x3A__wfs:username-pass" required="yes" />
+    
+    
+    <xsl:output indent="yes"/>
+    
+    <!-- template do tworzenia szybkich zorganizowanych skryptow do budowy czegos np sciagania danych wget -->
+    
+    <xsl:template match="project[@basedir and @name and @poprawione_xml_dir]" mode="Types__x3A__ant:project" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <xsl:param name="default" select="'DEFAULT'"/>
+        <xsl:variable name="basedir" select="@basedir"/>
+        <xsl:variable name="name"  select="@name"/>
+         <!-- taski do przetworzenia w templates-->
+        <project basedir="." name="{@name}"  default="{$default}" >
+            <mkdir dir="{$basedir}" />
+            <xsl:if test="@poprawione_xml_dir"><mkdir dir="{@poprawione_xml_dir}" /></xsl:if>
+            <xsl:for-each select="@mkdir">
+                <mkdir dir="{.}"/>
+            </xsl:for-each>
+            <xsl:apply-templates mode="Types__x3A__ant:tasks">
+                <xsl:with-param name="basedir" select="$basedir"/>
+                <xsl:with-param name="poprawione_xml_dir" select="@poprawione_xml_dir"/>
+            </xsl:apply-templates>
+            <xsl:variable name="dependency"><xsl:apply-templates mode="Types__x3A__ant:tasks_dependencies"/></xsl:variable>
+            <!--<debug><xsl:copy-of select="$dependency"></xsl:copy-of></debug>-->
+            <xsl:element name="target">
+                <xsl:attribute name="name" select="$default"/>
+                
+                <xsl:attribute name="depends">
+                    <xsl:for-each select="$dependency//text()">
+                        <xsl:value-of select="."/>
+                        <xsl:if test="position()!=last()">,</xsl:if>
+                    </xsl:for-each>
+                </xsl:attribute>
+                    
+                
+                <echo message="Target complete"/>
+            </xsl:element>
+        </project>
+    </xsl:template>
+    
+    <xsl:template match="project" mode="Types__x3A__ant:project" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <xsl:message terminate="yes">ERROR not all requred attributes set! </xsl:message>
+    </xsl:template>
+    
+    <xsl:template match="wget" mode="Types__x3A__ant:tasks" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <xsl:param name="basedir" select="'.'"/>
+        <target name="{@Target_file}_check">
+            <echo message="Check for {@Target_file}"/>
+            <condition property="{@Target_file}_install" value="AVIABLE" taskname="DEFAULT">
+                <available  type="file" file="{@Target_file}" filepath="{$basedir}"/>
+            </condition>
+        </target>
+        <target name="{@Target_file}_install" unless="{@Target_file}_install">
+            <exec executable="{$wget}" dir="{$basedir}">
+                <arg value="{@Target}"/>
+                <arg value="-O"/>
+                <arg value="{@Target_file}"/>
+            </exec>
+        </target>
+    </xsl:template>
+    
+    <xsl:template match="curl_post_wfst" mode="Types__x3A__ant:tasks" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <xsl:param name="basedir" select="'.'"/>
+        <xsl:param name="poprawione_xml_dir"  required="yes"/>
+        <target name="{@Target_file}_check">
+            <echo message="Check for {@Target_file}"/>
+            <condition property="{@Target_file}_install" value="AVIABLE" taskname="DEFAULT">
+                <available  type="file" file="{@Target_file}" filepath="{$poprawione_xml_dir}"/>
+            </condition>
+        </target>
+        <target name="{@Target_file}_install" unless="{@Target_file}_install">
+            <exec executable="{$curl}" dir="{$basedir}"  failonerror="true">
+                <arg value="-X"/>
+                <arg value="POST"/>
+                <arg value="--user"/>
+                <arg><xsl:attribute name="value" select="concat($Types__x3A__wfs:username,':',$Types__x3A__wfs:username-pass)"/></arg>
+                <arg value="-d"/>
+                <arg value="@{@Target_file}"/>
+                <arg value="{@Target}"/>
+                <!--<arg value="-\-user {$Types__x3A__wfs:username}:{$Types__x3A__wfs:username-pass} "/>-->
+                <arg value="-v"/>
+                <arg value="--insecure"/>
+                <!--<arg value="-O"/>
+                <arg value="{@Target_file}"/>-->
+            </exec>
+            <touch file="{$poprawione_xml_dir}/{@Target_file}"/>
+        </target>
+    </xsl:template>
+    
+    
+    <xsl:template match="csv2xml[@csvfile and @xmlfile ]" mode="Types__x3A__ant:tasks" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <xsl:param name="basedir" select="'.'"/>
+        <xsl:param name="poprawione_xml_dir"  required="yes"/>
+        <target name="{@xmlfile}_csv2xml_check">
+            <echo message="Check for {@xmlfile}"/>
+            <condition property="{@xmlfile}_csv2xml_install" value="AVIABLE" taskname="DEFAULT">
+                <available  type="file" file="{@xmlfile}" filepath="{$basedir}"/>
+            </condition>
+        </target>
+        <target name="{@xmlfile}_csv2xml_install" unless="{@xmlfile}_csv2xml_install">
+            <exec executable="{$csv2xml}" dir="{$basedir}" input="{$basedir}/{@csvfile}" output="{$basedir}/{@xmlfile}"/>         
+            <echo message=" Poprawiam plik XML aby mial znanczik xml oraz element root"/>
+            <concat destfile="{$poprawione_xml_dir}/{@xmlfile}" append="false" encoding="UTF-8" >
+                <string>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+                    &lt;root&gt;</string>
+                <file file="{$basedir}/{@xmlfile}"/>
+                <string>&lt;/root&gt;</string>
+            </concat>
+        </target>
+    </xsl:template>
+    
+    <xsl:template match="csv2xml" mode="Types__x3A__ant:tasks" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <xsl:message terminate="yes">Error not typed all [@csvfile and @xmlfile] attributes to <xsl:copy-of select="."/></xsl:message>
+    </xsl:template>
+    
+    <xsl:template match="wget" mode="Types__x3A__ant:tasks_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+            <xsl:apply-templates select="@*" mode="Types__x3A__ant:tasks_wget_dependencies"/>
+    </xsl:template>
+    <xsl:template match="csv2xml" mode="Types__x3A__ant:tasks_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <xsl:apply-templates select="@*" mode="Types__x3A__ant:tasks_csv2xml_dependencies"/>
+    </xsl:template>
+    
+    <xsl:template match="curl_post_wfst" mode="Types__x3A__ant:tasks_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <xsl:apply-templates select="@*" mode="Types__x3A__ant:tasks_curl_post_wfst_dependencies"/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="Types__x3A__ant:tasks_dependencies  Types__x3A__ant:tasks_wget_dependencies  Types__x3A__ant:tasks_csv2xml_dependencies Types__x3A__ant:tasks_curl_post_wfst_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd"/>
+       
+    <xsl:template match="@Target_file" mode="Types__x3A__ant:tasks_wget_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <dependency><xsl:value-of select="concat(.,'_check')"/></dependency>
+        <dependency><xsl:value-of select="concat(.,'_install')"/></dependency>
+    </xsl:template>
+    <xsl:template match="@Target_file" mode="Types__x3A__ant:tasks_curl_post_wfst_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <dependency><xsl:value-of select="concat(.,'_check')"/></dependency>
+        <dependency><xsl:value-of select="concat(.,'_install')"/></dependency>
+    </xsl:template>
+    <xsl:template match="@xmlfile" mode="Types__x3A__ant:tasks_csv2xml_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd">
+        <dependency><xsl:value-of select="concat(.,'_csv2xml_check')"/></dependency>
+        <dependency><xsl:value-of select="concat(.,'_csv2xml_install')"/></dependency>
+    </xsl:template>
+    
+    
+    <xsl:template match="@*" mode="Types__x3A__ant:tasks_dependencies Types__x3A__ant:tasks_wget_dependencies Types__x3A__ant:tasks_csv2xml_dependencies Types__x3A__ant:tasks_curl_post_wfst_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd"/>
+        
+    <xsl:template match="text()" mode="Types__x3A__ant:tasks_dependencies" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/Types/ant.xsd"/>
+    <!--<xsl:template match="*">
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+        </xsl:element>
+    </xsl:template>-->
+    
+</xsl:stylesheet>

+ 154 - 0
SE/schema/default_db_xml_cache.public/crm_lista_zasobow_to_xsd.xsl

@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output indent="yes" method="xml" omit-xml-declaration="no"/>
+    <xsl:key name="TYPE_UNIQ" match="items" use="item/TYPE" />
+    
+    
+    <xsl:variable name="tree_begin" select="'27'"/>
+    
+    <!-- proba zrobienia xsd na podstawie zasobow do pracy na modelerze 2015-01-18 
+     drzewo budujemy od ID=27 - BIALL-NET
+     
+      jedzie po CRM_LISTA_ZASOBOW i doszukuje sie istniejacych typow z XSD i je podstawia - Developperskie cos do testow.
+     
+    -->
+    
+    
+       <!-- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+        xmlns:CRM_LISTA_ZASOBOW="http://biuro.biall-net.pl/xmlschema_procesy5/objects/CRM_LISTA_ZASOBOW.xsd"
+        targetNamespace="http://biuro.biall-net.pl/xmlschema_procesy5/objects/CRM_LISTA_ZASOBOW.xsd">
+        -->
+    
+    
+        <xsl:template match="/data/items">
+            <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+                xmlns:default_CRM_LISTA_ZASOBOW="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/CRM_LISTA_ZASOBOW.xsd"
+                xmlns:default_default_objects_types="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/default_objects_types.xsd"
+                targetNamespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/CRM_LISTA_ZASOBOW.xsd"
+                vc:minVersion="1.1" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
+                <xs:import
+                    namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/default_objects_types.xsd"
+                    schemaLocation="../default_objects/default_objects_types.xsd"/>
+                
+                <xsl:call-template name="base_types_from_schema"/>
+                      <xsl:call-template name="find_tree">
+                           <xsl:with-param name="tree_id" select="$tree_begin"/>
+                       </xsl:call-template>
+                  
+            </xs:schema>
+        </xsl:template>
+    <!--this template makes base types from data being used - and sometimes can forget about some types if they are not in table 
+    
+    <xsl:template name="base_types">
+       <xsl:for-each-group select="item[TYPE!='']" group-by="TYPE">
+                   <xsl:variable name="name" select="TYPE"/>
+                   <xsl:variable name="name_with_ext" select="concat('default_default_objects_types:',TYPE)"/>
+            <xs:complexType name="{$name}">
+                <xs:complexContent>
+                    <xs:extension base="{$name_with_ext}"/>
+                </xs:complexContent>
+            </xs:complexType>            
+        </xsl:for-each-group>
+       </xsl:template> 
+                                                                -->
+    <!-- this template make simple types from schema -->
+    
+    <xsl:template name="base_types_from_schema">
+    
+        <xsl:for-each select="document('../../test-xsd-from-db/default_db/crm_lista_zasobow.xsd')/xs:schema/xs:simpleType/xs:restriction/xs:enumeration[../../@name='TYPE']" >
+            <xsl:choose>
+                <xsl:when test="string-length(@value)=0">
+                    <xs:complexType name="UNKNOWN">
+                        <xs:complexContent>
+                            <xs:extension base="default_default_objects_types:UNKNOWN"/>
+                        </xs:complexContent>
+                    </xs:complexType>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:variable name="name" select="@value"/>
+                    <xs:complexType name="{$name}">
+                        <xs:complexContent>
+                            <xsl:choose>
+                                <xsl:when test="string-length(@value)>0">
+                                    <xsl:variable name="name_with_ext" select="concat('default_default_objects_types:',@value)"/>
+                                    <xs:extension base="{$name_with_ext}"/>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xs:extension base="default_default_objects_types:UNKNOWN"/>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xs:complexContent>
+                    </xs:complexType>
+                </xsl:otherwise>
+            </xsl:choose>
+           
+           
+          
+             
+           
+                        
+        </xsl:for-each>
+    </xsl:template>
+    
+
+
+                   <xsl:template name="find_tree">
+                       <xsl:param name="tree_id"/>
+                          <xsl:comment>Wyzwolono find_tree z arg <xsl:value-of select="$tree_id"/></xsl:comment>
+                          
+ 
+                       <xsl:for-each select="/data/items/item[ID=$tree_id and ID>0 and ID!=14]">
+                              
+                              <xsl:variable name="base_el_name" select="concat('p5_',ID)"/>
+                           <xsl:variable name="ext_base" select="concat('default_default_objects_types:',TYPE)"/>
+                              <xs:complexType name="{$base_el_name}">
+                                  <xs:annotation>
+                                      <xs:documentation><xsl:value-of select="concat( ID,' ',path)"/></xs:documentation>
+                                  </xs:annotation>
+                                  <xs:complexContent>   
+                                      <xs:extension base="{$ext_base}">
+                                          <xs:sequence>
+                                                    <xsl:call-template name="find_child">
+                                                        <xsl:with-param name="ID" select="ID"/>
+                                                    </xsl:call-template>
+                                          </xs:sequence>
+                                      </xs:extension>
+                                  </xs:complexContent>
+                              </xs:complexType>
+                              <!-- dogenerowanie struktur dzieci -->
+                              <xsl:variable name="ID_do_parent" select="ID"/>
+                              <xsl:comment>Dodaje strukture dzieci dla parent<xsl:value-of select="$ID_do_parent"/>
+                              </xsl:comment>
+                              
+                              <xsl:for-each select="../../items/item[PARENT_ID=$ID_do_parent]" >
+                                  <xsl:comment>Bede wyzwalac template dla argumentu <xsl:value-of select="ID"/></xsl:comment>
+                                 <xsl:call-template name="find_tree">
+                                      <xsl:with-param name="tree_id" select="ID"/>
+                                  </xsl:call-template>
+                              </xsl:for-each> 
+                          </xsl:for-each>
+                   </xsl:template>
+    
+    
+    
+                   <xsl:template name="find_child">
+                       <xsl:param name="ID"/>
+                       <xsl:variable name="base_el_name" select="concat('p5_',$ID)"/>
+                       <xsl:variable name="ext_base" select="concat('default_default_objects_types:',TYPE)"/>
+                                               <xsl:for-each select="../item[PARENT_ID=$ID]">
+                                                   
+                                                   <xsl:variable name="el_name" select="concat('p5_',ID)"/>
+                                                   <xsl:variable name="el_name_type" select="concat('default_CRM_LISTA_ZASOBOW:p5_',ID)"/>
+                                                   <xs:element name="{$el_name}" type="{$el_name_type}">
+                                                        <xs:annotation>
+                                                            <xs:documentation><xsl:value-of select="concat( ID,' ',path)"/></xs:documentation>
+                                                       </xs:annotation> 
+                                                   </xs:element>
+                                               </xsl:for-each>
+                   </xsl:template>
+      
+   <!-- </xs:schema> -->
+</xsl:stylesheet>

+ 137 - 0
SE/schema/default_db_xml_cache.public/crm_proces_parse.xsl

@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+   
+   
+   
+   
+    <xsl:template name="detect_tree_or_init">
+        <xsl:param name="get_proces_tree_id"/>
+        <xsl:for-each select="/data/items/item[ID=$get_proces_tree_id]">
+              <xsl:choose>
+                  <xsl:when test="TYPE='PROCES_INIT'">
+                      <xsl:call-template name="crm_proces_parse">
+                          <xsl:with-param name="get_proces_tree_id" select="ID"/>
+                      </xsl:call-template>
+                  </xsl:when>
+                  <xsl:otherwise>
+                      <xsl:call-template name="detect_tree_proces">
+                          <xsl:with-param name="get_proces_tree_id" select="ID"/>
+                      </xsl:call-template>
+                  </xsl:otherwise>
+              </xsl:choose>
+        </xsl:for-each>
+    </xsl:template>
+    
+    
+    <xsl:template name="detect_tree_proces">
+        <xsl:param name="get_proces_tree_id"/>        
+        <dtp><xsl:value-of select="$get_proces_tree_id"/></dtp>
+        
+        <xsl:for-each select="/data/items/item[PARENT_ID=$get_proces_tree_id]">
+            <xsl:choose>
+                <xsl:when test="TYPE='PROCES_INIT'">
+                    <xsl:call-template name="crm_proces_parse">
+                        <xsl:with-param name="get_proces_tree_id" select="ID"/>
+                    </xsl:call-template>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:call-template name="detect_tree_proces">
+                        <xsl:with-param name="get_proces_tree_id" select="ID"/>
+                    </xsl:call-template>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:for-each>
+    </xsl:template>
+    
+    
+   
+    
+    <!-- template do pierwszego przerobienia procesow do optymalizacji wykrycia pools -->
+    <xsl:template name="crm_proces_parse">
+        <xsl:param name="get_proces_tree_id"/>
+        <xsl:element name="root">
+            <!-- <xsl:for-each select="/data/items/item[TYPE='PROCES_INIT' and A_STATUS!='DELETED']"> -->
+            <xsl:for-each select="/data/items/item[ID=$get_proces_tree_id]">    
+                <xsl:sort select="concat(PARENT_ID,SORT_PRIO)"/>
+                <xsl:if test="TYPE = 'PROCES_INIT'">
+                    <!-- znajdujemy proces , teraz trzeba pozbierac kroki -->
+                    
+                    <xsl:element name="Proces">
+                        <_temp_position_proces_parse><xsl:value-of select="position()"/></_temp_position_proces_parse>
+                        <xsl:element name="Proces_id">
+                            <xsl:value-of select="ID"/> 
+                        </xsl:element>
+                        <xsl:element name="pools">
+                            <xsl:element name="child">
+                                <xsl:value-of select="ID"/>
+                            </xsl:element> 
+                            
+                            <xsl:call-template name="Pools">
+                                <xsl:with-param name="proces_id" select="ID"/>
+                            </xsl:call-template> 
+                        </xsl:element>
+                        <xsl:element name="childs">
+                            <xsl:element name="child">
+                                <xsl:value-of select="ID"/>
+                            </xsl:element> 
+                            <xsl:element name="TYPE">
+                             <xsl:value-of select="TYPE"/>
+                            </xsl:element> 
+                            <xsl:element name="PARENT_ID">
+                                <xsl:value-of select="PARENT_ID"/>
+                            </xsl:element> 
+                            <xsl:element name="DESC">
+                                <xsl:value-of select="DESC"/>
+                            </xsl:element>
+                            <xsl:element name="incoming_name">
+                                <xsl:value-of select="concat('startEvent_',ID)"/>
+                            </xsl:element> 
+                            <xsl:element name="outgoing_name">
+                                <xsl:value-of select="concat('Task_',ID)"/>
+                            </xsl:element> 
+                            <xsl:element name="StartEvent">
+                                <xsl:value-of select="concat('startEvent_',ID)"/>
+                            </xsl:element>
+                            <xsl:element name="TaskName">
+                                <xsl:value-of select="concat('startEvent_',ID)"/>
+                            </xsl:element>
+                            <xsl:element name="TaskName">
+                                <xsl:value-of select="concat('Task_',ID)"/>
+                            </xsl:element>
+                            <xsl:element name="Task">
+                                <xsl:value-of select="concat('Task_',ID)"/>
+                            </xsl:element>
+                            <xsl:element name="SORT_PRIO">
+                                <xsl:value-of select="SORT_PRIO"/>
+                            </xsl:element>
+                            <xsl:element name="current">
+                                <xsl:value-of select="position()"/>
+                            </xsl:element>
+                            <xsl:call-template name="detect_outgoing">
+                                <xsl:with-param name="proces_id" select="ID"/>
+                                <xsl:with-param name="parent_id" select="PARENT_ID"/>
+                                <xsl:with-param name="current_sort_prio" select="SORT_PRIO"/>
+                                <xsl:with-param name="position" select="1"/>
+                            </xsl:call-template>
+                            <xsl:call-template name="Pools">
+                                <xsl:with-param name="proces_id" select="ID"/>
+                            </xsl:call-template> 
+                        </xsl:element>
+                        
+                        <xsl:call-template name="find_child_proces">
+                            
+                            <xsl:with-param name="proces_id" select="ID"/>
+                            <xsl:with-param name="count" select="50"/>
+                            
+                        </xsl:call-template>
+                    </xsl:element>
+                </xsl:if>
+            </xsl:for-each>
+        </xsl:element>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 201 - 0
SE/schema/default_db_xml_cache.public/escaped_html_to_xml.xsl

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

+ 226 - 0
SE/schema/default_db_xml_cache.public/find_child_proces.xsl

@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    <xsl:template name="detect_outgoing">
+        <xsl:param name="proces_id"/>
+        <xsl:param name="parent_id"/>
+        <xsl:param name="current_sort_prio"/>
+        <xsl:param name="position"/>
+       
+      
+       
+        <!--
+    Przygotowanie struktury procesow pod widok bpmn
+    IF proces nie ma dziecka
+      IF proces ma kolejny proces
+         OUTPUT=kolejny proces
+      ELSE
+         OUTPUT=end_event
+    ELSE output=dziecko
+    
+    -->
+        
+            <xsl:variable name="outgoings">
+                        <xsl:choose>
+                            <!-- IF proces nie ma dziecka -->
+                            <xsl:when test="not (../item[PARENT_ID=$proces_id])">
+                                
+                                <xsl:choose>
+                                    <!-- IF proces ma kolejny proces nizej -->
+                                    <xsl:when test="../item[PARENT_ID=$parent_id][$position+1]">
+                                        <!-- out=kolejny proces -->
+                                        <xsl:variable name="position_next" select="$position+1"/>
+                                        <xsl:for-each select="../item[PARENT_ID=$parent_id]">
+                                            <xsl:if test="position()=$position+1"> <!-- bug xslt nie mozna zrobic selecta z position! -->
+                                              
+                                              
+                                                    <xsl:element name="outgoing_id">
+                                                        <xsl:value-of select="ID"/>
+                                                    </xsl:element>
+                                                    <xsl:element name="outgoing_name">
+                                                        <xsl:value-of select="concat('Task_',ID)"/>
+                                                    </xsl:element>
+                                                
+                                                
+                                            </xsl:if>
+                                            
+                                        </xsl:for-each>
+                                        
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <!-- out=end event -->
+                                        
+                                            <xsl:element name="outgoing_name">
+                                                <xsl:value-of select="concat('EndEvent_',$proces_id)"/>
+                                            </xsl:element>
+                                        
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                            </xsl:when>
+                            <xsl:otherwise>
+                           <!-- out=dziecko -->
+                           
+                           <xsl:for-each select="../item[PARENT_ID=$proces_id and position()>$position ]">
+                              
+                                   <xsl:element name="outgoing_id">
+                                       <xsl:value-of select="ID"/>
+                                   </xsl:element>
+                                   <xsl:element name="outgoing_name">
+                                       <xsl:value-of select="concat('Task_',ID)"/>
+                                   </xsl:element>
+                               
+                           </xsl:for-each>
+                           
+                           <!-- TODO this is bug of engine?!? 
+                               <xsl:element name="outgoing">
+                               <xsl:value-of select="../item/ID[../PARENT_ID=$proces_id ]  [1]"/>
+                           </xsl:element>
+                           -->
+                       </xsl:otherwise>
+                   </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="GOTO_event">
+                      <xsl:for-each select="../item[ID=$proces_id and IF_TRUE_GOTO!='' and IF_TRUE_GOTO!=0 and IF_TRUE_GOTO!='0']"  xpath-default-namespace="">
+                          <xsl:element name="IF_TRUE_GOTO">
+                              <xsl:element name="GOTO_ID">
+                                  <xsl:value-of select="IF_TRUE_GOTO"/>
+                              </xsl:element>
+                              <xsl:element name="IF_TRUE_GOTO_FLAG">
+                                  <xsl:value-of select="IF_TRUE_GOTO_FLAG"/>
+                              </xsl:element>
+                            
+                              <xsl:variable name="IF_TRUE_GOTO" select="IF_TRUE_GOTO"/>
+                          <!-- wykrycie czy goto idzie do proces_init czy do kroku procesu -->
+                              <xsl:for-each select="../../items/item[ID=$IF_TRUE_GOTO]">
+                                  <xsl:element name="GOTO_NEXT_PROCES_TYPE">
+                                      <xsl:value-of select="TYPE"/>
+                                  </xsl:element>
+                                  <xsl:element name="outgoing_name">
+                                       <xsl:choose>
+                                           <xsl:when test="TYPE='PROCES_INIT'">
+                                                   <xsl:value-of select="concat('StartEvent_',$IF_TRUE_GOTO)"/>
+                                           </xsl:when>
+                                           <xsl:otherwise>
+                                               <xsl:value-of select="concat('Task_',$IF_TRUE_GOTO)"/>
+                                           </xsl:otherwise>
+                                       </xsl:choose>
+                                  </xsl:element>
+                                 
+                              </xsl:for-each>
+                          </xsl:element>
+                      </xsl:for-each>
+              </xsl:variable>
+    
+            <xsl:choose>
+                <xsl:when test="$outgoings/outgoing_id">
+                    <xsl:copy-of select="$outgoings/*"/>
+                    <xsl:copy-of select="$GOTO_event/*"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:choose>
+                        <xsl:when test="$GOTO_event/IF_TRUE_GOTO">
+                            <xsl:copy-of select="$GOTO_event/*"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <!-- jest koniec procesu -->
+                            <xsl:copy-of select="$outgoings/outgoing_name"/>
+                            <xsl:element name="EndEvent">
+                                <xsl:value-of select="$outgoings/outgoing_name"/>
+                            </xsl:element>
+                            <xsl:element name="TaskName">
+                                <xsl:value-of select="$outgoings/outgoing_name"/>
+                            </xsl:element>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:otherwise>
+            </xsl:choose>
+        
+            <xsl:choose>
+            <xsl:when test="$GOTO_event/IF_TRUE_GOTO/GOTO_NEXT_PROCES_TYPE='PROCES'">
+                <xsl:element name="outgoing_id">
+                    <xsl:value-of select="$GOTO_event/IF_TRUE_GOTO/GOTO_ID"/>
+                </xsl:element>
+                <xsl:element name="outgoing_name">
+                    <xsl:value-of select="concat('Task_',$GOTO_event/IF_TRUE_GOTO/GOTO_ID)"/>
+                </xsl:element>
+            </xsl:when>
+            <xsl:when test="$GOTO_event/IF_TRUE_GOTO/GOTO_NEXT_PROCES_TYPE='PROCES_INIT'">
+                <xsl:element name="outgoing_id">
+                    <xsl:value-of select="$GOTO_event/IF_TRUE_GOTO/GOTO_ID"/>
+                </xsl:element>
+                <xsl:element name="outgoing_name">
+                    <xsl:value-of select="concat('StartEvent_',$GOTO_event/IF_TRUE_GOTO/GOTO_ID)"/>
+                </xsl:element>
+            </xsl:when>
+        </xsl:choose>
+   
+    </xsl:template>
+    
+    
+   
+    <xsl:template name="find_child_proces">
+        <xsl:param name="proces_id" />
+        <xsl:param name="count"/>
+        
+       
+        <xsl:choose>
+            <xsl:when test="$count > 0">
+                
+                <xsl:for-each select="/data/items/item[TYPE='PROCES' and A_STATUS!='DELETED' and PARENT_ID=$proces_id]">
+                <xsl:sort select="concat(PARENT_ID,SORT_PRIO)"/>
+                    <!--<xsl:text>&#xa;</xsl:text>-->                 
+                    <xsl:element name="childs">
+                      
+                        <xsl:call-template name="detect_outgoing">
+                            <xsl:with-param name="proces_id" select="ID"/>
+                            <xsl:with-param name="parent_id" select="PARENT_ID"/>
+                            <xsl:with-param name="current_sort_prio" select="SORT_PRIO"/>
+                            <xsl:with-param name="position" select="position()"/>
+                        </xsl:call-template>
+                        
+                        <xsl:element name="DESC">
+                            <xsl:value-of select="DESC"/>
+                        </xsl:element>
+                        <xsl:element name="child">
+                            <xsl:value-of select="ID"/>
+                        </xsl:element>
+                        <xsl:element name="Task">
+                            <xsl:value-of select="concat('Task_',ID)"/>
+                        </xsl:element>
+                        <xsl:element name="TaskName">
+                            <xsl:value-of select="concat('Task_',ID)"/>
+                        </xsl:element>
+                        <xsl:element name="PARENT_ID">
+                            <xsl:value-of select="PARENT_ID"/>
+                        </xsl:element>
+                        <xsl:element name="incoming_name">
+                            <xsl:value-of select="concat('Task_',PARENT_ID)"/>
+                        </xsl:element> 
+                        <xsl:element name="SORT_PRIO">
+                            <xsl:value-of select="SORT_PRIO"/>
+                        </xsl:element>
+                        <xsl:element name="current_root">
+                            <xsl:value-of select="position()"/>
+                        </xsl:element>
+                        
+                        <xsl:call-template name="Pools">
+                            <xsl:with-param name="proces_id" select="ID"/>
+                        </xsl:call-template>      
+                    </xsl:element>
+                    <xsl:call-template name="find_child_proces">
+                        <xsl:with-param name="proces_id" select="ID"/>
+                        <xsl:with-param name="count" select="$count - 1"/>
+                    </xsl:call-template>
+                </xsl:for-each>
+                
+            </xsl:when>
+            <xsl:otherwise>
+                Error in loop!!!(<xsl:value-of select="$count"/>)
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+</xsl:stylesheet>

+ 92 - 0
SE/schema/default_db_xml_cache.public/import_resource_table_xml_from_api.xsl

@@ -0,0 +1,92 @@
+<?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:exslt="http://exslt.org/common"
+    exclude-result-prefixes="xs exslt"
+    version="2.0">
+    
+    <!-- @2017-01 TODO do przerobienia  na nowe api wfst i ant -->
+    
+    <!--  Stylesheet do importu tabel bazy default_db na podstawie API
+        http://biuro.biall-net.pl/SE/se-dev-api/api.php/xml/table/default_db/{tabela}/items
+        or https://biuro.biall-net.pl/SE/se-dev-api/api.php/xml/table/default_db/TEST_PERMS/item/1 
+        Domyslnie system cachuje tabele w katalogu public_html/{db_prefix}.instance.xml
+        
+        Możliwy do wykorzystywania w innych stylesheetach. 
+        Wymaga wyzwolenia template 
+            import_resource_table_xml_from_api
+               param  api_url eg. 'https://biuro.biall-net.pl'
+               param  db_name_prefix  eg. 'default_db'
+               param  resource   eg. 'TELBOXES' - name of resource (table) to import
+               //param  item_id  eg. 1  - will fetch single object (@2015-04-04 todo NOT WORKING)
+               param  cache eg. 'read','refresh' - to read or refresh result from cache folder (public_html/$db_name_prefix)
+               
+               
+               autor Arkadiusz Binder
+    -->
+    
+    <xsl:import href="file_cache.xsl"/>
+    
+    <xsl:output indent="yes" method="xml"/>
+    
+    <xsl:param name="api_url" select="'https://biuro.biall-net.pl'"/>
+    
+    <xsl:template name="main">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'refresh'"/>
+            <xsl:with-param name="resource" select="'BILLING_OWNER'"/>
+        </xsl:call-template>
+    </xsl:template>
+    
+    
+    <xsl:template name="import_resource_table_xml_from_api">
+        <xsl:param name="api_url" select="$api_url"/>
+        <xsl:param name="db_name_prefix" select="'default_db'"/>
+        <xsl:param name="resource"  select="'CRM_LISTA_ZASOBOW'" required="no"/>
+        <xsl:param name="xpath"/> <!-- optional filter with xpath -->
+        <xsl:param name="cache" select="'read'"/>
+        
+        <xsl:param name="item_id" />
+        <xsl:choose>
+            <xsl:when test="$item_id">
+                <!-- TODO napisac definicje sciagania pojedynczego obiektu z /table/item/$item_id  @2015-04-04-->
+            </xsl:when>
+            
+            <xsl:otherwise>
+                
+                <xsl:variable name="URL" select="concat($api_url,'/SE/version-git/api.php/xml/table/',$db_name_prefix,'/',$resource,'/items')"/>
+                <xsl:variable name="FILE_URL" select="concat('../',$db_name_prefix,'.instance.xml/',$resource,'.xml')"/>
+                <xsl:message>45: jade file_cache dla URL<xsl:value-of select="$URL"/></xsl:message>
+                <xsl:call-template name="file_cache">
+                    <xsl:with-param name="FILE_URL" select="$FILE_URL"/>
+                    <xsl:with-param name="URL" select="$URL"/>
+                    <xsl:with-param name="cache" select="$cache"/>
+                    <xsl:with-param name="xpath" select="$xpath"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="write_resource_table_xml_to_api">
+        <xsl:param name="api_url" select="'https://biuro.biall-net.pl'"/>
+        <xsl:param name="db_name_prefix" select="'default_db'"/>
+        <xsl:param name="resource" required="yes"/>
+        <xsl:param name="INSERT_OBJ" required="yes"/>  <!-- xml z zawartoscia obiektu do wgrania np. @system_cache__appinfo:ID, @system_cache__appinfo:PARENT_ID, @system_cache__appinfo:VALUE , @system_cache__appinfo:REMOTE_ID -->
+        <xsl:choose>
+            <xsl:when test="false()">
+                
+            </xsl:when>
+            
+            <xsl:otherwise>
+                <xsl:variable name="URL" select="concat($api_url,'/SE/se-dev-api/api.php/xml/table/',$db_name_prefix,'/',$resource,'/items')"/>
+                <xsl:call-template name="file_cache">
+                    <xsl:with-param name="URL" select="$URL"/>
+                    <xsl:with-param name="cache" select="'write'"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    
+</xsl:stylesheet>

+ 206 - 0
SE/schema/default_db_xml_cache.public/procesy5_to_bpmn.xsl

@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0"
+    xmlns:p5tobpmn="http://biuro.biall-net.pl/xmlschema_procesy5/objects/procesy5_to_bpmn.xsl" >
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+<!--
+<xsl:key name="proc_id" match="data/items/item" use="ID"/>
+<xsl:key name="proc_pid" match="data/items/item" use="PARENT_ID"/>
+<xsl:key name="PROCES_INIT" match="data/items/item" use="TYPE"/>
+-->
+<!-- <xsl:namespace-alias stylesheet-prefix="" result-prefix=""/> -->
+<!-- funkcja do znalezienia dziecka procesu, uzywana rekursywnie -->
+<!-- <xsl:function name="p5tobpmn:find_child_proces">
+        <xsl:param name="proces_list"/>
+        <xsl:param name="proces_id"/>
+        <xsl:variable name="myArray">
+                <xsl:for-each select="$proces_list">
+                    <item><xsl:value-of select="." /></item>
+                </xsl:for-each>
+        </xsl:variable>
+        <xsl:value-of select="$myArray"/>    
+</xsl:function>
+-->
+<!-- template do znalezienia dziecka procesu, test -->
+<xsl:template name="find_child_proces">
+        <xsl:param name="proces_id" />
+        <xsl:param name="count"/>
+        <xsl:choose>
+            <xsl:when test="$count > 0">
+              
+                <xsl:for-each select="document('CRM_PROCES.xml')/data/items/item/ID[../TYPE='PROCES' and ../A_STATUS!='DELETED' and ../PARENT_ID=$proces_id]">
+                 <!--<xsl:text>&#xa;</xsl:text>-->                 
+                    <xsl:element name="childs">
+                        <xsl:element name="child">
+                          <xsl:value-of select="."/>
+                        </xsl:element>
+                    
+                        <xsl:variable name="proces_id" select="."/>
+                         <xsl:call-template name="Pools">
+                           <xsl:with-param name="proces_id" select="."/>
+                         </xsl:call-template>      
+                    </xsl:element>
+                    <xsl:call-template name="find_child_proces">
+                      <xsl:with-param name="proces_id" select="."/>
+                      <xsl:with-param name="count" select="$count - 1"/>
+                    </xsl:call-template>
+            </xsl:for-each>
+            
+        </xsl:when>
+            <xsl:otherwise>
+               Error in loop!!!(<xsl:value-of select="$count"/>)
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+<!--    <xsl:template match="/">
+        <xsl:call-template name="procesy"/>
+    </xsl:template>
+    -->
+    <!-- Template do zadeklarowania basenow - czyli stanowisk z procesow -->
+    <xsl:template name="Pools">
+        <xsl:param name="proces_id" />
+        <xsl:for-each select="document('CRM_WSKAZNIK.xml')/data/items/item[A_STATUS!='DELETED' and ID_PROCES=$proces_id]">
+            <xsl:element name="ID_ZASOB">
+                <xsl:value-of select="ID_ZASOB"/>
+            </xsl:element>
+            <!--
+            <xsl:call-template name="Stanowiska_name">
+                <xsl:with-param name="id_zasob" select="ID_ZASOB"/>
+            </xsl:call-template>
+            -->
+        </xsl:for-each>
+    </xsl:template>
+    <!-- przyklad  <lane id="PO_p342" name="Typowe Stanowisko Obieg Dok"> -->
+    <!--   <xsl:template name="Stanowiska_name">       
+        <xsl:param name="id_zasob"/>
+       
+            <xsl:for-each select="document('CRM_LISTA_ZASOBOW.xml')/data/items/item[A_STATUS!='DELETED' and ID=$id_zasob and TYPE='STANOWISKO']">
+                <xsl:element name="lane">
+                    <xsl:attribute name="id">
+                        <xsl:value-of select="concat('CRM_LISTA_ZASOBOW_',ID)"/>    
+                    </xsl:attribute>
+                    <xsl:attribute name="name">
+                        <xsl:value-of select="DESC"/>    
+                    </xsl:attribute>       
+                </xsl:element>
+            </xsl:for-each>
+    </xsl:template>
+    -->
+    <xsl:template match="/">
+        <!-- <xsl:variable name="foldername" select="concat(/build/major, /build/minor, string(/build/build + 1), build/release)"/> -->
+    <!--    <xsl:result-document href="_procesy_gen.xml" method="xml" version="1.0" indent="yes" encoding="UTF-8" omit-xml-declaration="no"> -->
+    <!--    
+        <xsl:element name="definitions">
+            <xsl:attribute name="xsd" namespace="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</xsl:attribute>
+            <xsl:attribute name="xsi" namespace="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</xsl:attribute>
+            <xsl:attribute name="Name">Procesy import z notacji Procesy5 do BPMN</xsl:attribute>
+    -->
+            <!-- xmlns:xsd="http://www.w3.org/2001/XMLSchema" -->
+            <!-- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -->
+            <!-- Name="Uzyskanie zgody na swiadczenie uslug" xmlns="http://www.wfmc.org/2009/XPDL2.2" -->    
+        <!-- Deklarujemy arraya ze wszystkimi procesami ID oraz PARENT_ID -->
+          <!--
+            <xsl:variable name="dzieci_procesow">
+                 <xsl:for-each select="/data/items/item/ID[../A_STATUS!='DELETED' and ../PARENT_ID='994']">
+                    <item><xsl:value-of select="."/></item>
+                 </xsl:for-each>
+             </xsl:variable>
+           -->
+             <!--    <xsl:value-of select="/data/items/item/ID[../A_STATUS!='DELETED' and ../PARENT_ID='994']"/>
+            
+             </xsl:variable>
+             -->
+            <!--
+            <xsl:variable name="dzieci_procesow1" as="element()*">
+                <Item>10</Item>
+                <Item>3</Item>
+               
+            </xsl:variable>
+            -->
+            <!--
+             <collaboration id="COLLABORATION-P_p22">
+        <participant id="PO_p341" processRef="PROCESS-PO_p341" name="Firma">
+            <participantMultiplicity maximum="1" minimum="0"/>
+        </participant></collaboration>
+    <process id="PROCESS-PO_p341" isClosed="false" isExecutable="true" processType="None">
+        <laneSet id="LANESET-PO_p341">
+          <lane id="PO_p342" name="Typowe Stanowisko Obieg Dok">
+            <flowNodeRef>PO_p345</flowNodeRef><flowNodeRef>PO_p355</flowNodeRef>
+            <flowNodeRef>PO_p343</flowNodeRef></lane>
+          <lane id="PO_p366" name="serwis"><flowNodeRef>PO_p368</flowNodeRef></lane>
+         </laneSet>
+        <startEvent id="PO_p343" name="1 - przyjecie pisma"><outgoing>PO_p344</outgoing>
+        </startEvent>
+            
+            -->
+           <!--
+           <xsl:element name="collaboration">
+               <xsl:attribute name="id"><xsl:value-of>COLLABORATION-P_p22</xsl:value-of></xsl:attribute>
+               <xsl:element name="participant">
+                   <xsl:attribute name="id"><xsl:value-of>PO_p341</xsl:value-of></xsl:attribute>
+                   <xsl:attribute name="processRef"><xsl:value-of>PROCESS-PO_p341</xsl:value-of></xsl:attribute>
+               </xsl:element>
+               </xsl:element>  
+             -->
+            <xsl:element name="root">
+            <xsl:for-each select="/data/items/item[TYPE='PROCES_INIT' and A_STATUS!='DELETED']">
+            <!--  <xsl:sort select="idx_PROCES_INIT_ID"/> -->
+            <xsl:if test="TYPE = 'PROCES_INIT'">
+            <!-- znajdujemy proces , teraz trzeba pozbierac kroki -->
+                <!-- <xsl:variable name="dzieci" select="p5tobpmn:find_child_proces($dzieci_procesow,ID)"/> -->
+
+            <!-- Najpierw deklarujemy basen(y) do danego procesu -->
+            <!-- @temp off at 2014-12
+                <xsl:call-template name="Pools">
+                    <xsl:with-param name="proces_id" select="ID"/>
+                </xsl:call-template>        
+                
+                <xsl:text>&#xa;</xsl:text>
+                -->
+                    <xsl:element name="Proces">
+                            <xsl:element name="Proces_id">
+                                <xsl:value-of select="ID"/> 
+                            </xsl:element>
+                        <xsl:element name="pools">
+                            <xsl:element name="child">
+                                <xsl:value-of select="ID"/>
+                            </xsl:element> 
+                            <xsl:call-template name="Pools">
+                                <xsl:with-param name="proces_id" select="ID"/>
+                            </xsl:call-template> 
+                        </xsl:element>
+                            <xsl:element name="childs">
+                                <xsl:element name="child">
+                                    <xsl:value-of select="ID"/>
+                                </xsl:element> 
+                                <xsl:call-template name="Pools">
+                                    <xsl:with-param name="proces_id" select="ID"/>
+                                </xsl:call-template> 
+                            </xsl:element>
+                            
+                            <xsl:call-template name="find_child_proces">
+                            <xsl:with-param name="proces_id" select="ID"/>
+                            <xsl:with-param name="count" select="50"/>
+                         </xsl:call-template>
+                    </xsl:element>
+            </xsl:if>
+        </xsl:for-each>
+        </xsl:element>
+        <!-- </xsl:element> -->
+       <!-- </xsl:result-document> -->
+     <!--   <xsl:call-template name="_procesy_gen"/> -->
+    </xsl:template>
+    <!-- Template do generowania z listy procesow listy stanowisk -->
+    <xsl:template name="_procesy_gen"> 
+   <!--     <xsl:result-document href="_zasoby_to_procesy_gen.xml" method="xml"> -->
+            <xsl:for-each select="document('_procesy_gen.xml')/Proces_id">
+                <xsl:element name="Proces_id" >
+                    <xsl:value-of select="child"/>
+                </xsl:element>
+            </xsl:for-each>
+     <!--   </xsl:result-document> -->
+    </xsl:template>
+</xsl:stylesheet>

+ 138 - 0
SE/schema/default_db_xml_cache.public/procesy_gen_include.xsl

@@ -0,0 +1,138 @@
+<?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:exslt="http://exslt.org/common"
+    exclude-result-prefixes="xs exslt"
+    version="2.0">
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+    <xsl:strip-space elements="*"/>
+    
+  
+    
+    
+    <xsl:template name="task_params">
+        <xsl:element name="EventName">
+            <xsl:value-of select="."/>
+        </xsl:element>
+        <xsl:for-each select="../outgoing_name">
+            <xsl:element name="outgoing">
+             <xsl:value-of select="."/>
+            </xsl:element>
+        </xsl:for-each>
+        <xsl:for-each select="../incoming_name">
+            <xsl:element name="incoming">
+                <xsl:value-of select="."/>
+            </xsl:element>
+        </xsl:for-each>
+    </xsl:template>
+    
+    <xsl:template name="procesy_gen_include">
+      
+          
+        <xsl:element name="root">
+        <xsl:for-each select="root/Proces">
+             
+            <xsl:for-each select="pools">
+              
+                     <xsl:variable name="child">
+                         <xsl:value-of select="child"/>
+                     </xsl:variable> 
+               
+                     <xsl:for-each select="ID_ZASOB[1]">  <!-- TODO zdjac trigger aby dla wszystkich stanowisk sie generowaly-->
+                         <xsl:element name="lane">
+                            <xsl:element name="ID_ZASOB">
+                                  <xsl:value-of select="node()"/>
+                              </xsl:element>
+                             <xsl:element name="id_proces_init">
+                                 <xsl:value-of select="$child"/>
+                             </xsl:element>
+                             <xsl:element name="tasks">
+                                 <xsl:for-each select="../../childs">
+                                     <xsl:element name="task">
+                                         <xsl:value-of select="child"/>
+                                     </xsl:element>
+                                 </xsl:for-each>
+                             </xsl:element>
+                             
+                             <xsl:element name="StartEvents">
+                                 <xsl:for-each select="../../childs/StartEvent">
+                                     <xsl:element name="StartEvent">
+                                            <xsl:element name="DESC">
+                                                <xsl:value-of select="../DESC"/>
+                                            </xsl:element>
+                                            <xsl:element name="EventName">
+                                                <xsl:value-of select="."/>
+                                            </xsl:element>
+                                            <xsl:for-each select="../outgoing_name">
+                                                <xsl:element name="outgoing">
+                                                    <xsl:value-of select="."/>
+                                                </xsl:element>
+                                            </xsl:for-each>
+                                            
+                                     </xsl:element>
+                                 </xsl:for-each>
+                              <!-- wykrycie brakujacych StartEvents z dowiazan poza rysunkiem -->
+                                <xsl:for-each select="../../childs/outgoing_name">
+                                      <xsl:variable name="chk_out_name" select="."/>
+                                      <xsl:choose>
+                                          <xsl:when test="not(../../../Proces/childs[TaskName=$chk_out_name])">
+                                              <xsl:element name="StartEvent">
+                                                  <intermediateCatchEvent/>
+                                                  <xsl:element name="EventName">
+                                                        <xsl:value-of select="$chk_out_name"/>
+                                                  </xsl:element>
+                                                  <xsl:for-each select="../../../Proces/childs[outgoing_name=$chk_out_name]">
+                                                      <xsl:element name="incoming">
+                                                          <xsl:value-of select="Task"></xsl:value-of>
+                                                      </xsl:element>
+                                                  </xsl:for-each>
+                                              </xsl:element>
+                                          </xsl:when>
+                                      </xsl:choose>
+                                </xsl:for-each>
+                             </xsl:element>
+                             <xsl:element name="EndEvents">
+                                 <xsl:for-each select="../../childs/EndEvent">
+                                     <xsl:element name="EndEvent">
+                                         <xsl:element name="EventName">
+                                             <xsl:value-of select="."/>
+                                         </xsl:element>
+                                         <xsl:for-each select="../Task">
+                                             <xsl:element name="incoming">
+                                                 <xsl:value-of select="."/>
+                                             </xsl:element>
+                                         </xsl:for-each>
+                                     </xsl:element>
+                                 </xsl:for-each>
+                             </xsl:element>
+                             <xsl:element name="Tasks">
+                                 <xsl:for-each select="../../childs/Task">
+                                     <xsl:variable name="cur_task_chk" select="."/>
+                                     <xsl:element name="Task">
+                                         <xsl:element name="DESC">
+                                             <xsl:value-of select="../DESC"/>
+                                         </xsl:element>
+                                         <xsl:call-template name="task_params"/>
+                                         <!-- wykrycie przejsc IF_TRUE_GOTO -->
+                                         
+                                         <xsl:for-each select="../../childs/IF_TRUE_GOTO[outgoing_name=$cur_task_chk]">
+                                             <xsl:element name="incoming">
+                                                <xsl:value-of select="../Task"/>
+                                             </xsl:element>
+                                         </xsl:for-each>
+                                         
+                                     </xsl:element>
+                                 </xsl:for-each>
+                             </xsl:element>                             
+                         </xsl:element>   
+                  </xsl:for-each>
+                
+            </xsl:for-each>
+        </xsl:for-each>    
+       
+        </xsl:element>
+   
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 138 - 0
SE/schema/default_db_xml_cache.public/procesy_gen_include_single_proces.xsl

@@ -0,0 +1,138 @@
+<?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:exslt="http://exslt.org/common"
+    exclude-result-prefixes="xs exslt"
+    version="2.0">
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+    <xsl:strip-space elements="*"/>
+    
+  
+    
+    
+    <xsl:template name="task_params_single_proces">
+        <xsl:element name="EventName">
+            <xsl:value-of select="."/>
+        </xsl:element>
+        <xsl:for-each select="../outgoing_name">
+            <xsl:element name="outgoing">
+             <xsl:value-of select="."/>
+            </xsl:element>
+        </xsl:for-each>
+        <xsl:for-each select="../incoming_name">
+            <xsl:element name="incoming">
+                <xsl:value-of select="."/>
+            </xsl:element>
+        </xsl:for-each>
+    </xsl:template>
+    
+    <xsl:template name="procesy_gen_include_single_proces">
+      
+          
+        <xsl:element name="root">
+        <xsl:for-each select="root/Proces">
+             
+            <xsl:for-each select="pools">
+              
+                     <xsl:variable name="child">
+                         <xsl:value-of select="child"/>
+                     </xsl:variable> 
+               
+                     <xsl:for-each select="ID_ZASOB[1]">  <!-- TODO zdjac trigger aby dla wszystkich stanowisk sie generowaly-->
+                         <xsl:element name="lane">
+                            <xsl:element name="ID_ZASOB">
+                                  <xsl:value-of select="node()"/>
+                              </xsl:element>
+                             <xsl:element name="id_proces_init">
+                                 <xsl:value-of select="$child"/>
+                             </xsl:element>
+                             <xsl:element name="tasks">
+                                 <xsl:for-each select="../../childs">
+                                     <xsl:element name="task">
+                                         <xsl:value-of select="child"/>
+                                     </xsl:element>
+                                 </xsl:for-each>
+                             </xsl:element>
+                             
+                             <xsl:element name="StartEvents">
+                                 <xsl:for-each select="../../childs/StartEvent">
+                                     <xsl:element name="StartEvent">
+                                            <xsl:element name="DESC">
+                                                <xsl:value-of select="../DESC"/>
+                                            </xsl:element>
+                                            <xsl:element name="EventName">
+                                                <xsl:value-of select="."/>
+                                            </xsl:element>
+                                            <xsl:for-each select="../outgoing_name">
+                                                <xsl:element name="outgoing">
+                                                    <xsl:value-of select="."/>
+                                                </xsl:element>
+                                            </xsl:for-each>
+                                            
+                                     </xsl:element>
+                                 </xsl:for-each>
+                              <!-- wykrycie brakujacych StartEvents z dowiazan poza rysunkiem -->
+                                <xsl:for-each select="../../childs/outgoing_name">
+                                      <xsl:variable name="chk_out_name" select="."/>
+                                      <xsl:choose>
+                                          <xsl:when test="not(../../../Proces/childs[TaskName=$chk_out_name])">
+                                              <xsl:element name="StartEvent">
+                                                  <intermediateCatchEvent/>
+                                                  <xsl:element name="EventName">
+                                                        <xsl:value-of select="$chk_out_name"/>
+                                                  </xsl:element>
+                                                  <xsl:for-each select="../../../Proces/childs[outgoing_name=$chk_out_name]">
+                                                      <xsl:element name="incoming">
+                                                          <xsl:value-of select="Task"></xsl:value-of>
+                                                      </xsl:element>
+                                                  </xsl:for-each>
+                                              </xsl:element>
+                                          </xsl:when>
+                                      </xsl:choose>
+                                </xsl:for-each>
+                             </xsl:element>
+                             <xsl:element name="EndEvents">
+                                 <xsl:for-each select="../../childs/EndEvent">
+                                     <xsl:element name="EndEvent">
+                                         <xsl:element name="EventName">
+                                             <xsl:value-of select="."/>
+                                         </xsl:element>
+                                         <xsl:for-each select="../Task">
+                                             <xsl:element name="incoming">
+                                                 <xsl:value-of select="."/>
+                                             </xsl:element>
+                                         </xsl:for-each>
+                                     </xsl:element>
+                                 </xsl:for-each>
+                             </xsl:element>
+                             <xsl:element name="Tasks">
+                                 <xsl:for-each select="../../childs/Task">
+                                     <xsl:variable name="cur_task_chk" select="."/>
+                                     <xsl:element name="Task">
+                                         <xsl:element name="DESC">
+                                             <xsl:value-of select="../DESC"/>
+                                         </xsl:element>
+                                         <xsl:call-template name="task_params_single_proces"/>
+                                         <!-- wykrycie przejsc IF_TRUE_GOTO -->
+                                         
+                                         <xsl:for-each select="../../childs/IF_TRUE_GOTO[outgoing_name=$cur_task_chk]">
+                                             <xsl:element name="incoming">
+                                                <xsl:value-of select="../Task"/>
+                                             </xsl:element>
+                                         </xsl:for-each>
+                                         
+                                     </xsl:element>
+                                 </xsl:for-each>
+                             </xsl:element>                             
+                         </xsl:element>   
+                  </xsl:for-each>
+                
+            </xsl:for-each>
+        </xsl:for-each>    
+       
+        </xsl:element>
+   
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 257 - 0
SE/schema/default_db_xml_cache.public/procesy_to_bpmn.xsl

@@ -0,0 +1,257 @@
+<?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:exslt="http://exslt.org/common"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" 
+    xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+    xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" 
+    exclude-result-prefixes="xs exslt xsi"
+    version="2.0">
+   <!-- 
+     
+   
+    xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+     xmlns:ext="http://org.eclipse.bpmn2/ext" -->
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+        
+    
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template name="sequence_gen_from_task">
+       <xsl:for-each select="outgoing">
+          <xsl:element name="bpmn2:sequenceFlow">
+             <xsl:attribute name="id" select="concat(../EventName,'_',.)"/>
+             <xsl:attribute name="sourceRef" select="../EventName"/>
+             <xsl:attribute name="targetRef" select="."/>
+          </xsl:element>
+       </xsl:for-each>
+    </xsl:template>
+   
+    <xsl:template name="procesy_to_bpmn">
+       <xsl:param name="procesy_gen_include"/>
+       <xsl:comment>origin at X=0.0 Y=0.0</xsl:comment>
+       <xsl:element name="bpmn2:definitions">
+          <xsl:namespace name="bpmn2"  select="'http://www.omg.org/spec/BPMN/20100524/MODEL'"/>
+          <xsl:namespace name="bpmndi"  select="'http://www.omg.org/spec/BPMN/20100524/DI'"/>
+          <xsl:namespace name="dc"  select="'http://www.omg.org/spec/DD/20100524/DC'"/>
+          <xsl:namespace name="di"  select="'http://www.omg.org/spec/DD/20100524/DI'"/>
+          <xsl:namespace name="ext"  select="'http://org.eclipse.bpmn2/ext'"/>
+          <xsl:attribute name="id" select="'Definitions_1'"/>
+          <xsl:attribute name="exporter" select="'org.eclipse.bpmn2.modeler.core'"/>
+          <xsl:attribute name="targetNamespace" select="'http://org.eclipse.bpmn2/default/process'"/>
+          <xsl:attribute name="xsi:schemaLocation" select="'http://www.omg.org/spec/BPMN/20100524/MODEL ../system_cache/procesy5_bpmn_cache.xsd'"/>
+          <xsl:element name="bpmn2:collaboration">
+             <xsl:attribute name="id" select="'Collaboration_1'"/>
+             <xsl:attribute name="name" select="'Collaboration 1'"/>
+             <!--  jakis domyslny participant ? do basenu ? -->
+             <xsl:element name="bpmn2:participant">
+                <xsl:attribute name="id" select="'Participant_2'"/>
+                <xsl:attribute name="name" select="'Default Process Pool 1'"/>
+                <xsl:attribute name="processRef" select="'eclipse_basen_event_task_task'"/>
+             </xsl:element>
+             <!-- tutaj trzeba wylistowac baseny stanowiska --> 
+             <xsl:for-each select="/lanes_descriptions/lane[TYPE='STANOWISKO']">
+                  <xsl:element name="bpmn2:participant">
+                     <xsl:attribute name="id" select="concat('Participant_',ID_ZASOB)"/>
+                     <xsl:attribute name="name" select="concat('Participant ',DESC)"/>
+                     <xsl:attribute name="processRef" select="concat('ID_ZASOB_',ID_ZASOB)"/>
+                  </xsl:element>
+             </xsl:for-each>
+          </xsl:element>
+          <!-- domyslny basen do zdefiniowania 2x-->
+          <xsl:element name="bpmn2:process">
+             <xsl:attribute name="id" select="'eclipse_basen_event_task_task'"/>
+             <xsl:attribute name="name" select="'Default Process'"/>
+          </xsl:element>
+          
+          <!-- Tu jedziemy po procesach -->
+          <xsl:for-each select="/lanes_descriptions/lane[TYPE='STANOWISKO']">
+            <xsl:element name="bpmn2:process">
+               <xsl:attribute name="id" select="concat('ID_ZASOB_',ID_ZASOB)"/>
+               <xsl:attribute name="name" select="DESC"/>
+               <xsl:attribute name="definitionalCollaborationRef" select="'Collaboration_1'"/>
+               <!-- jade event init tutaj -->
+              
+               <xsl:for-each select="exslt:node-set($procesy_gen_include)/root/lane"> <!-- TODO trzeba zdjac ten ogranicznik DEV @2014-12 -->
+                        
+                  <!-- 
+                        <xsl:element name="bpmn2:intermediateThrowEvent">
+                           <xsl:attribute name="id" select="concat('id_proces_init_',id_proces_init)"/>
+                           <xsl:attribute name="name" select="concat('Proces_init ',id_proces_init)"/>
+                           <xsl:element name="bpmn2:outgoing">
+                              <xsl:value-of select="concat('task_',id_proces_init)"/> 
+                           </xsl:element> 
+                        </xsl:element>
+                        <xsl:variable name="last_connection_from"/>
+                        
+                        <xsl:variable name="last_connection_from"/>
+                        <xsl:for-each select="tasks/task">
+                          
+                           <xsl:variable name="last_pos" select="position()-1"/>
+                           <xsl:variable name="next_pos" select="position()+1"/>
+                           
+                           
+                           <xsl:element name="bpmn2:manualTask">
+                              <xsl:attribute name="id" select="concat('task_',.)"/>
+                              <xsl:attribute name="name" select="concat('Task ',.)"/>
+                            
+                                 <xsl:choose>
+                                    <xsl:when test="position()=1">
+                                       <xsl:element name="bpmn2:incoming">
+                                          <xsl:value-of select="concat('id_proces_init_',.)"/>
+                                       </xsl:element>
+                                       <xsl:if test="../../tasks/task[position()=$next_pos]">
+                                          <xsl:element name="bpmn2:outgoing">
+                                             <xsl:value-of select="concat('task_',../../tasks/task[position()=$next_pos])"/>   
+                                          </xsl:element> 
+                                       </xsl:if>
+                                    
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                       <xsl:element name="bpmn2:incoming">
+                                          <xsl:value-of select="concat('task_',../../tasks/task[position()=$last_pos])"/>
+                                       </xsl:element>
+                                       <xsl:choose>
+                                          <xsl:when test="../../tasks/task[position()=$next_pos]">
+                                             <xsl:element name="bpmn2:outgoing">
+                                                <xsl:value-of select="concat('task_',../../tasks/task[position()=$next_pos])"/>   
+                                             </xsl:element> 
+                                          </xsl:when>
+                                          <xsl:otherwise>
+                                             <xsl:element name="bpmn2:outgoing">
+                                                <xsl:value-of select="concat('endEvent_',.)"/>   
+                                             </xsl:element> 
+                                          </xsl:otherwise>
+                                       </xsl:choose>
+                                      
+                                    </xsl:otherwise>
+                                 </xsl:choose>
+                              
+                              
+                           </xsl:element>
+                           
+                           <xsl:if test="not(../../tasks/task[position()=$next_pos])">
+                              <xsl:element name="bpmn2:endEvent">
+                                 <xsl:attribute name="id" select="concat('endEvent_',.)"/>
+                                 <xsl:attribute name="name" select="concat('endEvent ',.)"/>
+                                 <xsl:element name="incoming">
+                                    <xsl:value-of select="concat('task_',.)"/>
+                                 </xsl:element>
+                              </xsl:element> 
+                           </xsl:if>
+                           
+                           
+                           
+                        </xsl:for-each>
+                        -->
+                  <xsl:for-each select="StartEvents/StartEvent">
+                     <xsl:element name="bpmn2:intermediateThrowEvent">
+                        <xsl:attribute name="id" select="EventName"/>
+                        <xsl:attribute name="name" select="concat(EventName,' ',DESC)"/>
+                        <xsl:for-each select="incoming">
+                           <xsl:element name="bpmn2:incoming">
+                              <xsl:value-of select="concat(.,'_',../EventName)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                        <xsl:for-each select="outgoing">
+                           <xsl:element name="bpmn2:outgoing">
+                              <xsl:value-of select="concat(../EventName,'_',.)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                     </xsl:element>
+                     <xsl:call-template name="sequence_gen_from_task"/>
+                  </xsl:for-each>
+                  
+                  <xsl:for-each select="Tasks/Task">
+                     <xsl:element name="bpmn2:manualTask">
+                        <xsl:attribute name="id" select="EventName"/>
+                        <xsl:attribute name="name" select="concat(EventName,' ',DESC)"/>
+                        <xsl:for-each select="incoming">
+                           <xsl:element name="bpmn2:incoming">
+                              <xsl:value-of select="concat(.,'_',../EventName)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                        <xsl:for-each select="outgoing">
+                           <xsl:element name="bpmn2:outgoing">
+                              <xsl:value-of select="concat(../EventName,'_',.)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                     </xsl:element>
+                     <xsl:call-template name="sequence_gen_from_task"/>
+                  </xsl:for-each>
+                  
+                  <xsl:for-each select="EndEvents/EndEvent">
+                     <xsl:element name="bpmn2:endEvent">
+                        <xsl:attribute name="id" select="EventName"/>
+                        <xsl:attribute name="name" select="EventName"/>
+                        <xsl:for-each select="incoming">
+                           <xsl:element name="bpmn2:incoming">
+                              <xsl:value-of select="concat(.,'_',../EventName)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                        <xsl:for-each select="outgoing">
+                           <xsl:element name="bpmn2:outgoing">
+                              <xsl:value-of select="concat(../EventName,'_',.)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                     </xsl:element>
+                     <xsl:call-template name="sequence_gen_from_task"/>
+                  </xsl:for-each>
+                  
+                   
+               </xsl:for-each>
+               
+            </xsl:element>
+          </xsl:for-each>
+
+
+          <!-- diagram TODO -->
+          <!--
+          <xsl:element name="bpmndi:BPMNDiagram">
+             <xsl:attribute name="id" select="'BPMNDiagram_1'"/>
+             <xsl:attribute name="name" select="'Default Process Diagram'"/>
+               <xsl:element name="bpmndi:BPMNPlane">
+                  <xsl:attribute name="id" select="'BPMNPlane_1'"/>
+                  <xsl:attribute name="name" select="'eclipse_basen_event_task_task'"/>
+                     
+                     <xsl:for-each select="/lanes_descriptions/lane[TYPE='STANOWISKO']">
+                        <xsl:element name="bpmndi:BPMNShape">
+                           <xsl:attribute name="id" select="concat('BPMNShape_Participant_',ID_ZASOB)"/>
+                           <xsl:attribute name="bpmnElement" select="concat('Participant_',ID_ZASOB)"/>
+                           <xsl:attribute name="isHorizontal" select="'true'"/>
+                           <xsl:element name="dc:Bounds">
+                              <xsl:attribute name="height" select="'150'"/>
+                              <xsl:attribute name="width" select="'500'"/>
+                              <xsl:attribute name="x" select="'50'"/>
+                              <xsl:attribute name="y" select="'90'"/>
+                           </xsl:element>
+                           <xsl:element name="bpmndi:BPMNLabel">
+                              <xsl:attribute name="id" select="concat('BPMNLabel_',ID_ZASOB)"/>
+                              <xsl:attribute name="labelStyle" select="'BPMNLabelStyle_1'"/>
+                              <xsl:element name="dc:Bounds">
+                                 <xsl:attribute name="height" select="'26.0'"/>
+                                 <xsl:attribute name="width" select="'10.0'"/>
+                                 <xsl:attribute name="x" select="'36.0'"/>
+                                 <xsl:attribute name="y" select="'152.0'"/>
+                              </xsl:element>
+                           </xsl:element>
+                        </xsl:element>
+                     </xsl:for-each>
+                 
+               </xsl:element>
+             <bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1">
+                <dc:Font name="arial" size="9.0"/>
+             </bpmndi:BPMNLabelStyle>
+             
+          </xsl:element>
+          -->
+        
+          
+          
+          
+          
+       </xsl:element>
+    </xsl:template>
+</xsl:stylesheet>

+ 166 - 0
SE/schema/default_db_xml_cache.public/procesy_to_bpmn_single_proces.xsl

@@ -0,0 +1,166 @@
+<?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:exslt="http://exslt.org/common"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" 
+    xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+    xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" 
+    exclude-result-prefixes="xs exslt xsi"
+    version="2.0">
+   <!-- 
+     
+   
+    xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+     xmlns:ext="http://org.eclipse.bpmn2/ext" -->
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+        
+    
+    <xsl:strip-space elements="*"/>
+    
+   <xsl:template name="sequence_gen_from_task_single_proces">
+       <xsl:for-each select="outgoing">
+          <xsl:element name="bpmn2:sequenceFlow">
+             <xsl:attribute name="id" select="concat(../EventName,'_',.)"/>
+             <xsl:attribute name="sourceRef" select="../EventName"/>
+             <xsl:attribute name="targetRef" select="."/>
+          </xsl:element>
+       </xsl:for-each>
+    </xsl:template>
+   
+    <xsl:template name="procesy_to_bpmn_single_proces">
+       <xsl:param name="procesy_gen_include"/>
+      
+       <xsl:element name="bpmn2:definitions">
+          <xsl:namespace name="bpmn2"  select="'http://www.omg.org/spec/BPMN/20100524/MODEL'"/>
+          <xsl:namespace name="bpmndi"  select="'http://www.omg.org/spec/BPMN/20100524/DI'"/>
+          <xsl:namespace name="dc"  select="'http://www.omg.org/spec/DD/20100524/DC'"/>
+          <xsl:namespace name="di"  select="'http://www.omg.org/spec/DD/20100524/DI'"/>
+          <xsl:namespace name="ext"  select="'http://org.eclipse.bpmn2/ext'"/>
+          <xsl:attribute name="id" select="'Definitions_1'"/>
+          <xsl:attribute name="exporter" select="'org.eclipse.bpmn2.modeler.core'"/>
+          <xsl:attribute name="targetNamespace" select="'http://org.eclipse.bpmn2/default/process'"/>
+          <xsl:namespace name="xsi" select="'http://www.w3.org/2001/XMLSchema-instance'"/>
+          <xsl:attribute name="xsi:schemaLocation" select="'http://www.omg.org/spec/BPMN/20100524/MODEL ../system_cache/procesy5_bpmn_cache.xsd'"/>
+     
+          <!-- domyslny basen do zdefiniowania 2x-->
+          <xsl:element name="bpmn2:process">
+                          <xsl:attribute name="id" select="'eclipse_basen_event_task_task'"/>
+                          <xsl:attribute name="name" select="'Default Process'"/>
+                      
+                       
+                       <!-- Tu jedziemy po procesach -->
+                       
+                        
+                            <!-- jade event init tutaj -->
+                           
+                            <xsl:for-each select="exslt:node-set($procesy_gen_include)/root/lane"> <!-- TODO trzeba zdjac ten ogranicznik DEV @2014-12 -->
+                                     
+                            
+                               <xsl:for-each select="StartEvents/StartEvent">
+                                  <xsl:element name="bpmn2:intermediateThrowEvent">
+                                     <xsl:attribute name="id" select="EventName"/>
+                                     <xsl:attribute name="name" select="concat(EventName,' ',DESC)"/>
+                                     <xsl:for-each select="incoming">
+                                        <xsl:element name="bpmn2:incoming">
+                                           <xsl:value-of select="concat(.,'_',../EventName)"/>
+                                        </xsl:element>
+                                     </xsl:for-each>
+                                     <xsl:for-each select="outgoing">
+                                        <xsl:element name="bpmn2:outgoing">
+                                           <xsl:value-of select="concat(../EventName,'_',.)"/>
+                                        </xsl:element>
+                                     </xsl:for-each>
+                                  </xsl:element>
+                                  <xsl:call-template name="sequence_gen_from_task_single_proces"/>
+                               </xsl:for-each>
+                               
+                               <xsl:for-each select="Tasks/Task">
+                                  <xsl:element name="bpmn2:manualTask">
+                                     <xsl:attribute name="id" select="EventName"/>
+                                     <xsl:attribute name="name" select="concat(EventName,' ',DESC)"/>
+                                     <xsl:for-each select="incoming">
+                                        <xsl:element name="bpmn2:incoming">
+                                           <xsl:value-of select="concat(.,'_',../EventName)"/>
+                                        </xsl:element>
+                                     </xsl:for-each>
+                                     <xsl:for-each select="outgoing">
+                                        <xsl:element name="bpmn2:outgoing">
+                                           <xsl:value-of select="concat(../EventName,'_',.)"/>
+                                        </xsl:element>
+                                     </xsl:for-each>
+                                  </xsl:element>
+                                  <xsl:call-template name="sequence_gen_from_task_single_proces"/>
+                               </xsl:for-each>
+                               
+                               <xsl:for-each select="EndEvents/EndEvent">
+                                  <xsl:element name="bpmn2:endEvent">
+                                     <xsl:attribute name="id" select="EventName"/>
+                                     <xsl:attribute name="name" select="EventName"/>
+                                     <xsl:for-each select="incoming">
+                                        <xsl:element name="bpmn2:incoming">
+                                           <xsl:value-of select="concat(.,'_',../EventName)"/>
+                                        </xsl:element>
+                                     </xsl:for-each>
+                                     <xsl:for-each select="outgoing">
+                                        <xsl:element name="bpmn2:outgoing">
+                                           <xsl:value-of select="concat(../EventName,'_',.)"/>
+                                        </xsl:element>
+                                     </xsl:for-each>
+                                  </xsl:element>
+                                  <xsl:call-template name="sequence_gen_from_task_single_proces"/>
+                               </xsl:for-each>
+                               
+                                
+                            </xsl:for-each>
+                            
+                         
+                      
+          </xsl:element>
+
+          <!-- diagram TODO  
+          <xsl:element name="bpmndi:BPMNDiagram">
+             <xsl:attribute name="id" select="'BPMNDiagram_1'"/>
+             <xsl:attribute name="name" select="'Default Process Diagram'"/>
+               <xsl:element name="bpmndi:BPMNPlane">
+                  <xsl:attribute name="id" select="'BPMNPlane_1'"/>
+                  <xsl:attribute name="name" select="'eclipse_basen_event_task_task'"/>
+                     
+                     <xsl:for-each select="/lanes_descriptions/lane[TYPE='STANOWISKO']">
+                        <xsl:element name="bpmndi:BPMNShape">
+                           <xsl:attribute name="id" select="concat('BPMNShape_Participant_',ID_ZASOB)"/>
+                           <xsl:attribute name="bpmnElement" select="concat('Participant_',ID_ZASOB)"/>
+                           <xsl:attribute name="isHorizontal" select="'true'"/>
+                           <xsl:element name="dc:Bounds">
+                              <xsl:attribute name="height" select="'150'"/>
+                              <xsl:attribute name="width" select="'500'"/>
+                              <xsl:attribute name="x" select="'50'"/>
+                              <xsl:attribute name="y" select="'90'"/>
+                           </xsl:element>
+                           <xsl:element name="bpmndi:BPMNLabel">
+                              <xsl:attribute name="id" select="concat('BPMNLabel_',ID_ZASOB)"/>
+                              <xsl:attribute name="labelStyle" select="'BPMNLabelStyle_1'"/>
+                              <xsl:element name="dc:Bounds">
+                                 <xsl:attribute name="height" select="'26.0'"/>
+                                 <xsl:attribute name="width" select="'10.0'"/>
+                                 <xsl:attribute name="x" select="'36.0'"/>
+                                 <xsl:attribute name="y" select="'152.0'"/>
+                              </xsl:element>
+                           </xsl:element>
+                        </xsl:element>
+                     </xsl:for-each>
+                 
+               </xsl:element>
+             <bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1">
+                <dc:Font name="arial" size="9.0"/>
+             </bpmndi:BPMNLabelStyle>
+             
+          </xsl:element>
+        
+          -->
+          
+          
+          
+       </xsl:element>
+    </xsl:template>
+</xsl:stylesheet>

+ 256 - 0
SE/schema/default_db_xml_cache.public/procesy_to_bpmn_subprocess.xsl

@@ -0,0 +1,256 @@
+<?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:exslt="http://exslt.org/common"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" 
+    xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
+    xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" 
+    exclude-result-prefixes="xs exslt xsi"
+    version="2.0">
+   <!-- 
+     
+   
+    xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+     xmlns:ext="http://org.eclipse.bpmn2/ext" -->
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+        
+    
+    <xsl:strip-space elements="*"/>
+    
+   <xsl:template name="sequence_gen_from_task_subprocess">
+       <xsl:for-each select="outgoing">
+          <xsl:element name="bpmn2:sequenceFlow">
+             <xsl:attribute name="id" select="concat(../EventName,'_',.)"/>
+             <xsl:attribute name="sourceRef" select="../EventName"/>
+             <xsl:attribute name="targetRef" select="."/>
+          </xsl:element>
+       </xsl:for-each>
+    </xsl:template>
+   
+   <xsl:template name="procesy_to_bpmn_subprocess">
+       <xsl:param name="procesy_gen_include"/>
+       <xsl:comment>origin at X=0.0 Y=0.0</xsl:comment>
+       <xsl:element name="bpmn2:definitions">
+          <xsl:namespace name="bpmn2"  select="'http://www.omg.org/spec/BPMN/20100524/MODEL'"/>
+          <xsl:namespace name="bpmndi"  select="'http://www.omg.org/spec/BPMN/20100524/DI'"/>
+          <xsl:namespace name="dc"  select="'http://www.omg.org/spec/DD/20100524/DC'"/>
+          <xsl:namespace name="di"  select="'http://www.omg.org/spec/DD/20100524/DI'"/>
+          <xsl:namespace name="ext"  select="'http://org.eclipse.bpmn2/ext'"/>
+          <xsl:attribute name="id" select="'Definitions_1'"/>
+          <xsl:attribute name="exporter" select="'org.eclipse.bpmn2.modeler.core'"/>
+          <xsl:attribute name="targetNamespace" select="'http://org.eclipse.bpmn2/default/process'"/>
+     
+          <xsl:element name="bpmn2:collaboration">
+             <xsl:attribute name="id" select="'Collaboration_1'"/>
+             <xsl:attribute name="name" select="'Collaboration 1'"/>
+             <!--  jakis domyslny participant ? do basenu ? -->
+             <xsl:element name="bpmn2:participant">
+                <xsl:attribute name="id" select="'Participant_2'"/>
+                <xsl:attribute name="name" select="'Default Process Pool 1'"/>
+                <xsl:attribute name="processRef" select="'eclipse_basen_event_task_task'"/>
+             </xsl:element>
+             <!-- tutaj trzeba wylistowac baseny stanowiska --> 
+             <!--
+             <xsl:for-each select="/lanes_descriptions/lane[TYPE='STANOWISKO'][1]">
+                  <xsl:element name="bpmn2:participant">
+                     <xsl:attribute name="id" select="concat('Participant_',ID_ZASOB)"/>
+                     <xsl:attribute name="name" select="concat('Participant ',DESC)"/>
+                     <xsl:attribute name="processRef" select="concat('ID_ZASOB_',ID_ZASOB)"/>
+                  </xsl:element>
+             </xsl:for-each>
+          </xsl:element>
+          -->
+          <!-- domyslny basen do zdefiniowania 2x-->
+          <xsl:element name="bpmn2:process">
+             <xsl:attribute name="id" select="'eclipse_basen_event_task_task'"/>
+             <xsl:attribute name="name" select="'Default Process'"/>
+          </xsl:element>
+          
+          <!-- Tu jedziemy po procesach -->
+          <xsl:for-each select="/lanes_descriptions/lane[TYPE='STANOWISKO'][1]">
+            <xsl:element name="bpmn2:process">
+               <xsl:attribute name="id" select="concat('ID_ZASOB_',ID_ZASOB)"/>
+               <xsl:attribute name="name" select="DESC"/>
+               <xsl:attribute name="definitionalCollaborationRef" select="'Collaboration_1'"/>
+               <!-- jade event init tutaj -->
+              
+               <xsl:for-each select="exslt:node-set($procesy_gen_include)/root/lane"> <!-- TODO trzeba zdjac ten ogranicznik DEV @2014-12 -->
+                        
+                  <!-- 
+                        <xsl:element name="bpmn2:intermediateThrowEvent">
+                           <xsl:attribute name="id" select="concat('id_proces_init_',id_proces_init)"/>
+                           <xsl:attribute name="name" select="concat('Proces_init ',id_proces_init)"/>
+                           <xsl:element name="bpmn2:outgoing">
+                              <xsl:value-of select="concat('task_',id_proces_init)"/> 
+                           </xsl:element> 
+                        </xsl:element>
+                        <xsl:variable name="last_connection_from"/>
+                        
+                        <xsl:variable name="last_connection_from"/>
+                        <xsl:for-each select="tasks/task">
+                          
+                           <xsl:variable name="last_pos" select="position()-1"/>
+                           <xsl:variable name="next_pos" select="position()+1"/>
+                           
+                           
+                           <xsl:element name="bpmn2:manualTask">
+                              <xsl:attribute name="id" select="concat('task_',.)"/>
+                              <xsl:attribute name="name" select="concat('Task ',.)"/>
+                            
+                                 <xsl:choose>
+                                    <xsl:when test="position()=1">
+                                       <xsl:element name="bpmn2:incoming">
+                                          <xsl:value-of select="concat('id_proces_init_',.)"/>
+                                       </xsl:element>
+                                       <xsl:if test="../../tasks/task[position()=$next_pos]">
+                                          <xsl:element name="bpmn2:outgoing">
+                                             <xsl:value-of select="concat('task_',../../tasks/task[position()=$next_pos])"/>   
+                                          </xsl:element> 
+                                       </xsl:if>
+                                    
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                       <xsl:element name="bpmn2:incoming">
+                                          <xsl:value-of select="concat('task_',../../tasks/task[position()=$last_pos])"/>
+                                       </xsl:element>
+                                       <xsl:choose>
+                                          <xsl:when test="../../tasks/task[position()=$next_pos]">
+                                             <xsl:element name="bpmn2:outgoing">
+                                                <xsl:value-of select="concat('task_',../../tasks/task[position()=$next_pos])"/>   
+                                             </xsl:element> 
+                                          </xsl:when>
+                                          <xsl:otherwise>
+                                             <xsl:element name="bpmn2:outgoing">
+                                                <xsl:value-of select="concat('endEvent_',.)"/>   
+                                             </xsl:element> 
+                                          </xsl:otherwise>
+                                       </xsl:choose>
+                                      
+                                    </xsl:otherwise>
+                                 </xsl:choose>
+                              
+                              
+                           </xsl:element>
+                           
+                           <xsl:if test="not(../../tasks/task[position()=$next_pos])">
+                              <xsl:element name="bpmn2:endEvent">
+                                 <xsl:attribute name="id" select="concat('endEvent_',.)"/>
+                                 <xsl:attribute name="name" select="concat('endEvent ',.)"/>
+                                 <xsl:element name="incoming">
+                                    <xsl:value-of select="concat('task_',.)"/>
+                                 </xsl:element>
+                              </xsl:element> 
+                           </xsl:if>
+                           
+                           
+                           
+                        </xsl:for-each>
+                        -->
+                  <xsl:for-each select="StartEvents/StartEvent">
+                     <xsl:element name="bpmn2:intermediateThrowEvent">
+                        <xsl:attribute name="id" select="EventName"/>
+                        <xsl:attribute name="name" select="EventName"/>
+                        <xsl:for-each select="incoming">
+                           <xsl:element name="bpmn2:incoming">
+                              <xsl:value-of select="concat(.,'_',../EventName)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                        <xsl:for-each select="outgoing">
+                           <xsl:element name="bpmn2:outgoing">
+                              <xsl:value-of select="concat(../EventName,'_',.)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                     </xsl:element>
+                     <xsl:call-template name="sequence_gen_from_task_subprocess"/>
+                  </xsl:for-each>
+                  
+                  <xsl:for-each select="Tasks/Task">
+                     <xsl:element name="bpmn2:manualTask">
+                        <xsl:attribute name="id" select="EventName"/>
+                        <xsl:attribute name="name" select="EventName"/>
+                        <xsl:for-each select="incoming">
+                           <xsl:element name="bpmn2:incoming">
+                              <xsl:value-of select="concat(.,'_',../EventName)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                        <xsl:for-each select="outgoing">
+                           <xsl:element name="bpmn2:outgoing">
+                              <xsl:value-of select="concat(../EventName,'_',.)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                     </xsl:element>
+                     <xsl:call-template name="sequence_gen_from_task_subprocess"/>
+                  </xsl:for-each>
+                  
+                  <xsl:for-each select="EndEvents/EndEvent">
+                     <xsl:element name="bpmn2:endEvent">
+                        <xsl:attribute name="id" select="EventName"/>
+                        <xsl:attribute name="name" select="EventName"/>
+                        <xsl:for-each select="incoming">
+                           <xsl:element name="bpmn2:incoming">
+                              <xsl:value-of select="concat(.,'_',../EventName)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                        <xsl:for-each select="outgoing">
+                           <xsl:element name="bpmn2:outgoing">
+                              <xsl:value-of select="concat(../EventName,'_',.)"/>
+                           </xsl:element>
+                        </xsl:for-each>
+                     </xsl:element>
+                     <xsl:call-template name="sequence_gen_from_task_subprocess"/>
+                  </xsl:for-each>
+                  
+                   
+               </xsl:for-each>
+               
+            </xsl:element>
+          </xsl:for-each>
+
+
+          <!-- diagram TODO 
+          <xsl:element name="bpmndi:BPMNDiagram">
+             <xsl:attribute name="id" select="'BPMNDiagram_1'"/>
+             <xsl:attribute name="name" select="'Default Process Diagram'"/>
+               <xsl:element name="bpmndi:BPMNPlane">
+                  <xsl:attribute name="id" select="'BPMNPlane_1'"/>
+                  <xsl:attribute name="name" select="'eclipse_basen_event_task_task'"/>
+                     
+                     <xsl:for-each select="/lanes_descriptions/lane[TYPE='STANOWISKO']">
+                        <xsl:element name="bpmndi:BPMNShape">
+                           <xsl:attribute name="id" select="concat('BPMNShape_Participant_',ID_ZASOB)"/>
+                           <xsl:attribute name="bpmnElement" select="concat('Participant_',ID_ZASOB)"/>
+                           <xsl:attribute name="isHorizontal" select="'true'"/>
+                           <xsl:element name="dc:Bounds">
+                              <xsl:attribute name="height" select="'150'"/>
+                              <xsl:attribute name="width" select="'500'"/>
+                              <xsl:attribute name="x" select="'50'"/>
+                              <xsl:attribute name="y" select="'90'"/>
+                           </xsl:element>
+                           <xsl:element name="bpmndi:BPMNLabel">
+                              <xsl:attribute name="id" select="concat('BPMNLabel_',ID_ZASOB)"/>
+                              <xsl:attribute name="labelStyle" select="'BPMNLabelStyle_1'"/>
+                              <xsl:element name="dc:Bounds">
+                                 <xsl:attribute name="height" select="'26.0'"/>
+                                 <xsl:attribute name="width" select="'10.0'"/>
+                                 <xsl:attribute name="x" select="'36.0'"/>
+                                 <xsl:attribute name="y" select="'152.0'"/>
+                              </xsl:element>
+                           </xsl:element>
+                        </xsl:element>
+                     </xsl:for-each>
+                 
+               </xsl:element>
+             <bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1">
+                <dc:Font name="arial" size="9.0"/>
+             </bpmndi:BPMNLabelStyle>
+             
+          </xsl:element>
+        
+          -->
+          
+          
+          
+       </xsl:element>
+    </xsl:template>
+</xsl:stylesheet>

+ 52 - 0
SE/schema/default_db_xml_cache.public/procesy_to_cubetto.xsl

@@ -0,0 +1,52 @@
+<?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:exslt="http://exslt.org/common"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"  />
+        
+    
+    <xsl:strip-space elements="*"/>
+    
+
+    <xsl:template name="procesy_to_cubetto">
+     
+        <!-- <xsl:element name="projects">
+          <xsl:attribute name="id" select="'Project_p20'"/>
+          <xsl:attribute name="name" select="'XSL_TEST'"/>
+          <xsl:attribute name="exporter" select="'Cubetto'"/>
+          <xsl:attribute name="exporterVersion" select="'1.2.0'"/>
+          <xsl:attribute name="targetNamespace" select="'http://xml.semture.de/mobileE3'"/>
+        -->
+          
+           <projects xmlns="http://xml.semture.de/mobileE3"
+                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exporter="Cubetto" exporterVersion="1.2.0"
+                      id="Project_p20" name="XSL_TEST" targetNamespace="http://xml.semture.de/mobileE3"
+                      xsi:schemaLocation="http://xml.semture.de/mobileE3 http://www.semture.de/downloads/cubetto/schemas/mobileE3.xsd">
+                
+                <xsl:element name="project">
+                    <xsl:attribute name="id" select="'Project_p20'"/>
+                    <xsl:attribute name="name" select="'XSL_TEST'"/>
+                    <xsl:attribute name="modifiedAt" select="'1419471513.985344'"/>
+                    <xsl:attribute name="leastPresentation" select="'Presentation_p51'"/>
+                    
+                    <xsl:element name="modelType">
+                        <xsl:attribute name="id" select="'ModelType_p19'"/>
+                        <xsl:attribute name="cubettoBuild" select="'968'"/>
+                        <xsl:attribute name="cubettoVersion" select="'1.5.0'"/>
+                        <xsl:attribute name="languageVersion" select="'1.0.6'"/>
+                                 <name es="BPMN" ru="BPMN" de="BPMN" fr="BPMN" en="BPMN" key="BPMN"
+                                     zh-Hans="&#x4E1A;&#x52A1;&#x6D41;&#x7A0B;&#x6A21;&#x578B;&#x4E0E;&#x6807;&#x8BB0;&#x6CD5;"/>
+                                 <model id="Model_p19"/>
+                         
+                         
+                          <xsl:copy-of select="/"/>
+                    </xsl:element>
+                </xsl:element>
+          </projects>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 75 - 0
SE/schema/default_db_xml_cache.public/stanowiska_nazwy_gen.xsl

@@ -0,0 +1,75 @@
+<?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:exslt="http://exslt.org/common"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output omit-xml-declaration="no" indent="yes" method="xml" encoding="UTF-8" version="1.0"/>
+    <xsl:strip-space elements="*"/>
+    <xsl:key name="zasob" match="/root/lane/ID_ZASOB" use="." />
+    <!-- <xsl:key name="ID_ZASOB" match="ID" use="." /> -->
+ 
+    <xsl:variable name="zasoby_cache" select="document('CRM_LISTA_ZASOBOW.xml')/data/items/item"/>
+ 
+ <!-- 
+    <xsl:template name="get_zasob_desc">
+      <xsl:param name="id_zasob"/>
+      <xsl:for-each select="document('CRM_LISTA_ZASOBOW.xml')/data/items/item[ID=$id_zasob and TYPE='STANOWISKO']">
+        <xsl:element name="zasoby">
+          <xsl:element name="ID_ZASOB">
+              <xsl:value-of select="$id_zasob"/>
+          </xsl:element>
+          <xsl:element name="DESC">
+              <xsl:value-of select="DESC"/>
+          </xsl:element>
+          <xsl:element name="TYPE">
+              <xsl:value-of select="TYPE"/>
+          </xsl:element>
+          <xsl:element name="PATH">
+              <xsl:value-of select="path"/>
+          </xsl:element>
+        </xsl:element>
+      </xsl:for-each>
+  </xsl:template>
+  
+ -->
+    
+    
+    
+    <!-- [generate-id()=generate-id(key('ID_ZASOB',.)[1])] -->
+ 
+    
+    <xsl:template name="get_zasob_desc_cached">
+        <xsl:param name="id_zasob"/>
+        <xsl:for-each select="$zasoby_cache[ID=$id_zasob]">  
+            <xsl:element name="lane">
+                <xsl:element name="ID_ZASOB">
+                    <xsl:value-of select="$id_zasob"/>
+                </xsl:element>
+                <xsl:element name="DESC">
+                    <xsl:value-of select="DESC"/>
+                </xsl:element>
+                <xsl:element name="TYPE">
+                    <xsl:value-of select="TYPE"/>
+                </xsl:element>
+                <xsl:element name="PATH">
+                    <xsl:value-of select="path"/>
+                </xsl:element>
+            </xsl:element>
+       </xsl:for-each>  
+        
+        
+   </xsl:template>
+    
+    
+    <xsl:template name="stanowiska_nazwy_gen">
+        <xsl:element name="lanes_descriptions">
+        <xsl:for-each select="/root/lane/ID_ZASOB[generate-id() = generate-id(key('zasob',.)[1])]">
+            <xsl:sort select="."/>
+                     <xsl:call-template name="get_zasob_desc_cached">
+                          <xsl:with-param name="id_zasob" select="."/>
+                      </xsl:call-template>     
+        </xsl:for-each>
+        </xsl:element>
+    </xsl:template>
+</xsl:stylesheet>

+ 43 - 0
SE/schema/default_db_xml_cache.public/test_xsl-fo.xsl

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <xsl:output method="xml" indent="yes"/>
+    
+    
+    
+    <xsl:template match="/">
+        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+            <fo:layout-master-set>
+                <fo:simple-page-master master-name="cuda">
+                    <fo:region-body/>
+                </fo:simple-page-master>
+            </fo:layout-master-set>
+            
+            <fo:page-sequence master-reference="cuda">
+                <fo:flow flow-name="xsl-region-body">
+                    
+                    <fo:block>Kolos indyjski asdsa dasd </fo:block>
+                    
+                    <fo:block space-after="0.1in">
+                        W roku jakims mieszkancy czegos costasm adsa dasd ad asd asd 
+                    </fo:block>
+                    
+                    <fo:block space-after="0.1in">
+                        Kolos ten został
+                        
+                    </fo:block>
+                    <fo:block>
+                        <fo:external-graphic src="../images/2198_procesy5_tlo.jpg" content-height="3.5in"/>
+                        
+                    </fo:block>
+                </fo:flow>
+
+            </fo:page-sequence>
+            
+        </fo:root>
+        
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 145 - 0
SE/schema/default_db_xml_cache.public/transform_z_sql.xsl

@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs xd"
+    xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" 
+    version="2.0"
+    >
+    
+    <xsl:template match="xs:complexType">
+
+        <xsl:if test="matches(@name,'RowType_prezes_procesy5_pl_Schema_')">   
+            <xsl:variable name="nazwa">
+                <xsl:value-of select="replace(@name,'RowType_prezes_procesy5_pl_Schema_','')"/>
+            </xsl:variable>
+            
+            <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+                <xsl:attribute name="targetNamespace">
+                    <xsl:value-of select="concat('http://biuro.biall-net.pl/xmlschema_procesy5/default_db/',$nazwa)"/>
+                </xsl:attribute>
+                <xsl:namespace name="xp5__default_db__{$nazwa}" select="concat('http://biuro.biall-net.pl/xmlschema_procesy5/default_db/',$nazwa)"/>
+                
+     
+                  
+                 
+                     <xsl:text>&#xA;     </xsl:text>
+        <xsl:for-each select="xs:sequence/xs:element">
+            <xsl:text>&#xA;    </xsl:text>
+
+                
+            <xs:simpleType>
+                <xsl:attribute name="name">
+                    <xsl:value-of select="@name"/>
+                </xsl:attribute>
+                
+               
+
+                    <xsl:choose>
+                        
+                        <xsl:when test="matches(@type,'VARCHAR') or matches(@type,'CHAR')">
+                           
+                                                     
+                                 <xsl:variable name="maxLength">
+                                    <xsl:value-of select="replace(@type,'VARCHAR_','')"/>
+                                </xsl:variable>
+                                 <xsl:variable name="maxLength">
+                                 <xsl:value-of select="replace($maxLength,'CHAR_','')"/>
+                               </xsl:variable>
+                               <xs:restriction base="xs:string">
+                                 <xs:maxLength>
+                                    <xsl:attribute name="value">
+                                        <xsl:value-of select="$maxLength"/>
+                                    </xsl:attribute>
+                                </xs:maxLength>
+                             </xs:restriction>
+                            
+                        </xsl:when>
+                        <xsl:when test="matches(@type,'INT')">
+                             
+                            <xs:restriction base="xs:integer">
+                                <xs:maxInclusive value="2147483647"/>
+                                <xs:minInclusive value="-2147483648"/>
+                            </xs:restriction>
+                             
+                        </xsl:when>
+                        
+                        <xsl:when test="matches(@type,'DECIMAL')">
+                            <xsl:variable name="decimal" select="tokenize(@type,'_')"/>
+                             
+                            <xs:restriction base="xs:decimal">
+                                <xs:totalDigits>
+                                    <xsl:attribute name="value">
+                                        <xsl:value-of select="$decimal[2]"/>
+                                    </xsl:attribute>
+                                </xs:totalDigits>
+                                <xs:fractionDigits>
+                                    <xsl:attribute name="value" select="$decimal[3]"/>
+                                </xs:fractionDigits>
+                            </xs:restriction>
+                            
+                        </xsl:when>
+
+                        <xsl:when test="matches(@type,'TIMESTAMP')">
+                            <xs:restriction base="xs:dateTime">
+                                <xsl:text disable-output-escaping="yes">
+                                    &lt;xs:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}"/&gt;  
+                                </xsl:text>
+                            </xs:restriction>
+                        </xsl:when>
+                        
+                        <xsl:when test="matches(@type,'DATE')">
+                            <xs:restriction base="xs:date">
+                                <xsl:text disable-output-escaping="yes">
+                                    &lt;xs:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/&gt;  
+                                </xsl:text>
+                                
+                            </xs:restriction>
+                        </xsl:when>
+                        
+                        
+                        <xsl:when test="matches(@type,'DOUBLE')">
+                            <xs:restriction base="xs:double"/>
+                        </xsl:when>
+                        
+                        <xsl:otherwise>
+                            <xsl:attribute name="type2">
+                               <xsl:value-of select="@type"/>
+                            </xsl:attribute>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                
+                
+                </xs:simpleType>
+              
+        </xsl:for-each>
+                     <xsl:text>&#xA;      </xsl:text>
+             
+            <xs:complexType name="defaults">
+                <xsl:text>&#xA;      </xsl:text>
+                <xs:sequence>
+                    <xsl:for-each select="xs:sequence/xs:element">
+                      <xsl:if test="@default!=''">
+                        <xsl:text>&#xA;         </xsl:text>
+                        <xs:element>
+                            
+                         <xsl:attribute name="name">
+                            <xsl:value-of select="@name"/>
+                        </xsl:attribute>
+                            <xsl:attribute name="type">
+                                <xsl:value-of select="concat('xp5__default_db__',$nazwa,':',@name)"/>
+                            </xsl:attribute>
+                            <xsl:attribute name="default">
+                                <xsl:value-of select="@default"/>
+                            </xsl:attribute>
+                        </xs:element>
+                      </xsl:if>
+                    </xsl:for-each>
+                    <xsl:text>&#xA;         </xsl:text>
+                </xs:sequence>
+            </xs:complexType>   
+        </xs:schema>
+        </xsl:if> 
+      
+        
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 87 - 0
SE/schema/default_db_xml_cache.public/web_ui.xsl

@@ -0,0 +1,87 @@
+<?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:default_db="http://biuro.biall-net.pl/xmlschema_procesy5/default_db"
+    xmlns:system_cache__web_ui="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/web_ui"
+    
+    
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <!-- @2017-02 bindera: wyglada na przydatny do implementacji do modulow wps -->
+    
+    <!--funkcje do obslugi akcji edycji/kopiowania/dodawania obiektow poprzez GUI DRAFT  -->
+    
+    
+    <xsl:import href="import_resource_table_xml_from_api.xsl"/>
+    <xsl:import href="form_occurs_max_sequence.xsl"/>
+    <xsl:import href="resources_tree_required_occurs_raport.xsl"/>
+    
+    
+    
+    <xsl:variable name="CRM_LISTA_ZASOBOW">
+        <xsl:call-template name="import_resource_table_xml_from_api">
+            <xsl:with-param name="cache" select="'read'"/>
+            <xsl:with-param name="resource" select="'CRM_LISTA_ZASOBOW'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    
+  
+    
+    <xsl:template name="main">
+        <!--<xsl:result-document href="../default_db.instance.xml/transformed/default_db__CRM_LISTA_ZASOBOW_OFFERS__allowed_functions.xml">
+            <default_db__CRM_LISTA_ZASOBOW_OFFERS:allowed_functions>
+                <!-\-<xsl:apply-templates mode="default_db__ADMIN_USERS:allowed_functions" select="$ADMIN_USERS//item[ID='11' or ID='9' or ADM_ACCOUNT='remiszewskim' or ADM_ACCOUNT='crash' or ID='4889']"/>-\->
+            </default_db__CRM_LISTA_ZASOBOW_OFFERS:allowed_functions>
+        </xsl:result-document>--> 
+    </xsl:template>
+    
+    
+    
+    
+    
+    <!-- DRAFT template do przyjecia zadania do edycji, do dalszego przetwarzania, wyswietlania, potwierdzania -->
+    <xsl:template match="node()" mode="system_cache__web_ui:modify_record_set">
+        <!-- propozycja struktury tworzonej przez template -->
+        <!--<system_cache__appinfo:save_to_api_xml>
+            <edit_record table-name="DEVICES"
+                count_xml_node="1"
+                current_object_xml_name="?default_db:DEVICES?">
+                <ID read_key_value="d108e1">12345</ID>
+                <A_STATUS>NORMAL</TYPE>
+            </edit_record>
+           -->
+    </xsl:template>
+    
+    
+    <!-- DRAFT template usuniecia zadania edycji -->
+    <xsl:template match="node()" mode="system_cache__web_ui:modify_record_remove_from_set">
+        <!-- propozycja struktury obslugiwanej przez template - oczekiwany argument do usuniecia z listy np.
+            read_key_value="d108e1  -->
+        <!--<system_cache__appinfo:save_to_api_xml>
+            <edit_record table-name="DEVICES"
+                count_xml_node="1"
+                current_object_xml_name="?default_db:DEVICES?">
+                <ID read_key_value="d108e1">12345</ID>
+                <A_STATUS>NORMAL</TYPE>
+            </edit_record>
+           -->
+    </xsl:template>
+    
+    <!-- DRAFT template wykonania zadania edycji -->
+    <xsl:template match="node()" mode="system_cache__web_ui:modify_record_show_set_to_confirm">
+        <!-- TODO -->
+    </xsl:template>
+    
+    <!-- DRAFT template usuniecia zadania edycji -->
+    <xsl:template match="node()" mode="system_cache__web_ui:modify_record_commit">
+        
+    </xsl:template>
+    
+    
+    
+    
+    
+    
+    
+</xsl:stylesheet>

+ 56 - 0
SE/schema/default_db_xml_cache.public/wfs.xsl

@@ -0,0 +1,56 @@
+<?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:Types__x3A__wfs="https://biuro.biall-net.pl/wfs/default_db/Types/wfs.xsd"
+    xmlns:gml="http://www.opengis.net/gml"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    <!-- @2016-11 styl do stworzenia transakcji do WFS na bazie obiektu XML bindera -->
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="Types__x3A__wfs:table_to_insert" required="yes"/>
+    <xsl:param name="Types__x3A__wfs:xmlns_table_to_insert" required="yes"/>
+    <xsl:template  match="*" mode="Types__x3A__wfs:MakeTransactionInsert" > <!--mode="Types__x3A__wfs:prepare_transaction" -->
+        <xsl:param name="Types__x3A__wfs:table_to_insert"  select="$Types__x3A__wfs:table_to_insert"/> <!-- MK_BIALE_PLAMY -->
+        <xsl:param name="Types__x3A__wfs:xmlns_table_to_insert"  select="$Types__x3A__wfs:xmlns_table_to_insert"/><!-- https://biuro.biall-net.pl/wfs/default_db/MK_BIALE_PLAMY-->
+        <xsl:param name="Types__x3A__wfs:element_lon" select="'lng'"/>
+        <xsl:param name="Types__x3A__wfs:element_lat" select="'lat'"/>
+        <xsl:param name="Types__x3A__wfs:element_the_geom" select="'the_geom'"/>
+        <xsl:param name="gml:srsName" select="'EPSG:4326'"/>
+        <xsl:param name="gml:element_type" select="'Point'"/>
+        <Transaction
+            xmlns="http://www.opengis.net/wfs"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            version="1.0.0"
+            service="WFS"
+            xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+            xmlns:gml="http://www.opengis.net/gml">
+                <xsl:for-each select="row">
+                    <Insert namespace="http://www.opengis.net/wfs"  >
+                        <xsl:element name="{$Types__x3A__wfs:table_to_insert}"  namespace="{$Types__x3A__wfs:xmlns_table_to_insert}" inherit-namespaces="no">
+                            <xsl:for-each select="./*">
+                                <xsl:choose>
+                                    <xsl:when test="name()=$Types__x3A__wfs:element_lat or name()=$Types__x3A__wfs:element_lon"/>
+                                    <xsl:otherwise>
+                                        <xsl:element name="{name()}" namespace="{$Types__x3A__wfs:xmlns_table_to_insert}" inherit-namespaces="no" >
+                                            <xsl:value-of select="text()"/>
+                                        </xsl:element>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                            </xsl:for-each>
+                            <xsl:if test="./node()/name()=$Types__x3A__wfs:element_lon and ./node()/name()=$Types__x3A__wfs:element_lat">
+                                <xsl:element name="{$Types__x3A__wfs:element_the_geom}" namespace="{$Types__x3A__wfs:xmlns_table_to_insert}">
+                                    <xsl:element name="gml:Point" exclude-result-prefixes="#all" xmlns:gml="http://www.opengis.net/gml">
+                                        <xsl:attribute name="srsName" select="$gml:srsName"/><!-- cs="," ts=" " -->
+                                        <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs=" " ts=","><xsl:value-of select="./node()[name()=$Types__x3A__wfs:element_lon]/text()"/><xsl:value-of select="' '"/><xsl:value-of select="./node()[name()=$Types__x3A__wfs:element_lat]/text()"/></gml:coordinates>
+                                    </xsl:element>
+                                </xsl:element>
+                            </xsl:if>
+                        </xsl:element>
+                    </Insert>
+                </xsl:for-each>
+        </Transaction>
+    </xsl:template>
+</xsl:stylesheet>

+ 127 - 0
SE/schema/default_db_xml_cache.public/xlsx.xsl

@@ -0,0 +1,127 @@
+<?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:Types__x3A__xlsx="https://biuro.biall-net.pl/wfs/default_db/Types/xlsx.xsd"
+    xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
+    xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:dcterms="http://purl.org/dc/terms/" 
+    xmlns:dcmitype="http://purl.org/dc/dcmitype/"
+    xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    <xsl:param name="Types__x3A__xlsx__x3A__unzipped_xlsx"  required="yes"/> <!-- type dir there to unzipped dir of xlsx file -->
+    
+    
+    
+    
+    <xsl:variable name="Types__x3A__xlsx:path">
+        <!-- <xsl:for-each select="collection(iri-to-uri('../someDir/?select=[a-z][0-9]+.(xsl|xslt);recurse=yes'))"> -->
+        <xsl:message> Looking for xml doc files at <xsl:value-of select="  iri-to-uri(concat($Types__x3A__xlsx__x3A__unzipped_xlsx,'?select=*.(xml|rels);recurse=yes;on-error=warning'))"/></xsl:message>
+        <xsl:value-of select="  iri-to-uri(concat($Types__x3A__xlsx__x3A__unzipped_xlsx,'?select=*.(xml|rels);recurse=yes;on-error=warning'))"/> 
+    </xsl:variable>
+    <xsl:variable name="Types__x3A__xlsx:docs" select="collection($Types__x3A__xlsx:path)"/>
+    
+    
+    <xsl:template name="Types__x3A__xlsx:main">
+        <xsl:message>Executing Types__x3A__xlsx__x3A__main</xsl:message>
+        <Types__x3A__xlsx:main>
+        <xsl:for-each select="$Types__x3A__xlsx:docs">
+            <xsl:apply-templates mode="Types__x3A__xlsx:sheets">
+                <xsl:with-param name="document-uri" select="document-uri(/)"/>
+            </xsl:apply-templates>
+        </xsl:for-each>
+        </Types__x3A__xlsx:main>
+    </xsl:template>
+    
+    
+    <xsl:template match="*">
+        <xsl:message terminate="yes">ERROR this template should be called by call-template</xsl:message>
+    </xsl:template>
+    
+    <xsl:template match="workbook" mode="Types__x3A__xlsx:sheets" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main" >
+        <xsl:param name="document-uri"/>
+        
+        <workbook>
+            <xsl:for-each select="sheets/sheet" > <!-- xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main" -->
+                <xsl:apply-templates mode="Types__x3A__xlsx:sheet" select="$Types__x3A__xlsx:docs">
+                    <xsl:with-param name="name" select="@name"/>
+                    <xsl:with-param name="sheetId" select="@sheetId"/>
+                    <xsl:with-param name="r:id" select="@r:id"/>
+                </xsl:apply-templates>
+            </xsl:for-each>
+        </workbook>
+    </xsl:template>
+    
+    
+    
+    <xsl:template match="*" mode="Types__x3A__xlsx:sheets Types__x3A__xlsx:sheet">
+        <xsl:param name="document-uri"/>
+        <xsl:element name="{name()}">
+           <xsl:copy-of select="@*"/>
+            <name><xsl:value-of select="name()"/></name>
+            <url><xsl:value-of select="$document-uri"/></url>
+       </xsl:element>
+    </xsl:template>
+    
+    
+    
+    <xsl:template match="worksheet" mode="Types__x3A__xlsx:sheet" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+        <xsl:param name="sheetId" required="yes"/>
+        <xsl:param name="name"/>
+        <xsl:choose>
+            <xsl:when test=" substring-after( document-uri(/),'worksheets/')=concat('sheet',$sheetId,'.xml')">
+                <xsl:apply-templates mode="Types__x3A__xlsx:sheetData"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <inny_sheet><xsl:attribute name="sheetId_param" select="$sheetId"/>
+                    <xsl:value-of select="substring-after( document-uri(/),'worksheets/')"/>
+                    <test><xsl:value-of select="concat('sheet',$sheetId,'.xml')"/></test>
+                </inny_sheet>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template match="sheetData" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+        <sheetData>
+           <xsl:apply-templates mode="Types__x3A__xlsx:sheetData"/>
+        </sheetData>
+    </xsl:template>
+    
+    <xsl:template match="row" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+        <row>
+            <xsl:apply-templates mode="Types__x3A__xlsx:sheetData"/>
+        </row>
+    </xsl:template>
+    
+    <xsl:template match="c[@t='s']" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+        <xsl:variable name="v" select="v/text()"/>
+        <xsl:variable name="r" select="@r"/>
+        <c><xsl:copy-of select="@*"/><xsl:attribute name="v_deb_nr" select="$v"/>
+            <v><xsl:value-of select="$Types__x3A__xlsx:docs/sst/si[position()=$v]/t" exclude-result-prefixes="#all"/></v>
+            <!--<xsl:copy-of select="../../../hyperlinks/hyperlink"/>-->
+            <xsl:apply-templates mode="Types__x3A__xlsx:Hyperlink" select="../../../hyperlinks/hyperlink[@ref=current()/@r]" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main"/>
+        </c>
+    </xsl:template>
+    
+    <xsl:template match="c" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+        <xsl:variable name="r" select="@r"/>
+        <c><xsl:copy-of select="@*"/>
+            <v><xsl:copy-of select="v/text()" copy-namespaces="no"/></v>
+            <xsl:apply-templates mode="Types__x3A__xlsx:Hyperlink" select="../../../hyperlinks/hyperlink[@ref=current()/@r]"/>
+        </c>
+    </xsl:template>
+    
+    
+    
+    <xsl:template match="hyperlink" mode="Types__x3A__xlsx:Hyperlink" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
+        <!--<xsl:value-of select="@r:id"/>-->
+        <!--<xsl:copy-of select="$Types__x3A__xlsx:docs" xpath-default-namespace="http://schemas.openxmlformats.org/package/2006/relationships"/>-->
+        <xsl:copy-of select="$Types__x3A__xlsx:docs/Relationships/Relationship[@Id=current()/@r:id]" xpath-default-namespace="http://schemas.openxmlformats.org/package/2006/relationships"/>
+    </xsl:template>
+    
+</xsl:stylesheet>