浏览代码

testing on macpro

arkadiusz binder 7 年之前
父节点
当前提交
d979e405b1
共有 44 个文件被更改,包括 8261 次插入871 次删除
  1. 484 0
      SE/schema/WPS_Functions/graph_gnuplot/p5gnuplot.xsd
  2. 7 2
      SE/schema/WPS_Functions/graph_gnuplot/p5gnuplot__x3A__system_cache__dita.xsl
  3. 11 0
      SE/schema/WPS_Functions/mapserver_gml_to_png/mapserver_gml_to_png.param.xsl
  4. 26 8
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.NWK3.xsl
  5. 61 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.NWK3T.xsl
  6. 384 128
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.deal_analys.xsl
  7. 459 120
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.overwiev_table.xsl
  8. 17 7
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.podglad_analizy_liczb.records.xsl
  9. 16 1
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.podglad_analizy_liczb.xsl
  10. 119 15
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.xsl
  11. 107 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD__x3A__generate.xsl
  12. 192 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.dita.xsd
  13. 112 9
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.xsl
  14. 562 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_4UA.xsl
  15. 382 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_BI_audit_ENERGA_RUM_KONTRAHENCI.xsl
  16. 448 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_ENERGA_RUM_UMOWY.xsl
  17. 135 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_context.path.xsl
  18. 82 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_middle_ref.xsl
  19. 171 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_operational_raport_note.xsl
  20. 143 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person.xsl
  21. 625 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.xsl
  22. 273 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA.xsl
  23. 208 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.xsl
  24. 357 0
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.sources.xsl
  25. 64 17
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.stats_all.xsl
  26. 247 530
      SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl
  27. 51 0
      SE/schema/default_db_xml_cache.public/default_db/dateTime.xsl
  28. 906 27
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplot.xsl
  29. 53 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics.header.xsl
  30. 488 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics.xsl
  31. 111 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics__x3A__detect.xsl
  32. 67 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics__x3A__plot.xsl
  33. 112 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics__x3A__set.xsl
  34. 56 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.color.xsl
  35. 53 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.xaxis.xsl
  36. 373 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.xsl
  37. 105 0
      SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.yaxis.xsl
  38. 6 3
      SE/schema/default_db_xml_cache.public/default_db/system_cache__dita.map.title__x3A__to_merge/tree_to_dita__x3A__map.title.default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.xsl
  39. 11 3
      SE/schema/default_db_xml_cache.public/default_db/system_cache__dita.map.title__x3A__to_merge/tree_to_dita__x3A__map.title.xsl
  40. 28 0
      SE/schema/default_db_xml_cache.public/default_db/system_cache__dita__x3A__to_merge/tree_to_dita__x3A__audience.xsl
  41. 86 0
      SE/schema/default_db_xml_cache.public/default_db/system_cache__dita__x3A__to_merge/tree_to_dita__x3A__indexterm.xsl
  42. 40 0
      SE/schema/default_db_xml_cache.public/default_db/system_cache__dita__x3A__to_merge/tree_to_dita__x3A__transform_by_values_map.xsl
  43. 3 0
      SE/schema/default_db_xml_cache.public/default_db/tree_to_dita__x3A__to_merge.xsl
  44. 20 1
      se.oxygen.xpr

+ 484 - 0
SE/schema/WPS_Functions/graph_gnuplot/p5gnuplot.xsd

@@ -0,0 +1,484 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"
+    targetNamespace="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot" vc:minVersion="1.1"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
+
+    <xs:annotation>
+        <xs:documentation>schemat elementow xml w dita obslugiwanych przez modul 2018-11</xs:documentation>
+    </xs:annotation>
+    <xs:element name="DEBUG">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="simpletable">
+                    <xs:alternative test="not(contains(@props, 'histogram'))"
+                        type="p5gnuplot:simpletable__x3A__version.1"/>
+                    <xs:alternative test="contains(@props, 'histogram')"
+                        type="p5gnuplot:simpletable__x3A__version.histogram"/>
+                </xs:element>
+                <xs:element name="xtics" type="p5gnuplot:xtics">
+                    <xs:annotation>
+                        <xs:documentation>analyzed to controll graphs</xs:documentation>
+                    </xs:annotation>
+                </xs:element>
+                <xs:element name="ytics">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element maxOccurs="unbounded" name="ytics.row">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element name="stentry" maxOccurs="unbounded">
+                                            <xs:complexType mixed="true">
+                                                <xs:attribute name="group" use="required">
+                                                  <xs:annotation>
+                                                  <xs:documentation>todo po co ? -  wartosc </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:attribute>
+                                                <xs:attribute name="col" type="xs:int"
+                                                  use="required"/>
+                                                <xs:attribute name="audience" use="required">
+                                                  <xs:annotation>
+                                                  <xs:documentation>wartosc</xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:attribute>
+                                                <xs:attribute name="graph.color.variable"
+                                                  type="xs:int" use="required">
+                                                  <xs:annotation>
+                                                  <xs:documentation>1 </xs:documentation>
+                                                  </xs:annotation>
+                                                </xs:attribute>
+                                            </xs:complexType>
+                                        </xs:element>
+                                    </xs:sequence>
+                                    <xs:attribute name="current-grouping-key" type="xs:string"
+                                        use="required"/>
+                                    <xs:attribute name="pos" type="xs:int" use="required"/>
+                                    <xs:attribute name="count" type="xs:int" use="required"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <xs:element name="graph.title">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="strow">
+                                <xs:complexType>
+                                    <xs:sequence>
+                                        <xs:element maxOccurs="unbounded" name="stentry">
+                                            <xs:alternative test="@props = 'graph.xtic'"
+                                                type="p5gnuplot:strow.graph.headers.stentry.xtic.title"/>
+                                            <xs:alternative test="not(@prop = 'graph.xtic')"
+                                                type="p5gnuplot:strow.graph.headers.stentry.title"/>
+                                        </xs:element>
+                                    </xs:sequence>
+                                    <xs:attribute fixed="graph.title" name="props"/>
+                                    <xs:attribute name="strow.pos" use="required"/>
+                                </xs:complexType>
+                            </xs:element>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <xs:complexType name="simpletable__x3A__version.1">
+        <xs:sequence>
+            <xs:element name="strow" type="p5gnuplot:simpletable__x3A__version.1.strow.headers"/>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:complexType name="simpletable__x3A__version.1.strow.headers">
+        <xs:sequence/>
+        <xs:attribute fixed="graph.headers" name="props"/>
+    </xs:complexType>
+    <xs:complexType name="simpletable__x3A__version.histogram">
+        <xs:sequence maxOccurs="unbounded">
+            <xs:element name="strow">
+                <xs:alternative id="p5gnuplot.strow.graph.headers.strow"
+                    test="@props = 'graph.headers'" type="p5gnuplot:strow.graph.headers">
+                    <xs:annotation>
+                        <xs:documentation>odpowiednik osi setu danych Y ( z gory na dol .dat)
+system_cache__dita:graph.xaxis + @col</xs:documentation>
+                    </xs:annotation>
+                </xs:alternative>
+                <xs:alternative test="@props = 'graph.data'" type="p5gnuplot:strow.graph.data"/>
+                <xs:alternative test="@props = 'graph.title'" type="p5gnuplot:strow.graph.title">
+                    <xs:annotation>
+                        <xs:documentation>odpowiednik osi Y ( z lewo na prawo .dat)
+system_cache__dita:graph.yaxis.name - $grap.title + @col
+</xs:documentation>
+                    </xs:annotation>
+                </xs:alternative>
+                <xs:alternative test="@props = 'graph.fill.style'"
+                    type="p5gnuplot:strow.graph.color.name"/>
+                <xs:alternative test="@props = 'graph.color.name'"
+                    type="p5gnuplot:strow.graph.fill.style"/>
+                <xs:alternative test="@props = 'graph.newhistogram'"
+                    type="p5gnuplot:strow.graph.newhistogram"/>
+            </xs:element>
+        </xs:sequence>
+        <xs:attribute name="props" type="p5gnuplot:props.histogram"/>
+        <xs:attribute name="id" type="xs:string"/>
+        <xs:attribute name="frame"/>
+    </xs:complexType>
+    <xs:complexType mixed="false" name="strow.graph.headers.stentry.xtic">
+        <xs:simpleContent>
+            <xs:extension base="xs:string">
+                <xs:attribute fixed="graph.xtic" name="props"/>
+                <xs:attribute name="col" type="xs:int" use="required"/>
+                <xs:attribute name="group" type="xs:string" use="optional">
+                    <xs:annotation>
+                        <xs:documentation>todo po co ?</xs:documentation>
+                    </xs:annotation>
+                </xs:attribute>
+                <xs:attribute name="current-grouping-key" type="xs:string" use="required"/>
+            </xs:extension>
+        </xs:simpleContent>
+    </xs:complexType>
+    <xs:complexType name="strow.graph.headers.stentry.xtic.title">
+        <xs:annotation>
+            <xs:documentation>modified by template - extra attrs</xs:documentation>
+        </xs:annotation>
+        <xs:complexContent>
+            <xs:extension base="p5gnuplot:strow.graph.headers.stentry.xtic">
+                <xs:attribute name="audience" use="required"/>
+                <xs:attribute name="count.stentry.pow.all" use="required"/>
+                <xs:attribute name="stentry.pow" use="required"/>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+    <xs:complexType name="strow.graph.headers.stentry">
+        <xs:simpleContent>
+            <xs:extension base="xs:string">
+                <xs:attribute name="col" type="xs:int" use="required"/>
+                <xs:attribute name="props"/>
+                <xs:attribute name="group" type="xs:string" use="optional">
+                    <xs:annotation>
+                        <xs:documentation>todo po co ?</xs:documentation>
+                    </xs:annotation>
+                </xs:attribute>
+                <xs:attribute name="current-grouping-key" type="xs:string" use="required"/>
+                <xs:attribute name="audience" use="required"/>
+            </xs:extension>
+        </xs:simpleContent>
+    </xs:complexType>
+    <xs:complexType name="strow.graph.headers.stentry.title">
+        <xs:annotation>
+            <xs:documentation>analyzed transformed by template extra attrs</xs:documentation>
+        </xs:annotation>
+        <xs:complexContent>
+            <xs:extension base="p5gnuplot:strow.graph.headers.stentry">
+                <xs:attribute name="count.stentry.pow.all" use="required"/>
+                <xs:attribute name="stentry.pow" use="required"/>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+    <xs:complexType mixed="true" name="strow.graph.title.stentry">
+        <xs:attribute name="col" type="xs:int" use="required"/>
+        <xs:attribute name="current-grouping-key" use="required"/>
+        <xs:attribute name="group" use="required">
+            <xs:annotation>
+                <xs:documentation>90 osoba mer. xxx yyy</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="audience" use="required">
+            <xs:annotation>
+                <xs:documentation>histogram strategy usage</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="props"/>
+    </xs:complexType>
+    <xs:simpleType name="props.histogram">
+        <xs:restriction base="xs:string">
+            <xs:pattern value=".*graph.style.histogram.*"/>
+        </xs:restriction>
+    </xs:simpleType>
+    <xs:complexType name="strow.graph.headers">
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" name="stentry">
+                <xs:alternative test="@props = 'graph.xtic'"
+                    type="p5gnuplot:strow.graph.headers.stentry.xtic"/>
+                <xs:alternative test="not(@prop = 'graph.xtic')"
+                    type="p5gnuplot:strow.graph.headers.stentry"/>
+            </xs:element>
+        </xs:sequence>
+        <xs:attribute fixed="graph.headers" name="props"/>
+    </xs:complexType>
+    <xs:complexType name="strow.graph.color.name">
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" name="stentry"/>
+        </xs:sequence>
+        <xs:attribute fixed="graph.fill.style" name="props"/>
+    </xs:complexType>
+    <xs:complexType name="strow.graph.fill.style">
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" name="stentry"/>
+        </xs:sequence>
+        <xs:attribute fixed="graph.color.name" name="props"/>
+    </xs:complexType>
+    <xs:complexType name="strow.graph.data">
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" name="stentry">
+                <xs:complexType mixed="true">
+                    <xs:attribute name="current-grouping-key" use="required"/>
+                    <xs:attribute name="audience">
+                        <xs:annotation>
+                            <xs:documentation>_x32_koord_x32_sp._x32_gł._x32__x32__x32_1043061</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                    <xs:attribute name="col" use="required"/>
+                    <xs:attribute name="props">
+                        <xs:annotation>
+                            <xs:documentation>opcjonalnie np. props="pos_1 row_1  Osoba_merytoryczna___nazwisko_i_imie 90 value"</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+        <xs:attribute fixed="graph.data" name="props"/>
+    </xs:complexType>
+    <xs:complexType name="strow.graph.title">
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" name="stentry"
+                type="p5gnuplot:strow.graph.title.stentry">
+                <xs:annotation>
+                    <xs:documentation>"wartość  akcept. mer. xxxx xxx" - unikalne - group</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+        <xs:attribute fixed="graph.title" name="props"/>
+    </xs:complexType>
+    <xs:complexType name="strow.graph.newhistogram">
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" name="stentry">
+                <xs:complexType mixed="true">
+                    <xs:attribute name="props"/>
+                    <xs:attribute name="col" type="xs:int" use="required"/>
+                    <xs:attribute name="audience" use="required">
+                        <xs:annotation>
+                            <xs:documentation> which audiences this histogram coverages</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+        <xs:attribute fixed="graph.newhistogram" name="props"/>
+    </xs:complexType>
+    <xs:complexType name="xtics">
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" minOccurs="1" name="text">
+                <xs:complexType mixed="true">
+                    <xs:sequence>
+                        <xs:element maxOccurs="unbounded" name="current-grouping-key">
+                            <xs:complexType mixed="true">
+                                <xs:attribute name="pos" type="xs:int" use="required"/>
+                            </xs:complexType>
+                        </xs:element>
+                        <xs:element maxOccurs="unbounded" name="audience" minOccurs="0"/>
+                        <xs:element maxOccurs="unbounded" name="graph.color.variable" minOccurs="0">
+                            <xs:complexType mixed="true">
+                                <xs:attribute name="current-grouping-key" use="required"/>
+                                <xs:attribute name="col" type="xs:int" use="required"/>
+                            </xs:complexType>
+                        </xs:element>
+                    </xs:sequence>
+                    <xs:attribute name="current-grouping-key" use="required"/>
+                    <xs:attribute name="pos" type="xs:int" use="required"/>
+                    <xs:attribute name="count" type="xs:int" use="required"/>
+                    <xs:attribute name="col" type="xs:int" use="required"/>
+                    <xs:attribute name="group" use="required"/>
+                    <xs:attribute name="audience"/>
+                    <xs:attribute name="current-grouping-key.list">
+                        <xs:annotation>
+                            <xs:documentation>to remove todo</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                    <xs:attribute name="stentry.pow" type="xs:int" use="required">
+                        <xs:annotation>
+                            <xs:documentation>like 1 - to explain</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                    <xs:attribute name="strow.pos" type="xs:int" use="required">
+                        <xs:annotation>
+                            <xs:documentation>to explain - 1</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="graph.newhistogram" maxOccurs="unbounded">
+                <xs:complexType mixed="true">
+                    <xs:sequence>
+                        <xs:element name="audience" maxOccurs="unbounded">
+                            <xs:complexType>
+                                <xs:sequence>
+                                    <xs:element name="current-grouping-key" maxOccurs="unbounded">
+                                        <xs:complexType mixed="true">
+                                            <xs:attribute name="col" type="xs:int" use="required"/>
+                                            <xs:attribute name="current-grouping-key" use="required"/>
+                                            <xs:attribute name="xtics.pos" type="xs:int"
+                                                use="required"/>
+                                            <xs:attribute name="graph.color.variable" type="xs:int"
+                                                use="required"/>
+                                            <xs:attribute name="audience" type="xs:string"
+                                                use="required"/>
+                                        </xs:complexType>
+                                    </xs:element>
+                                </xs:sequence>
+                                <xs:attribute name="audience" type="xs:string" use="required"/>
+                                <xs:attribute name="current-grouping-key.list" use="required">
+                                    <xs:annotation>
+                                        <xs:documentation>BI_audit_KRS_person.476312 BI_audit_KRS_person.476313 BI_audit_KRS_person.628818 BI_audit_KRS_person.143579 BI_audit_KRS_person.917260 BI_audit_KRS_person.964888...</xs:documentation>
+                                    </xs:annotation>
+                                </xs:attribute>
+                                <xs:attribute name="current-grouping-key.foreign" type="xs:boolean"
+                                />
+                            </xs:complexType>
+                        </xs:element>
+                    </xs:sequence>
+                    <xs:attribute name="xtics.col__x3A__aviable"/>
+                    <xs:attribute name="graph.newhistogram.text">
+                        <xs:annotation>
+                            <xs:documentation> analiza </xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                    <xs:attribute name="pos" type="xs:int" use="required"/>
+                </xs:complexType>
+            </xs:element>
+            <xs:element ref="p5gnuplot:graph.newhistogram"/>
+        </xs:sequence>
+        <xs:attribute name="fileindex" type="xs:string">
+            <xs:annotation>
+                <xs:documentation>like relations-136_000006BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.BI_audit_KRS_person.dita</xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+    </xs:complexType>
+    <xs:element name="graph.newhistogram">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element minOccurs="0" ref="p5gnuplot:set.xtics.rotate"/>
+                <xs:element minOccurs="0" ref="p5gnuplot:set.bmargin"/>
+                <xs:element ref="p5gnuplot:graph.newhistogram.child"/>
+            </xs:sequence>
+            <xs:attribute ref="p5gnuplot:text"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:attribute name="text.line.join"/>
+    <xs:element name="plot">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="p5gnuplot:newhistogram"/>
+            </xs:sequence>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+            <xs:attribute ref="p5gnuplot:text.line.join"/>
+            <xs:attribute ref="p5gnuplot:text"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="newhistogram">
+        <xs:complexType mixed="true">
+            <xs:sequence>
+                <xs:element ref="p5gnuplot:plot_arg" maxOccurs="unbounded"/>
+            </xs:sequence>
+            <xs:attribute ref="p5gnuplot:text"/>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="graph.newhistogram.child">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element maxOccurs="unbounded" ref="p5gnuplot:plot"/>
+            </xs:sequence>
+            <xs:attribute ref="p5gnuplot:text"/>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:attribute name="text" type="xs:string"/>
+    <xs:attribute name="text.join" type="xs:string"/>
+    <xs:element name="set.bmargin">
+        <xs:complexType>
+            <xs:attribute ref="p5gnuplot:text"/>
+            <xs:attribute ref="p5gnuplot:value"/>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="set.xtics.rotate">
+        <xs:complexType>
+            <xs:attribute name="debug"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="plot_arg">
+        <xs:complexType>
+            <xs:sequence maxOccurs="unbounded">
+                <xs:element ref="p5gnuplot:file" minOccurs="0"/>
+                <xs:element ref="p5gnuplot:file.row.y.using" minOccurs="0"/>
+                <xs:element ref="p5gnuplot:file.row.y.color.column" minOccurs="0"/>
+                <xs:element ref="p5gnuplot:file.row.y" minOccurs="0"/>
+                <xs:element ref="p5gnuplot:file.row.x" minOccurs="0"/>
+                <xs:element ref="p5gnuplot:file.row.title" minOccurs="0"/>
+                <xs:element ref="p5gnuplot:file.row.style" minOccurs="0"/>
+                <xs:element ref="p5gnuplot:file.row.color" minOccurs="0"/>
+                <xs:element ref="p5gnuplot:file.row.yaxis" minOccurs="0"/>
+            </xs:sequence>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="file"/>
+    <xs:element name="file.row.y.using"/>
+    <xs:element name="file.row.y.color.column"/>
+    <xs:element name="file.row.y">
+        <xs:complexType>
+            <xs:attribute ref="p5gnuplot:text" use="required"/>
+            <xs:attribute name="debug"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="file.row.x">
+        <xs:complexType>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+            <xs:attribute ref="p5gnuplot:text"/>
+            <xs:attribute ref="p5gnuplot:value"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:attribute name="value" type="xs:string"/>
+    <xs:element name="file.row.title">
+        <xs:complexType>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+            <xs:attribute ref="p5gnuplot:text"/>
+            <xs:attribute ref="p5gnuplot:value"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="file.row.style">
+        <xs:complexType>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+            <xs:attribute ref="p5gnuplot:text"/>
+            <xs:attribute name="debug" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>#177-293 set to variable color </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="file.row.color">
+        <xs:complexType>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+            <xs:attribute ref="p5gnuplot:text"/>
+            <xs:attribute ref="p5gnuplot:value"/>
+            <xs:attribute name="debug" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>#177-293 set to variable color </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+        </xs:complexType>
+    </xs:element>
+    <xs:attribute name="debug" type="xs:string"/>
+    <xs:element name="file.row.yaxis">
+        <xs:complexType>
+            <xs:attribute name="graph.yaxis">
+                <xs:annotation>
+                    <xs:documentation>x1y1</xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+            <xs:attribute ref="p5gnuplot:text"/>
+            <xs:attribute ref="p5gnuplot:text.join"/>
+            <xs:attribute ref="p5gnuplot:value"/>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

+ 7 - 2
SE/schema/WPS_Functions/graph_gnuplot/p5gnuplot__x3A__system_cache__dita.xsl

@@ -11,10 +11,15 @@
    
     <xsl:function name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names">
         <xsl:param name="title"/>
-        <!--<xsl:value-of select="replace($title,' ','&#160;')"/>-->
-        <xsl:value-of select="concat('&quot;',substring(replace(replace($title,'   ',' '),'&quot;',' '),1,35),'&quot;')"/>
+        <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names($title,40)"/>
     </xsl:function>
    
+    <xsl:function name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names">
+        <xsl:param name="title"/>
+        <xsl:param name="size"/>
+        <!--<xsl:value-of select="replace($title,' ','&#160;')"/>-->
+        <xsl:value-of select="normalize-space(concat('&quot;',substring(replace(replace($title,'   ',' '),'&quot;',' '),1,$size),'&quot;'))"/>
+    </xsl:function>
     
     
 </xsl:stylesheet>

+ 11 - 0
SE/schema/WPS_Functions/mapserver_gml_to_png/mapserver_gml_to_png.param.xsl

@@ -0,0 +1,11 @@
+<?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:param name="mapserver_gml_to_png" required="yes"/>
+    
+</xsl:stylesheet>

+ 26 - 8
SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.NWK3.xsl

@@ -19,22 +19,25 @@
    
     <xsl:param name="default_db__x3A__BI_audit_BENFORD:NWK3.max_examples.param"  select="10"/>
    
+    <xsl:include href="default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.NWK3T.xsl"/>
    
    
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:NWK3">
-        <xsl:param name="title" select="'BI_audit_BENFORD.NWK3'"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes"/>
+        <xsl:param name="title" select="'BI_audit_BENFORD.BNWK3'"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes"/>
         <xsl:variable name="context" select="."/>
         <xsl:copy-of select="system_cache__dita:files.context.title.keydef(.,'map',$title)" copy-namespaces="no"/>
-        <topicref props="NWK3">
+        <topicref props="BNWK3">
             <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
             <xsl:copy-of select="system_cache__dita:files.context.title.keys(current(),$title)" copy-namespaces="no"/>
             <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}">
                 <topic id="{$uuid}_{position()}_{$title}__{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
                     <title>
-                        Najczęściej występujące wartości kolumny (NWK3)
+                        (BNWK3)  Najczęściej występujące wartości kolumny 
                     </title>
                     <body>
                             <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
@@ -63,7 +66,10 @@
     
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:NWK3_table">
         <xsl:param name="groupField" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes"/>
         <xsl:param name="context" required="yes"/>
             <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name()=string($groupField) ]] " group-by="*[local-name()=string($groupField) ]">
                 <xsl:sort select="count(current-group())" order="descending" data-type="number"/>
@@ -89,11 +95,23 @@
     
     <xsl:template  mode="default_db__x3A__BI_audit_BENFORD:NWK3_table" match="default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY">
         <xsl:param name="groupField" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes"/>
+        <!--<xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes"/>-->
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes"/>
         <xsl:param name="count__x3A__all" required="yes"/>
         <xsl:param name="current" required="yes"/>
         <strow>
-            <stentry><xsl:value-of select="current-grouping-key()"/></stentry>
+            <stentry>
+                <xsl:call-template name="system_cache__dita:indexterm">
+                    <xsl:with-param name="indexterm" select="current-grouping-key()"/>
+                    <xsl:with-param name="text" select="current-grouping-key()"/>
+                    <xsl:with-param name="system_cache__dita:element">ph</xsl:with-param>
+                    <!--<xsl:with-param name="system_cache__dita:localname" select="system_cache__dita:localname.translate($groupField)"/>-->
+                    <xsl:with-param name="system_cache__dita:indexterm" select="system_cache__dita:indexterm('BNKW3',system_cache__dita:localname.translate($groupField))"/>
+                </xsl:call-template>
+            </stentry>
             <stentry><xsl:value-of select="count($current/current-group())"/></stentry>
             <stentry><xsl:value-of select="round((count($current/current-group()) div $count__x3A__all ) * 100000) div 1000 "/></stentry>
             <stentry><xsl:value-of select="system_cache__dita:big_values_format(sum($current/current-group()/*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField]/number(text())))"/></stentry>

+ 61 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.NWK3T.xsl

@@ -0,0 +1,61 @@
+<?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:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    exclude-result-prefixes="p5gnuplot xs Benford system_cache__appinfo system_cache__dita get_wfs p5 xlink default_db__x3A__BI_audit_BENFORD"
+    version="2.0">
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+   
+    <xsl:template name="default_db__x3A__BI_audit_BENFORD:BNWK3T">
+        <xsl:param name="title" select="'BI_audit_BENFORD.BNWK3T'"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes"/>
+        <xsl:variable name="context" select="."/>
+        <xsl:copy-of select="system_cache__dita:files.context.title.keydef(.,'map',$title)" copy-namespaces="no"/>
+        <topicref props="BNWK3T">
+            <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
+            <xsl:copy-of select="system_cache__dita:files.context.title.keys(current(),$title)" copy-namespaces="no"/>
+            <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}">
+                <topic id="{$uuid}_{position()}_{$title}__{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd" ><!-- print="no" -->
+                    <title>
+                        (BNWK3T)  Najczęściej występujące wartości kolumny w oknach czasu T
+                    </title>
+                    <body>
+                        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                            <p>Grupa: <xsl:value-of select="system_cache__dita:localname.translate(.)"/></p>
+                            <simpletable frame="all" relcolwidth="1* 1* 1*">
+                                <sthead>
+                                    <stentry>Wartość</stentry>
+                                    <stentry>Liczba wystąpień</stentry>
+                                    <stentry>Procent występowania</stentry>
+                                    <stentry>Suma kwot</stentry>
+                                </sthead>
+                                <!--<xsl:call-template name="default_db__x3A__BI_audit_BENFORD:NWK3_table">
+                                    <xsl:with-param name="groupField" select="."/>
+                                    <xsl:with-param name="context" select="$context"/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField"/>
+                                </xsl:call-template>-->
+                            </simpletable>
+                        </xsl:for-each>
+                    </body>
+                </topic>
+            </xsl:result-document>
+        </topicref>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 384 - 128
SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.deal_analys.xsl

@@ -26,29 +26,33 @@
    
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys">
         <xsl:param name="title" select="'BI_audit_BENFORD.deal_analys'"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
         <xsl:message>#29 RUN default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys - should be once</xsl:message>
         <xsl:copy-of select="system_cache__dita:files.context.title.keydef(.,'map',$title)" copy-namespaces="no"/>
         <topicref props="BI_audit_BENFORD.deal_analys">
             <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
             <xsl:copy-of select="system_cache__dita:files.context.title.keys(current(),$title)" copy-namespaces="no"/>
             <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}">
-                
                 <topic id="{$uuid}_{position()}_{$title}__{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd" props="benford.BAKU">
                     <title>
-                        analiza kontrastowa umów ( próbki po <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.examples.param"/> przykładów )
+                        analiza kontrastowa umów (BAKU) ( próbki po <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.examples.param"/> przykładów )
                     </title>
                     <body>
                     <!--<xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1"/>
                     <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1.graph"/>-->
                         <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast">
-                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
-                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                           <!-- <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes" />
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes" />
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField"  select="$default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField"  select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>-->
                             <xsl:with-param name="debug" select="'#49 std call analys'"/>
                         </xsl:call-template>
                     </body>
+                    
                     <!--<xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY_vs_BI_audit_ENERGA_RUM_UMOWY">
                         <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys" select=".">
                             <xsl:with-param name="group_name" select="$title"/>
@@ -72,8 +76,10 @@
     
     
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast">
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes" />
         <xsl:param name="debug"/>
         <xsl:variable name="context" select="."/>
         <xsl:message>#77 context is name =<xsl:value-of select="$context/name()"/>; $debug=<xsl:value-of select="$debug"/>;</xsl:message>
@@ -96,8 +102,8 @@
                                     <xsl:with-param name="context.source" select="$context.source"/>
                                     <xsl:with-param name="context.dest" select="$context.dest"/>
                                     <xsl:with-param name="context" select="$context"/>
-                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField"/>
-                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField"/>
+                                    <!--<xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField"/>-->
+                                    <!--<xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField"/>-->
                                 </xsl:call-template>
                                 <!--<xsl:result-document href="/tmp/testout">
                                     <DEBUG_COPY>
@@ -119,40 +125,64 @@
         <xsl:param name="context.source" required="yes"/>
         <xsl:param name="context.dest" required="yes"/>
         <xsl:param name="context" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes" />
         <xsl:message>#96 default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques - $context.source=<xsl:value-of select="$context.source"/> to $context.dest =<xsl:value-of select="$context.dest"/>; </xsl:message>
-        <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber"><!-- *[local-name()=$context.source]/text() -->
-            <xsl:sort select="sum(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField])" order="descending" data-type="number"/>
-            <xsl:variable name="context.source.group" select="current-group()"/>
-            <xsl:variable name="source.remote.join.val" select="*[local-name()=$context.dest]"/>
-            <xsl:variable name="source.remote.join.val.leadingNumber" select="current-grouping-key()"/>
-            <xsl:variable name="src.position" select="position()"/>
-            <xsl:message>#98 $source.remote.join.val=<xsl:value-of select="$source.remote.join.val"/>; cnt = <xsl:value-of select="count(current-group())"/>/<xsl:value-of select="last()"/>; *join=<xsl:value-of select="*[local-name()=$context.dest]/text()"/>; *join=<xsl:value-of select="*[local-name()=$context.source]/text()"/> for current-grouping-key = <xsl:value-of select="current-grouping-key()"/>; name=<xsl:value-of select="name()"/>; $context.source=<xsl:value-of select="$context.source"/> to $context.dest =<xsl:value-of select="$context.dest"/>; position()=<xsl:value-of select="position()"/></xsl:message>
-            
-            <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $context.dest] and ancestor-or-self::*[@leadingNumber = $source.remote.join.val.leadingNumber ] ]" group-by="concat($source.remote.join.val.leadingNumber,*[local-name()=$context.dest]/text())">
-                <xsl:sort select="sum(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField])" data-type="number" order="descending"/>
-                <xsl:message>#129 current <xsl:value-of select="name()"/>; count=<xsl:value-of select="count(current-group())"/>; *join=<xsl:value-of select="*[local-name()=$context.dest]/text()"/>; *join=<xsl:value-of select="*[local-name()=$context.source]/text()"/>; posss=<xsl:value-of select="position()"/></xsl:message>
-                <xsl:choose>
-                    <xsl:when test="position() &lt; $default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.examples.param">
-                        <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques" select=".">
-                            <xsl:with-param name="context.source" select="$context.source"/>
-                            <xsl:with-param name="context.source.val" select="current-grouping-key()"/>
-                            <xsl:with-param name="context.dest" select="$context.dest"/>
-                            <xsl:with-param name="source.remote.join.val.leadingNumber" select="$source.remote.join.val.leadingNumber"/>
-                            <xsl:with-param name="context" select="$context"/>
-                            <xsl:with-param name="current" select="."/>
-                            <xsl:with-param name="position" select="position()"/>
-                            <xsl:with-param name="context.source.group" select="$context.source.group"/>
-                            <xsl:with-param name="src.position" select="$src.position"/>
-                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField"/>
-                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField"/>
-                        </xsl:apply-templates>
-                    </xsl:when>
-                </xsl:choose>
+        <xsl:variable name="contrast.stentry">
+            <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber"><!-- *[local-name()=$context.source]/text() -->
+                <xsl:sort select="sum(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField])" order="descending" data-type="number"/>
+                <xsl:variable name="context.source.group" select="current-group()"/>
+                <xsl:variable name="source.remote.join.val" select="*[local-name()=$context.dest]"/>
+                <xsl:variable name="source.remote.join.val.leadingNumber" select="current-grouping-key()"/>
+                <xsl:variable name="src.position" select="position()"/>
+                <xsl:message>#98 $source.remote.join.val=<xsl:value-of select="$source.remote.join.val"/>; cnt = <xsl:value-of select="count(current-group())"/>/<xsl:value-of select="last()"/>; *join=<xsl:value-of select="*[local-name()=$context.dest]/text()"/>; *join=<xsl:value-of select="*[local-name()=$context.source]/text()"/> for current-grouping-key = <xsl:value-of select="current-grouping-key()"/>; name=<xsl:value-of select="name()"/>; $context.source=<xsl:value-of select="$context.source"/> to $context.dest =<xsl:value-of select="$context.dest"/>; position()=<xsl:value-of select="position()"/></xsl:message>
+                
+                
+                    <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $context.dest] and ancestor-or-self::*[@leadingNumber = $source.remote.join.val.leadingNumber ] ]" group-by="concat($source.remote.join.val.leadingNumber,*[local-name()=$context.dest]/text())">
+                        <xsl:sort select="sum(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField])" data-type="number" order="descending"/>
+                        <xsl:message>#129 current <xsl:value-of select="name()"/>; count=<xsl:value-of select="count(current-group())"/>; *join=<xsl:value-of select="*[local-name()=$context.dest]/text()"/>; *join=<xsl:value-of select="*[local-name()=$context.source]/text()"/>; posss=<xsl:value-of select="position()"/></xsl:message>
+                        <xsl:choose>
+                            <xsl:when test="position() &lt; $default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.examples.param">
+                                            <stentry>
+                                                <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques" select=".">
+                                                    <xsl:with-param name="context.source" select="$context.source"/>
+                                                    <xsl:with-param name="context.source.val" select="current-grouping-key()"/>
+                                                    <xsl:with-param name="context.dest" select="$context.dest"/>
+                                                    <xsl:with-param name="source.remote.join.val.leadingNumber" select="$source.remote.join.val.leadingNumber"/>
+                                                    <xsl:with-param name="context" select="$context"/>
+                                                    <xsl:with-param name="current" select="."/>
+                                                    <xsl:with-param name="position" select="position()"/>
+                                                    <xsl:with-param name="context.source.group" select="$context.source.group"/>
+                                                    <xsl:with-param name="src.position" select="$src.position"/>
+                                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField"/>
+                                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField"/>
+                                                </xsl:apply-templates>
+                                            </stentry>
+                            </xsl:when>
+                        </xsl:choose>
+                    </xsl:for-each-group>
             </xsl:for-each-group>
-        </xsl:for-each-group>
-        
+        </xsl:variable>
+        <!--<topic ><!-\- id="{system_cache__dita:files.key.topic.title.id.context.value($context,'BI_audit_BENFORD.deal_analys')}" -\->
+            <title/>
+            <body>-->
+                <simpletable props="nograph" frame="bottom">
+                    <xsl:for-each-group select="$contrast.stentry/stentry" group-by="ceiling(position() div 4)">
+                        <strow>
+                            <xsl:copy-of select="current-group()"/>
+                            <xsl:if test="last()">
+                                <xsl:comment>#165 last <xsl:value-of select="count(current-group())"/></xsl:comment>
+                                <xsl:for-each select="count(current-group()) to 3">
+                                    <stentry/>
+                                </xsl:for-each>
+                            </xsl:if>
+                        </strow>
+                    </xsl:for-each-group>
+                </simpletable>
+            <!--</body>
+        </topic>-->
     </xsl:template>
     
     
@@ -178,17 +208,263 @@
         <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes"/>
         <!--<xsl:param name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.leadingNumber" required="yes"/>-->
         
+        
+        
+        <xsl:variable name="generate-id" select="concat($uuid,'BI_audit_BENFORD.deal_analys.contrast.uniques.topic_10_',$src.position,'_',$position,'_',position(),$context.dest,generate-id($current),'__',generate-id($context))"/>
+        <xsl:variable name="simpletable"> 
+        <!--<title>BAKU-X</title>-->
+            <simpletable frame="all"  id="uniques.topic_{$generate-id}{$context.dest}{generate-id()}" props=" ylabel.benford graph.y2label.koszt graph.style.histogram  " ><!-- font15 -->
+                <xsl:variable name="graph.headers">
+               <strow props="graph.headers">
+                <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                    <xsl:variable name="groupField" select="."/>
+                    <!--<stentry props="graph.xtic">
+                        <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/>
+                    </stentry>-->
+                    <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber"><!-- *[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField] -->
+                        <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                        <!--<stentry ><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat(ancestor-or-self::*[@leadingNumber][1]/@leadingNumber,'-',*[local-name()=$groupField]))"/></stentry>-->
+                        <!--<stentry ><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(*[local-name()=$groupField]"/></stentry>-->
+                        <!--<stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat('$',ancestor-or-self::*[@leadingNumber][1]/@leadingNumber))"/></stentry>-->
+                        <stentry current-grouping-key="{current-grouping-key()}" props="graph.xtic pos_{position()} row_1 {$groupField} {current-grouping-key()}">
+                            <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(current-grouping-key())"/><!--<xsl:value-of select="position()"/><xsl:value-of select="$groupField"/>-->
+                        </stentry>
+                        <stentry current-grouping-key="{current-grouping-key()}">
+                            <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(current-grouping-key())"/><!--<xsl:value-of select="position()"/><xsl:value-of select="$groupField"/>-->
+                        </stentry>
+                        <stentry current-grouping-key="{current-grouping-key()}">
+                            <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(current-grouping-key())"/><!--<xsl:value-of select="position()"/><xsl:value-of select="$groupField"/>-->
+                        </stentry>
+                    </xsl:for-each-group>
+                </xsl:for-each>
+            </strow >
+                </xsl:variable>
+                <xsl:variable name="graph.all.data.fit">
+                        <strow props="graph.all.data.fit">
+                            <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                                <xsl:variable name="groupField" select="."/>
+                                <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                    <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                    
+                                    <stentry props="pos_{position()} row_3 {$groupField} {current-grouping-key()}">
+                                        <xsl:value-of select="current-grouping-key()"/>
+                                    </stentry>
+                                </xsl:for-each-group>
+                            </xsl:for-each>
+                    </strow>
+                </xsl:variable>
+                <xsl:variable name="graph.data">
+                    <strow props="graph.data">
+                        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                            <xsl:variable name="groupField" select="."/>
+                            <!--<stentry>
+                        <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/>
+                    </stentry>-->
+                            <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                <stentry audience="{system_cache__dita:graph.audience(system_cache__dita:localname.translate($groupField),*[local-name() = $groupField ])}" props="pos_{position()} row_1  {$groupField} {current-grouping-key()} value" current-grouping-key="{current-grouping-key()}">
+                                    <xsl:value-of select="ancestor-or-self::*[@leadingNumber][1]/value"/>
+                                </stentry>
+                                <stentry audience="{system_cache__dita:graph.audience(system_cache__dita:localname.translate($groupField),*[local-name() = $groupField ])}" props="pos_{position()} row_2 {$groupField} {current-grouping-key()} norm" current-grouping-key="{current-grouping-key()}">
+                                    <xsl:value-of select="ancestor-or-self::*[@leadingNumber][1]/norm"/>
+                                </stentry>
+                                <stentry audience="{system_cache__dita:graph.audience(system_cache__dita:localname.translate($groupField),*[local-name() = $groupField ])}" props="pos_{position()} row_3 {$groupField} {current-grouping-key()} sum" current-grouping-key="{current-grouping-key()}">
+                                    <xsl:value-of select="sum(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField]/number(text()))"/>
+                                </stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each>
+                    </strow>
+                </xsl:variable>                
+                <xsl:variable name="graph.title">
+                    <strow props="graph.title">
+                        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                            <xsl:variable name="groupField" select="."/>
+                            <!--<stentry>
+                                <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/>
+                            </stentry>-->
+                            <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                <stentry audience="{system_cache__dita:graph.audience(system_cache__dita:localname.translate($groupField),*[local-name() = $groupField ])}"  group="{system_cache__dita:graph.title.group(current-grouping-key(),system_cache__dita:localname.translate($groupField),*[local-name()=$groupField])}" current-grouping-key="{current-grouping-key()}" props="pos_{position()} row_1 {$groupField} {current-grouping-key()}">"wartość <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/> <xsl:value-of select="*[local-name()=$groupField]"/>"</stentry>  
+                                <stentry audience="{system_cache__dita:graph.audience(system_cache__dita:localname.translate($groupField),*[local-name() = $groupField ])}" group="{system_cache__dita:graph.title.group(current-grouping-key(),system_cache__dita:localname.translate($groupField),*[local-name()=$groupField])}" current-grouping-key="{current-grouping-key()}" props="pos_{position()} row_2 {$groupField} {current-grouping-key()}">"norma <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/> <xsl:value-of select="*[local-name()=$groupField]"/>"</stentry>
+                                <stentry audience="{system_cache__dita:graph.audience(system_cache__dita:localname.translate($groupField),*[local-name() = $groupField ])}"  group="{system_cache__dita:graph.title.group(current-grouping-key(),system_cache__dita:localname.translate($groupField),*[local-name()=$groupField])}" current-grouping-key="{current-grouping-key()}" props="pos_{position()} row_3 {$groupField} {current-grouping-key()}">"koszt <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/> <xsl:value-of select="*[local-name()=$groupField]"/>"</stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each>
+                    </strow>
+                </xsl:variable>                
+                <xsl:variable name="graph.color.name">
+                    <strow props="graph.color.name">
+                        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                            <xsl:variable name="groupField" select="."/>
+                            <!--<stentry>
+                                <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/>
+                            </stentry>-->
+                            <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                <stentry >blue</stentry>
+                                <stentry >green</stentry>
+                                <stentry >red</stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each>
+                    </strow>
+                </xsl:variable>
+                <xsl:variable name="graph.yaxis">
+                    <strow props="graph.yaxis">
+                        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                            <xsl:variable name="groupField" select="."/>
+                            <!--<stentry>
+                                <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/>
+                            </stentry>-->
+                            <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                <stentry/>
+                                <stentry/>
+                                <stentry>2</stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each>
+                    </strow>
+                </xsl:variable>
+                <xsl:variable name="graph.fill.style">
+                    <strow props="graph.fill.style">
+                        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                            <xsl:variable name="groupField" select="."/>
+                            <!--<stentry>
+                                <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/>
+                            </stentry>-->
+                            <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                <stentry  props="graph.notitle"><!-- props="graph.notitle" -->
+                                    <xsl:choose>
+                                        <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style) &gt;1">
+                                            <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style"/>
+                                        </xsl:when>
+                                        <xsl:otherwise> fc "blue"   </xsl:otherwise><!-- with boxes  -->
+                                    </xsl:choose>
+                                </stentry>
+                                <stentry props="graph.notitle"><!-- props="graph.notitle" -->
+                                    <xsl:choose>
+                                        <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style) &gt;1">
+                                            <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style"/>
+                                        </xsl:when>
+                                        <xsl:otherwise> fc "green"   </xsl:otherwise><!-- with boxes  -->
+                                    </xsl:choose>
+                                </stentry>
+                                <stentry props="graph.notitle"><!-- props="graph.notitle" -->
+                                    <xsl:choose>
+                                        <xsl:when test="1=2 and string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style) &gt;1">
+                                            <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style"/>
+                                        </xsl:when>
+                                        <xsl:otherwise>   lw 2  </xsl:otherwise><!-- with impulses -->
+                                    </xsl:choose>
+                                </stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each>
+                    </strow>
+                </xsl:variable>
+                <xsl:variable name="graph.newhistogram">
+                    <strow props="graph.newhistogram">
+                        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                            <xsl:variable name="groupField" select="."/>
+                            <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="*[ local-name()=$groupField]/text()"><!-- ancestor-or-self::*[@leadingNumber][1]/@leadingNumber -->
+                                <xsl:sort select="*[ local-name()=$default_db__x3A__BI_audit_BENFORD:groupField]/number(text())" order="descending" data-type="number"/><!-- ancestor-or-self::*[@leadingNumber][1] -->
+                                <!--<stentry props="graph.notitle"><xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style"/></stentry>
+                                <stentry props="graph.notitle"></stentry>
+                                <stentry props="graph.notitle"><xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style"/></stentry>
+                               -->
+                                <!--<stentry props="pos_{position()} row_1 {$groupField} {current-grouping-key()}">
+                                    <xsl:value-of select="system_cache__dita:graph.lingstring__x3A__break(system_cache__dita:localname.translate($groupField),10)"/>
+                                    <xsl:value-of select="system_cache__dita:graph.lingstring__x3A__break(*[local-name() = $groupField ],15)"/>
+                                </stentry>-->
+                                <!--<stentry props="pos_{position()} row_2 {$groupField} {current-grouping-key()}">
+                                    <xsl:value-of select="system_cache__dita:graph.lingstring__x3A__break(system_cache__dita:localname.translate($groupField),15)"/>
+                                    <xsl:value-of select="system_cache__dita:graph.lingstring__x3A__break(*[local-name() = $groupField ],15) "/>
+                                </stentry>-->
+                                <stentry props="pos_{position()} row_3 {$groupField} {current-grouping-key()}" audience="{system_cache__dita:graph.audience(system_cache__dita:localname.translate($groupField),*[local-name() = $groupField ])}">
+                                    <xsl:value-of select="system_cache__dita:localname.translate($groupField)"/><!-- system_cache__dita:graph.lingstring__x3A__break -->
+                                    <xsl:value-of select="*[local-name() = $groupField ]"/><!-- system_cache__dita:graph.lingstring__x3A__break( -->
+                                </stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each>
+                    </strow>
+                </xsl:variable>
+                <xsl:call-template name="system_cache__dita:graph.all.data.fit.fix">
+                    <xsl:with-param name="graph.basecolumns.count" select="3"/>
+                    <xsl:with-param name="graph.headers" select="$graph.headers"/>
+                    <xsl:with-param name="graph.data" select="$graph.data"/>
+                    <xsl:with-param name="graph.title" select="$graph.title"/>
+                    <xsl:with-param name="graph.color.name" select="$graph.color.name"/>
+                    <xsl:with-param name="graph.yaxis" select="$graph.yaxis"/>
+                    <xsl:with-param name="graph.fill.style" select="$graph.fill.style"/>
+                    <xsl:with-param name="graph.newhistogram" select="$graph.newhistogram"/>
+                    <xsl:with-param name="graph.all.data.fit" select="$graph.all.data.fit"/>
+                </xsl:call-template>
+        </simpletable>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="$simpletable//stentry">
+                <p>  </p><!-- (BAKUX-) wykres -->
+                <foreign>
+                    <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
+                </foreign>
+                <p>   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                    <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                    <xsl:with-param name="width" select="170"/>
+                    <xsl:with-param name="height" select="200"/>
+                    <xsl:with-param name="path.prefix">../</xsl:with-param>
+                </xsl:apply-templates>
+                </p>
+            </xsl:when>
+            <xsl:otherwise>
+                <p props="302">
+                </p>
+            </xsl:otherwise>
+        </xsl:choose>
         <p>
-            <menucascade>
-                <uicontrol>liczba</uicontrol>
-                <uicontrol><varname><xsl:value-of select="$source.remote.join.val.leadingNumber"/></varname></uicontrol>
+            <simpletable props="nograph" frame="bottom">
+                <strow>
+                    <stentry><sub>liczba</sub></stentry>
+                    <stentry><sub>wart.</sub></stentry>
+                    <stentry><sub>ilość</sub></stentry>
+                    
+                </strow>
+                <strow>
+                    <stentry><sub><xsl:value-of select="$source.remote.join.val.leadingNumber"/></sub></stentry>
+                    <stentry><sub><xsl:value-of select="sum($context.source.group[1]/*[local-name()=$context.source][1]/number(text()))"/></sub></stentry>
+                    <stentry><sub><xsl:value-of select="count($context.source.group/current-group())"/></sub></stentry>
+                </strow>
+                
+                
+                <strow>
+                    <stentry><sub><xsl:value-of select="system_cache__dita:localname.translate($context.dest)"/></sub></stentry>
+                    <stentry><sub>
+                        <xsl:variable name="system_cache__dita:indexterm.index-see-also">
+                            <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+                                <xsl:variable name="groupField" select="."/>
+                                <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                    <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                    <xsl:copy-of select="system_cache__dita:indexterm.index-see-also(*[local-name()=$groupField],'')"/><!-- system_cache__dita:localname.translate($groupField) -->
+                                </xsl:for-each-group>
+                            </xsl:for-each>
+                        </xsl:variable>
+                        <xsl:call-template name="system_cache__dita:indexterm">
+                            <xsl:with-param name="indexterm" select="$current[1]/*[local-name()=$context.dest]/text()"/>
+                            <xsl:with-param name="system_cache__dita:indexterm" select="system_cache__dita:indexterm('BAKU',system_cache__dita:localname.translate($context.dest))"/>
+                            <xsl:with-param name="system_cache__dita:indexterm.index-see" select="system_cache__dita:indexterm.index-see($current[1]/*[local-name()=$context.dest]/text(),'')"/>
+                            <xsl:with-param name="system_cache__dita:indexterm.index-see-also" select="$system_cache__dita:indexterm.index-see-also"/>
+                        </xsl:call-template>
+                        <!--<xsl:value-of select="$current[1]/*[local-name()=$context.dest]/text()"/>--></sub></stentry>
+                    <stentry><sub><xsl:value-of select="count($current)"/></sub></stentry>
+                </strow>
+            </simpletable>
+            <!--<menucascade>
+                <!-\-<uicontrol>liczba</uicontrol>-\->
+                <!-\-<uicontrol><varname><xsl:value-of select="$source.remote.join.val.leadingNumber"/></varname></uicontrol>-\->
                 <uicontrol>wart.</uicontrol>
                 <uicontrol><varname><xsl:value-of select="sum($context.source.group[1]/*[local-name()=$context.source][1]/number(text()))"/></varname></uicontrol>
                 <uicontrol>ilość</uicontrol>
                 <uicontrol><varname><xsl:value-of select="count($context.source.group/current-group())"/></varname></uicontrol>
-            </menucascade>
+            </menucascade>-->
             
-            <menucascade>
+            <!--<menucascade>
                 <uicontrol>do</uicontrol>
                 <uicontrol><varname><xsl:value-of select="system_cache__dita:localname.translate($context.dest)"/></varname></uicontrol>
                 <uicontrol>wart.</uicontrol>
@@ -197,12 +473,11 @@
                     <uicontrol>ilość</uicontrol>
                     <uicontrol><varname><xsl:value-of select="count($current)"/></varname></uicontrol>
                 </xsl:if>
-            </menucascade>
-
+            </menucascade>-->
+            
         </p>
-        
         <xsl:variable name="generate-id" select="concat($uuid,'BI_audit_BENFORD.deal_analys.contrast.uniques.topic_9_',$src.position,'_',$position,'_',position(),$context.dest,generate-id($current),'__',generate-id($context))"/>
-        <simpletable frame="all"  id="uniques.topic_{$generate-id}{$context.dest}{generate-id()}" props="nograph font30" ><!-- system_cache__dita:width_cols="auto"  system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" --> <!-- system_cache__dita:width_cols="10" system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" -->
+        <!--<simpletable frame="all"  id="uniques.topic_{$generate-id}{$context.dest}{generate-id()}" props="nograph font30" ><!-\- system_cache__dita:width_cols="auto"  system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" -\-> <!-\- system_cache__dita:width_cols="10" system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" -\->
             
             <sthead props="dst_cnt">
                 <stentry><xsl:value-of select="system_cache__dita:localname.translate($default_db__x3A__BI_audit_BENFORD:valueField)"/></stentry>
@@ -216,68 +491,18 @@
                 <stentry><xsl:value-of select="system_cache__dita:localname.translate($default_db__x3A__BI_audit_BENFORD:valueField)"/></stentry>
                 <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
                     <xsl:variable name="groupField" select="."/>
-                    <!--<xsl:for-each select="$context//default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD[*[local-name() = $groupField] [ text()=$current/*[ local-name()=$groupField]/text() ]]" >-->
-                       <!-- <xsl:choose>
+                    <!-\-<xsl:for-each select="$context//default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD[*[local-name() = $groupField] [ text()=$current/*[ local-name()=$groupField]/text() ]]" >-\->
+                       <!-\- <xsl:choose>
                             <xsl:when test="position() &gt; number($default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.table.width.param)"/>
-                            <xsl:otherwise>-->
+                            <xsl:otherwise>-\->
                     <stentry> <xsl:value-of select="$current/*[local-name()=$groupField]/text()"/></stentry>
-                            <!--</xsl:otherwise>
-                        </xsl:choose>-->
-                    <!--</xsl:for-each>-->
-                </xsl:for-each>
-            </strow>
-            <xsl:variable name="generate-id" select="concat($uuid,'uniques.topic_4_',$src.position,'_',$position,'_',position(),$context.dest,generate-id($current),'__',generate-id($context))"/>
-            <strow props="dst_val2">
-                <stentry><xsl:value-of select="system_cache__dita:localname.translate($default_db__x3A__BI_audit_BENFORD:valueField)"/></stentry>
-                <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
-                    <xsl:variable name="groupField" select="."/>
-                    <!--<stentry> <xsl:value-of select="count($context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]/*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField])"/> ;  </stentry>-->
-                    <stentry>
-                        <!--<xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="*[local-name()=$groupField]">
-                             <xsl:value-of select="count(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField])"/>
-                        </xsl:for-each-group>-->
-                    <xsl:variable name="simpletable"> 
-                        <simpletable frame="all"  id="{$uuid}_AAta2ble_int{position()}.{$generate-id}.{generate-id($context[1]//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  [.=$current/*[ local-name()=$groupField]] ]][1])}" props="font30 logscale">
-                            <strow>
-                                <stentry>0</stentry>
-                                <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber"><!-- *[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField] -->
-                                    <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
-                                    <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(string(system_cache__dita:big_values_format(sum(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField]))))"/></stentry>
-                                </xsl:for-each-group>
-                            </strow>
-                            <strow>
-                                <stentry>0</stentry>
-                                <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
-                                    <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
-                                    <stentry>
-                                        <xsl:value-of select="round(sum(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField]/number(text())))"/>
-                                    </stentry>
-                                </xsl:for-each-group>
-                            </strow>
-                        </simpletable>   
-                    </xsl:variable>
-                        <xsl:choose>
-                            <xsl:when test="$simpletable//stentry ">
-                                <p>
-                                <foreign props="exclude">
-                                    <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
-                                </foreign>
-                                </p>
-                                <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
-                                    <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
-                                    <xsl:with-param name="width" select="100"/>
-                                    <xsl:with-param name="path.prefix">../</xsl:with-param>
-                                </xsl:apply-templates>
-                            </xsl:when>
-                            <xsl:otherwise>
-                                <xsl:message>#319 problem with internakl table </xsl:message>
-                            </xsl:otherwise>
-                        </xsl:choose>   
-                    </stentry>
-                
+                            <!-\-</xsl:otherwise>
+                        </xsl:choose>-\->
+                    <!-\-</xsl:for-each>-\->
                 </xsl:for-each>
-                
             </strow>
+            
+            
             <xsl:variable name="generate-id" select="concat($uuid,'BI_audit_BENFORD.deal_analys.contrast.uniques.topic_3_',$src.position,'_',$position,'_',position(),$context.dest,generate-id($current),'__',generate-id($context))"/>
             <strow props="dst_val3">
                 
@@ -288,27 +513,58 @@
                     <stentry>
                         
                         <xsl:variable name="simpletable"> 
-                        <simpletable frame="all"  id="{$uuid}_BBBtable_int{position()}.{$generate-id}.{generate-id($context[1]//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  [.=$current/*[ local-name()=$groupField]] ]][1])}" props="font30">
-                            <strow>
-                                <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber"><!-- *[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField] -->
+                            <title>BAKU-<xsl:value-of select="position()"/></title>
+                            <simpletable frame="all"  id="{$uuid}_BBBtable_int{position()}.{$generate-id}.{generate-id($context[1]//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  [.=$current/*[ local-name()=$groupField]] ]][1])}" props="font15 graph.style.histogram graph.ylabel.benford graph.y2label.koszt graph.nokey">
+                                <strow props="graph.headers">
+                                <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber"><!-\- *[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField] -\->
                                     <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                    <stentry props="graph.xtic"><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(ancestor-or-self::*[@leadingNumber][1]/@leadingNumber)"/></stentry>
                                     <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat('$',ancestor-or-self::*[@leadingNumber][1]/@leadingNumber))"/></stentry>
                                     <stentry>
                                         <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(current-grouping-key())"/>
                                     </stentry>
                                 </xsl:for-each-group>
                             </strow>
-                            <strow>
+                            <strow props="graph.data">
                                 <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
                                     <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
-                                    <stentry>
+                                    <stentry >
+                                        <xsl:value-of select="ancestor-or-self::*[@leadingNumber][1]/value"/>
+                                    </stentry>
+                                    <stentry >
                                         <xsl:value-of select="ancestor-or-self::*[@leadingNumber][1]/norm"/>
                                     </stentry>
                                     <stentry>
-                                        <xsl:value-of select="ancestor-or-self::*[@leadingNumber][1]/value"/>
+                                        <xsl:value-of select="sum(*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField]/number(text()))"/>
                                     </stentry>
                                 </xsl:for-each-group>
                             </strow>
+                                <strow props="graph.title">
+                                <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                    <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                    <stentry>"wartość"</stentry>
+                                    <stentry>"norma"</stentry>
+                                    <stentry>"koszt"</stentry>
+                                </xsl:for-each-group>
+                            </strow>
+                                <strow props="graph.color.name">
+                                    <!-\-<stentry>0</stentry>-\->
+                                    <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                        <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                        <stentry>blue</stentry>
+                                        <stentry>green</stentry>
+                                        <stentry>red</stentry>
+                                    </xsl:for-each-group>
+                                </strow>
+                                <strow props="graph.fill.style">
+                                    <!-\-<stentry>0</stentry>-\->
+                                    <xsl:for-each-group select="$context//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY[*[local-name() = $groupField  and text()=$current/*[ local-name()=$groupField]] ]" group-by="ancestor-or-self::*[@leadingNumber][1]/@leadingNumber">
+                                        <xsl:sort select="ancestor-or-self::*[@leadingNumber][1]" order="ascending" data-type="number"/>
+                                        <stentry><xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style"/></stentry>
+                                        <stentry><xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style"/></stentry>
+                                        <stentry><xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style"/></stentry>
+                                    </xsl:for-each-group>
+                                </strow>
                         </simpletable>   
                         </xsl:variable>
                         <xsl:choose>
@@ -320,7 +576,7 @@
                                 </p>
                                   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
                                     <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
-                                    <xsl:with-param name="width" select="100"/>
+                                    <xsl:with-param name="width" select="150"/>
                                     <xsl:with-param name="path.prefix">../</xsl:with-param>
                                 </xsl:apply-templates>
                             </xsl:when>
@@ -332,15 +588,15 @@
                     
                 </xsl:for-each>
             </strow>
-        </simpletable>
+        </simpletable>-->
         
         <xsl:variable name="generate-id" select="concat($uuid,'BI_audit_BENFORD.deal_analys.contrast.uniques.topic_6_',$src.position,'_',$position,'_',position(),$context.dest,generate-id($current),'__',generate-id($context))"/>
         
         <!--  -->
-        <xsl:variable name="simpletable"> 
+        <!--<xsl:variable name="simpletable"> 
             <simpletable frame="all" id="{$uuid}BI_audit_BENFORD.deal_analys.contrast.uniques.topic_2_{$src.position}_{$position}_{position()}{$context.dest}{generate-id($current)}__{generate-id($context)}" props="print__no">
                 <strow props="graph_fld">
-                    <xsl:for-each-group select="current-group()/*[local-name()=$context.dest]" group-by="text()"><!-- $context.dest.val.group/ -->
+                    <xsl:for-each-group select="current-group()/*[local-name()=$context.dest]" group-by="text()"><!-\- $context.dest.val.group/ -\->
                         <xsl:sort select="text()"  order="ascending" data-type="number"/>
                         <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('$')"/></stentry>
                         <stentry>
@@ -351,16 +607,16 @@
                             </xsl:variable>
                             <xsl:for-each select="$default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.leadingNumber.dst//firstStep[ @leadingNumber][1]">
                                 <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(@leadingNumber)"/>
-                                <!--<xsl:value-of select="@leadingNumber"/>--><!--<xsl:text> -\-\- </xsl:text>-->
-                                <!--<xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.leadingNumber"/>-->
-                                <!--<xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.leadingNumber" select="@*"/>-->
+                                <!-\-<xsl:value-of select="@leadingNumber"/>-\-><!-\-<xsl:text> -\\-\\- </xsl:text>-\->
+                                <!-\-<xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.leadingNumber"/>-\->
+                                <!-\-<xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.leadingNumber" select="@*"/>-\->
                             </xsl:for-each>
                         </stentry>
                     </xsl:for-each-group>
                 </strow>
                 <strow props="graph_vals">
                     
-                    <xsl:for-each-group select="current-group()/*[local-name()=$context.dest]" group-by="text()"><!-- $context.dest.val.group/ -->
+                    <xsl:for-each-group select="current-group()/*[local-name()=$context.dest]" group-by="text()"><!-\- $context.dest.val.group/ -\->
                         <xsl:sort select="text()"  order="ascending" data-type="number"/>
                         <xsl:variable name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.leadingNumber.dst">
                             <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast.uniques.leadingNumber">
@@ -380,11 +636,11 @@
                     </xsl:for-each-group>
                 </strow>
             </simpletable>
-        </xsl:variable>
-        <xsl:choose>
+        </xsl:variable>-->
+        <!--<xsl:choose>
             <xsl:when test="$simpletable//stentry and 1=2">
                 <xsl:message>#288-A OKno table  @id=<xsl:value-of select="@id"/>; @fid=<xsl:value-of select="@fid"/>;</xsl:message>
-                <!--<p> statystyka <sub>(prawidłowe wartości w połowie wysokości środku wykresu)</sub> </p>-->
+                <!-\-<p> statystyka <sub>(prawidłowe wartości w połowie wysokości środku wykresu)</sub> </p>-\->
                 <p>
                 <foreign props="exclude" >
                     <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
@@ -404,7 +660,7 @@
                     
                 </p>
             </xsl:otherwise>
-        </xsl:choose>
+        </xsl:choose>-->
         <!--<context><xsl:copy-of select="$context"></xsl:copy-of></context>-->
         <!--<current><xsl:copy-of select="$current"></xsl:copy-of></current>-->
     </xsl:template>

+ 459 - 120
SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.overwiev_table.xsl

@@ -8,8 +8,9 @@
     xmlns:p5="https://biuro.biall-net.pl/wfs"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
     xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
-    exclude-result-prefixes="p5gnuplot xs Benford system_cache__appinfo system_cache__dita get_wfs p5 xlink default_db__x3A__BI_audit_BENFORD"
+    exclude-result-prefixes="p5gnuplot xs Benford system_cache__appinfo system_cache__dita get_wfs p5 xlink default_db__x3A__BI_audit_BENFORD default_db__x3A__BI_audit_ENERGA_RUM_UMOWY"
     version="2.0">
     
     
@@ -18,6 +19,10 @@
    
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table">
         <xsl:param name="title" select="'BI_audit_BENFORD.overwiev_table'"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes" />
         <xsl:copy-of select="system_cache__dita:files.context.title.keydef(.,'map',$title)" copy-namespaces="no"/>
         <topicref props="BI_audit_BENFORD.overwiev_table">
             <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
@@ -27,13 +32,42 @@
                 <topic id="{$uuid}_{position()}_{$title}__{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
                     <title>
-                        tabela podglądowa (G)
+                        (BG)   tabele podglądowe
                     </title>
                     <body>
-                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1"/>
-                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1.graph"/>
-                        <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2"/>
-                        <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2.graph"/>
+                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1">
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
+                    </xsl:call-template>
+                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1.graph">
+                        <!--<xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField"  select="$default_db__x3A__BI_audit_BENFORD:valueField"/>-->
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
+                    </xsl:call-template>
+                       <xsl:variable name="context" select="."/>
+                        <xsl:for-each select="1 to 9">
+                            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2">
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber"  select="xs:integer(.)" />
+                                <xsl:with-param name="context" select="$context"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
+                            </xsl:call-template>
+                            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2.graph">
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber"  select="xs:integer(.)" />
+                                <xsl:with-param name="context" select="$context"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
+                                <!--<xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField"  select="$default_db__x3A__BI_audit_BENFORD:valueField"/>-->
+                            </xsl:call-template>
+                        </xsl:for-each>
                     </body>
                 </topic>
             </xsl:result-document>
@@ -43,61 +77,85 @@
     
     
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
         <xsl:variable name="context" select="."/>
-
-        <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1* 1* ">
-            <sthead>
-                <stentry>Pierwsze cyfry</stentry>
-                <stentry>Stopień analizy</stentry>
-                <stentry>Liczba wystąpień</stentry>
-                <stentry>Procent występowania</stentry>
-                <stentry>Norma %</stentry>
-                <stentry>Odchylenie %</stentry>
-                <stentry>Zgodność</stentry>
-                <!--<stentry>Szczegóły</stentry>-->
-                <!--<stentry></stentry>-->
-            </sthead>
-            
-        <xsl:for-each select="1 to 10">
-            <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1" select="$context/firstStep[@leadingNumber = string(current())]"/>
-        </xsl:for-each>
-        </simpletable>
-        
+        <section>
+            <title >(BG1)</title>
+            <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1* 1* " props="nograph">
+                <sthead>
+                    <stentry>Pierwsze cyfry</stentry>
+                    <stentry>Stopień analizy</stentry>
+                    <stentry>Liczba wystąpień</stentry>
+                    <stentry>Procent występowania</stentry>
+                    <stentry>Norma %</stentry>
+                    <stentry>Odchylenie %</stentry>
+                    <stentry>Zgodność</stentry>
+                    <!--<stentry>Szczegóły</stentry>-->
+                    <!--<stentry></stentry>-->
+                </sthead>
+                
+                <xsl:for-each select="1 to 10">
+                    <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1" select="$context/firstStep[@leadingNumber = string(current())]"/>
+                </xsl:for-each>
+            </simpletable>
+        </section>
     </xsl:template>
     
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2">
-        <xsl:variable name="context" select="."/>
-        <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1* 1* ">
-            <sthead>
-                <stentry>Pierwsze cyfry</stentry>
-                <stentry>Stopień analizy</stentry>
-                <stentry>Liczba wystąpień</stentry>
-                <stentry>Procent występowania</stentry>
-                <stentry>Norma %</stentry>
-                <stentry>Odchylenie %</stentry>
-                <stentry>Zgodność</stentry>
-                <!--<stentry>Szczegóły</stentry>-->
-                <!--<stentry></stentry>-->
-            </sthead>
-            <xsl:for-each select="11 to 99">
-                <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1" select="$context//secondStep[@leadingNumber = string(current())]"/>
-            </xsl:for-each>
-            <strow>
-                <stentry/>
-                <stentry/>
-                <stentry/>
-                <stentry/>
-                <stentry/>
-                <stentry/>
-                <stentry/>
-            </strow>
-        </simpletable>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber"  required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
+        <xsl:param name="context" required="yes"/>
+        <xsl:variable name="simpletable" >
+        <section>
+            <title >(BG2T-<xsl:value-of select="$default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber"/>)</title>
+            <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1* 1* " props="nograph">
+                <sthead>
+                    <stentry>Pierwsze cyfry</stentry>
+                    <stentry>Stopień analizy</stentry>
+                    <stentry>Liczba wystąpień</stentry>
+                    <stentry>Procent występowania</stentry>
+                    <stentry>Norma %</stentry>
+                    <stentry>Odchylenie %</stentry>
+                    <stentry>Zgodność</stentry>
+                    <!--<stentry>Szczegóły</stentry>-->
+                    <!--<stentry></stentry>-->
+                </sthead>
+                <xsl:for-each select="($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10) to (($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)">
+                    <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2" select="$context//secondStep[@leadingNumber = string(current())]"/>
+                </xsl:for-each>
+                <strow>
+                    <stentry/>
+                    <stentry/>
+                    <stentry/>
+                    <stentry/>
+                    <stentry/>
+                    <stentry/>
+                    <stentry/>
+                </strow>
+            </simpletable>
+        </section>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="$simpletable//strow/stentry/text()">
+                <xsl:copy-of select="$simpletable"/>
+            </xsl:when>
+        </xsl:choose>
     </xsl:template>
     
     
-    <xsl:template  mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1" match="text()|comment()"/>
+    <xsl:template  mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1 default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2" match="text()|comment()"/>
     
-    <xsl:template  mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1" match="firstStep|secondStep">
+    <xsl:template  mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1" match="firstStep">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
         <strow>
             <stentry><xsl:value-of select="@leadingNumber"/></stentry>
             <stentry><xsl:value-of select="system_cache__dita:localname.translate(name())"/></stentry>
@@ -112,33 +170,94 @@
         </strow>
     </xsl:template>
     
+    <xsl:template  mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2" match="secondStep">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
+        <strow>
+            <stentry><xsl:value-of select="@leadingNumber"/></stentry>
+            <stentry><xsl:value-of select="system_cache__dita:localname.translate(name())"/></stentry>
+            <stentry><xsl:value-of select="count"/></stentry>
+            <stentry><xsl:value-of select="value"/></stentry>
+            <stentry><xsl:value-of select="norm"/></stentry>
+            <stentry><xsl:value-of select="deviation"/></stentry>
+            <stentry><xsl:value-of select="system_cache__dita:localname.translate('correct',correct)"/></stentry>
+            <!--<stentry></stentry>-->
+            <!--<stentry/>-->
+            <!--<stentry/>-->
+        </strow>
+    </xsl:template>
     
     <xsl:template mode="preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" match="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD">
         <xsl:message>#113 default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA</xsl:message>
+        <xsl:variable name="default_db__x3A__BI_audit_BENFORD:valueField">
+            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:valueField"/>
+        </xsl:variable>
+        <xsl:variable name="default_db__x3A__BI_audit_BENFORD:groupField">
+            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:groupField"/>
+        </xsl:variable>
+        <xsl:variable name="default_db__x3A__BI_audit_BENFORD:timeField">
+            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:timeField"/>
+        </xsl:variable>
+        <xsl:variable name="default_db__x3A__BI_audit_BENFORD:NameField">
+            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:NameField"/>
+        </xsl:variable>
         <xsl:variable name="dita">
             <!--<xsl:apply-templates select="." mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.dita"/>-->
-            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1.graph"/>
-            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2.graph"/>
-            
             <xsl:variable name="default_db__x3A__BI_audit_BENFORD:valueField">
                 <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:valueField"/>
             </xsl:variable>
             <xsl:variable name="default_db__x3A__BI_audit_BENFORD:groupField">
                 <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:groupField"/>
             </xsl:variable>
-            <xsl:message>#129 will call parms=<xsl:value-of select="$default_db__x3A__BI_audit_BENFORD:valueField//text()"/> </xsl:message>
-            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast">
-                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField//text()" />
-                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField//text()" />
-                <xsl:with-param name="debug" select="'#131 preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA'"/>
+            <xsl:variable name="default_db__x3A__BI_audit_BENFORD:timeField">
+                <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:timeField"/>
+            </xsl:variable>
+            <xsl:variable name="default_db__x3A__BI_audit_BENFORD:NameField">
+                <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:NameField"/>
+            </xsl:variable>
+            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1.graph">
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
             </xsl:call-template>
-            
+            <xsl:variable name="context" select="."/>
+            <xsl:for-each select="1 to 9">
+                <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2.graph">
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber" select="xs:integer(.)" />
+                    <xsl:with-param name="context" select="$context"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes" />
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
+                </xsl:call-template>
+            </xsl:for-each>
+            <xsl:choose>
+                <xsl:when test="number($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.deal_analys__x3A__enable.param) &gt;0">
+                <xsl:message>#129 will call parms=<xsl:value-of select="$default_db__x3A__BI_audit_BENFORD:valueField//text()"/> </xsl:message>
+                <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys.contrast">
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes" />
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes" />
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
+                    <xsl:with-param name="debug" select="'#131 preprocess_root_BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA'"/>
+                </xsl:call-template>
+                </xsl:when>
+            </xsl:choose>
         </xsl:variable>
+        
         <xsl:for-each select="$dita//simpletable[not(@props='nograph')]">
             <xsl:apply-templates select="." mode="system_cache__dita:graph__write_dita_preprocess">
                 <xsl:with-param name="fileindex" select="@id"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes" />
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
             </xsl:apply-templates>
         </xsl:for-each>
+        
     </xsl:template>
     
     <xsl:function name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.table__x3A__offset">
@@ -149,39 +268,148 @@
     </xsl:function>
     
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_1.graph">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
         <xsl:variable name="context" select="."/>
-        <xsl:variable name="simpletable"> 
-            <simpletable frame="all" id="{$uuid}BI_audit_BENFORD.overwiev_table_1" props="print__no">
-                <strow>
-                    <!--<stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('skala 0')"/></stentry>-->
-                    <xsl:for-each select="1 to 10">
-                        <xsl:choose>
-                            <xsl:when test="$context/firstStep[@leadingNumber = string(current())]">
-                                <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('$')"/></stentry>
-                                <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names($context/firstStep[@leadingNumber = string(current())]/@leadingNumber)"/></stentry>
-                            </xsl:when>
-                        </xsl:choose>
-                    </xsl:for-each>
-                </strow>
-                <strow>
-                    <!--<stentry>0</stentry>-->
-                    <xsl:for-each select="1 to 10">
-                        <xsl:choose>
-                            <xsl:when test="$context/firstStep[@leadingNumber = string(current())]">
-                                <stentry><xsl:value-of select="$context/firstStep[@leadingNumber = string(current())]/norm"/></stentry>
-                                <stentry><xsl:value-of select="$context/firstStep[@leadingNumber = string(current())]/value"/></stentry>
-                            </xsl:when>
-                        </xsl:choose>
-                    </xsl:for-each>
-                </strow>
-            </simpletable>
+        <xsl:variable name="SIMPLETABLE_WTITLE"> 
+            <SIMPLETABLE_WTITLE>
+                <title>BG1W</title>
+                <simpletable frame="all" id="{$uuid}BI_audit_BENFORD.overwiev_table_11" props="print__no graph.style.histogram graph.ylabel.benford graph.y2label.koszt font15 "><!-- graph.nokey -->
+                        <strow props="graph.headers">
+                            <!--<stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('skala 0')"/></stentry>-->
+                            <xsl:for-each select="1 to 10">
+                                <xsl:choose>
+                                    <xsl:when test="$context/firstStep[@leadingNumber = string(current())]">
+                                        <stentry props="graph.xtic" current-grouping-key="{current()}" ><xsl:value-of select="current()"/></stentry>
+                                        <stentry current-grouping-key="{current()}"><xsl:value-of select="current()"/></stentry>
+                                        <stentry current-grouping-key="{current()}"><xsl:value-of select="current()"/></stentry>
+                                    </xsl:when>
+                                </xsl:choose>
+                            </xsl:for-each>
+                        </strow>
+                    
+                    <strow props="graph.data">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="1 to 10">
+                            <xsl:choose>
+                                <xsl:when test="$context/firstStep[@leadingNumber = string(current())]">
+                                    <stentry current-grouping-key="{.}"><xsl:value-of select="$context/firstStep[@leadingNumber = string(current())]/value"/></stentry>
+                                    <stentry current-grouping-key="{.}"><xsl:value-of select="$context/firstStep[@leadingNumber = string(current())]/norm"/></stentry>
+                                    <stentry current-grouping-key="{.}"><xsl:value-of select="sum($context/firstStep[@leadingNumber = string(current())]//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY/*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField]/number(text()))"/></stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.title">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="1 to 10">
+                            <xsl:choose>
+                                <xsl:when test="$context/firstStep[@leadingNumber = string(current())]">
+                                    <stentry audience="liczba_{.}" current-grouping-key="{.}" group="{system_cache__dita:graph.title.group(current-grouping-key(),'wartość','')}">"wartość "</stentry>
+                                    <stentry audience="liczba_{.}" current-grouping-key="{.}" group="{system_cache__dita:graph.title.group(current-grouping-key(),'norma','')}">"norma "</stentry>
+                                    <stentry audience="liczba_{.}" current-grouping-key="{.}" group="{system_cache__dita:graph.title.group(current-grouping-key(),'koszt','')}">"koszt "</stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.color.name">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="1 to 10">
+                            <xsl:choose>
+                                <xsl:when test="$context/firstStep[@leadingNumber = string(current())]">
+                                    <stentry>
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style) &gt;1">
+                                            </xsl:when>
+                                            <xsl:otherwise>blue</xsl:otherwise>
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry>
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style) &gt;1"/>
+                                            <xsl:otherwise>green</xsl:otherwise>
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry><xsl:text>red</xsl:text>
+                                        <!--<xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style) &gt;1"/>
+                                            <xsl:otherwise> red </xsl:otherwise>
+                                        </xsl:choose>-->
+                                    </stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.yaxis">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="1 to 10">
+                            <xsl:choose>
+                                <xsl:when test="$context/firstStep[@leadingNumber = string(current())]">
+                                    <stentry/>
+                                    <stentry/>
+                                    <stentry>2</stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    
+                    <strow props="graph.fill.style">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="1 to 10">
+                            <xsl:choose>
+                                <xsl:when test="$context/firstStep[@leadingNumber = string(current())]">
+                                    <stentry ><!-- props="graph.notitle" -->
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style) &gt;1">
+                                                <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style"/>
+                                            </xsl:when>
+                                            <xsl:otherwise> fc "blue" </xsl:otherwise><!--  lc "blue"  --><!-- with boxes  -->
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry ><!-- props="graph.notitle" -->
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style) &gt;1">
+                                                <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style"/>
+                                            </xsl:when>
+                                            <xsl:otherwise> fc "green" </xsl:otherwise><!--  lc "green"  --><!-- with boxes  -->
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry ><!-- props="graph.notitle" -->
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style) &gt;1">
+                                                <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style"/>
+                                            </xsl:when>
+                                            <xsl:otherwise> with impulses lw 2    </xsl:otherwise><!-- axes x1y2 --><!--  lc "red" -->
+                                        </xsl:choose>
+                                    </stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.newhistogram">
+                        <xsl:for-each select="1 to 10">
+                            <xsl:choose>
+                                <xsl:when test="$context//firstStep[@leadingNumber = string(current())]">
+                                    <stentry audience="liczba_{.}"> analiza\n liczb</stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                </simpletable>
+            </SIMPLETABLE_WTITLE>
+        </xsl:variable>
+        <xsl:variable name="simpletable">
+            <xsl:call-template name="system_cache__dita:graph.all.data.fit.fix__x3A__numerate.simpletable">
+                <xsl:with-param name="simpletable" select="$SIMPLETABLE_WTITLE"/>
+            </xsl:call-template>
         </xsl:variable>
-        
         <xsl:choose>
             <xsl:when test="$simpletable//stentry">
-                <p> statystyka <sub>(prawidłowe wartości w nieparzyste słupki)</sub> </p>
+                <p> (BG1W) wykres  </p>
                 <foreign>
-                    <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
+                    <xsl:copy-of select="$simpletable/*" copy-namespaces="no"/>
                 </foreign>
                 <p>   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
                     <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
@@ -200,37 +428,148 @@
     
     
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table_2.graph">
-        <xsl:variable name="context" select="."/>
-        <xsl:variable name="simpletable"> 
-            <simpletable frame="all" id="{$uuid}BI_audit_BENFORD.overwiev_table_2" props="print__no">
-                <strow>
-                    <!--<stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('skala 0')"/></stentry>-->
-                    <xsl:for-each select="11 to 99">
-                        <xsl:choose>
-                            <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
-                                <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('$')"/></stentry>
-                                <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names($context//secondStep[@leadingNumber = string(current())]/@leadingNumber)"/></stentry>
-                            </xsl:when>
-                        </xsl:choose>
-                    </xsl:for-each>
-                </strow>
-                <strow>
-                    <!--<stentry>0</stentry>-->
-                    <xsl:for-each select="11 to 99">
-                        <xsl:choose>
-                            <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
-                                <stentry><xsl:value-of select="$context//secondStep[@leadingNumber = string(current())]/norm"/></stentry>
-                                <stentry><xsl:value-of select="$context//secondStep[@leadingNumber = string(current())]/value"/></stentry>
-                            </xsl:when>
-                        </xsl:choose>
-                    </xsl:for-each>
-                </strow>
-            </simpletable>
-        </xsl:variable>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber" required="yes" />
+        <xsl:param name="context" required="yes"/>
+        <!--<xsl:param name="default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber" select="1"/>-->
         
-        <xsl:choose>
+        <xsl:variable name="SIMPLETABLE_WTITLE">
+            <SIMPLETABLE_WTITLE>
+                <xsl:message>#267 will do <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10"/> to <xsl:value-of select="(($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)"/> </xsl:message>
+                <title>BG2W</title>
+                <simpletable frame="all" id="{$uuid}BI_audit_BENFORD.overwiev_table_2_{$default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber}" props="graph.ylabel.benford graph.y2label.koszt graph.style.histogram font15 "><!-- graph.nokey -->
+                    <strow props="graph.headers">
+                        <!--<stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('skala 0')"/></stentry>-->
+                        <xsl:for-each select="($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10) to (($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)">
+                            <xsl:choose>
+                                <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
+                                    <stentry props="graph.xtic" current-grouping-key="{current()}"><xsl:value-of select="current()"/></stentry>
+                                    <stentry current-grouping-key="{current()}"><xsl:value-of select="current()"/></stentry>
+                                    <stentry current-grouping-key="{current()}"><xsl:value-of select="current()"/></stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.data">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10) to (($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)">
+                            <xsl:choose>
+                                <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
+                                    <stentry current-grouping-key="{.}"><xsl:value-of select="$context//secondStep[@leadingNumber = string(current())]/value"/></stentry>
+                                    <stentry current-grouping-key="{.}"><xsl:value-of select="$context//secondStep[@leadingNumber = string(current())]/norm"/></stentry>
+                                    <stentry current-grouping-key="{.}"><xsl:value-of select="sum($context//secondStep[@leadingNumber = string(current())]//default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY/*[local-name()=$default_db__x3A__BI_audit_BENFORD:valueField]/number(text()))"/></stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.title">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10) to (($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)">
+                            <xsl:choose>
+                                <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
+                                    <stentry audience="liczba_{.}" current-grouping-key="{.}" group="{system_cache__dita:graph.title.group(current-grouping-key(),'wartość','')}">"wartość"</stentry>
+                                    <stentry audience="liczba_{.}" current-grouping-key="{.}" group="{system_cache__dita:graph.title.group(current-grouping-key(),'norma','')}">"norma"</stentry>
+                                    <stentry audience="liczba_{.}" current-grouping-key="{.}" group="{system_cache__dita:graph.title.group(current-grouping-key(),'koszt','')}">"koszt"</stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.color.name">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10) to (($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)">
+                            <xsl:choose>
+                                <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
+                                    <stentry>
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style) &gt;1">
+                                            </xsl:when>
+                                            <xsl:otherwise>blue</xsl:otherwise>
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry>
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style) &gt;1"/>
+                                            <xsl:otherwise>green</xsl:otherwise>
+                                        </xsl:choose>
+                                    </stentry>
+                                   <!-- <xsl:choose>-->
+                                        <stentry><xsl:text>red</xsl:text>
+                                       <!-- <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style) &gt;1"/>
+                                        <xsl:otherwise> red </xsl:otherwise>-->
+                                        </stentry>
+                                    <!--</xsl:choose>-->
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.yaxis">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10) to (($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)">
+                            <xsl:choose>
+                                <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
+                                    <stentry/>
+                                    <stentry/>
+                                    <stentry>2</stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.fill.style">
+                        <!--<stentry>0</stentry>-->
+                        <xsl:for-each select="($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10) to (($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)">
+                            <xsl:choose>
+                                <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
+                                    <stentry ><!-- props="graph.notitle" -->
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style) &gt;1">
+                                                <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style"/>
+                                            </xsl:when>
+                                            <xsl:otherwise> fc "blue" </xsl:otherwise><!-- lc "blue" --><!-- with boxes  -->
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry ><!-- props="graph.notitle" -->
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style) &gt;1">
+                                                <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style"/>
+                                            </xsl:when>
+                                            <xsl:otherwise> fc "green" </xsl:otherwise><!--  lc "green"   --><!-- with boxes  -->
+                                        </xsl:choose>
+                                    </stentry>
+                                    <stentry ><!-- props="graph.notitle" -->
+                                        <xsl:choose>
+                                            <xsl:when test="string-length($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style) &gt;1">
+                                                <xsl:value-of select="$default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style"/>
+                                            </xsl:when>
+                                            <xsl:otherwise> with impulses  lw 2  </xsl:otherwise><!-- axes x1y2 --><!-- lc "red" -->
+                                        </xsl:choose>
+                                    </stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                    <strow props="graph.newhistogram">
+                        <xsl:for-each select="($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10) to (($default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber*10)+9)">
+                            <xsl:choose>
+                                <xsl:when test="$context//secondStep[@leadingNumber = string(current())]">
+                                    <stentry audience="liczba_{.}"> analiza \n liczb</stentry>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </strow>
+                </simpletable>
+            </SIMPLETABLE_WTITLE>
+        </xsl:variable>
+        <xsl:variable name="simpletable">
+            <xsl:call-template name="system_cache__dita:graph.all.data.fit.fix__x3A__numerate.simpletable">
+                <xsl:with-param name="simpletable" select="$SIMPLETABLE_WTITLE"/>
+            </xsl:call-template>
+        </xsl:variable>
+            <xsl:choose>
             <xsl:when test="$simpletable//stentry">
-                <p> statystyka <sub>(prawidłowe wartości w nieparzyste słupki)</sub></p>
+                <p> (BG2W-<xsl:value-of select="$default_db__x3A__BI_audit_BENFORD:secondStep.leadingNumber"/>) wykres </p>
                 <foreign>
                     <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
                 </foreign>
@@ -246,7 +585,7 @@
                 </p>
             </xsl:otherwise>
         </xsl:choose>
-
+        
     </xsl:template>
     
 </xsl:stylesheet>

+ 17 - 7
SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.podglad_analizy_liczb.records.xsl

@@ -21,6 +21,10 @@
     <xsl:template mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb.records" match="*">
         <xsl:param name="count"  required="yes"/>
         <xsl:param name="system_cache__dita:topic_name" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes"/>
         <xsl:variable name="default_db__x3A__BI_audit_BENFORD:valueField" select="ancestor::default_db__x3A__BI_audit_BENFORD:valueField[1]/text()"/>
         <xsl:variable name="default_db__x3A__BI_audit_BENFORD:groupField" select="ancestor::default_db__x3A__BI_audit_BENFORD:groupField[1]/text()"/>
         <xsl:variable name="leadingNumber" select="@leadingNumber"/>
@@ -28,7 +32,7 @@
         <topic>
             <xsl:copy-of select="system_cache__dita:files.key.topic.title.attrs.context(.,'topic',$system_cache__dita:topic_name)"/>
             <title>
-                Wybrane obiekty z raportu z rejestrów: 
+             (BNPG1)   Wybrane obiekty z raportu z rejestrów: 
                 <xsl:for-each-group select="*[@fid]" group-by="local-name()">
                     <xsl:text> </xsl:text>    <xsl:value-of select="local-name()"/> - ilość <xsl:value-of select="count(current-group())"/><xsl:text> </xsl:text>
                 </xsl:for-each-group>
@@ -107,9 +111,11 @@
     
     <xsl:template mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb.records.all" match="*">
         <xsl:param name="system_cache__dita:topic_name" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:count"   select="default_db__x3A__BI_audit_BENFORD:count"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  select="default_db__x3A__BI_audit_BENFORD:valueField"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  select="default_db__x3A__BI_audit_BENFORD:groupField"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:count"   select="default_db__x3A__BI_audit_BENFORD:count" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  select="default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  select="default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  select="default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  select="default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
         <xsl:param name="system_cache__dita:files.key.title.context.href.all_table" required="yes"/>
         
         <xsl:variable name="system_cache__dita:files.key.topic.id.context.value.all_table" select="system_cache__dita:files.key.topic.title.id.context.value(.,'podglad_analizy_liczb__records__all_table')"/>
@@ -215,9 +221,13 @@
     
     <xsl:template mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb.records.all.table" match="*">
         <xsl:param name="system_cache__dita:topic_name" required="yes"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:count"   select="default_db__x3A__BI_audit_BENFORD:count"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  select="default_db__x3A__BI_audit_BENFORD:valueField"/>
-        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  select="default_db__x3A__BI_audit_BENFORD:groupField"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:count"   select="default_db__x3A__BI_audit_BENFORD:count" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  select="default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  select="default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  select="default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  select="default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes"/>
+        
+        
         <xsl:variable name="leadingNumber" select="@leadingNumber"/>
         <xsl:variable name="count_percent_cout" select="round(number($default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb.records.count_percent) * number($default_db__x3A__BI_audit_BENFORD:count)  div 1000 )"/>
         <xsl:variable name="count_percent_cout">

+ 16 - 1
SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.podglad_analizy_liczb.xsl

@@ -15,7 +15,10 @@
     
    
     <xsl:template mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb" match="firstStep|secondStep">
-            
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes"  />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"   tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
             <topicref props="podglad_analizy_liczb_19" print="no">
                 <xsl:copy-of select="system_cache__dita:files.key.href.map.title.context(.,'podglad_analizy_liczb')"/>
                 <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,'podglad_analizy_liczb')}">
@@ -56,6 +59,10 @@
                             <lq>
                                 <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.fields">
                                     <xsl:with-param name="system_cache__dita:element" select="'lq'"/>
+                                    <!--<xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField"  select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes" />
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField"  select="$default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField"  select="$default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField"  select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>-->
                                 </xsl:apply-templates>
                             </lq>
                         </body>
@@ -70,6 +77,10 @@
                                 <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb.records" select=".">
                                     <xsl:with-param name="count" select="count"/>
                                     <xsl:with-param name="system_cache__dita:topic_name" select="$system_cache__dita:topic_name"/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField"  select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes" />
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField"  select="$default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField"  select="$default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField"  select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
                                 </xsl:apply-templates>
                                                                     
                             </xsl:result-document>
@@ -103,6 +114,10 @@
     
     <xsl:template mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb" match="fixxxrstStep">
         <xsl:param name="system_cache__dita:element" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
         <xsl:apply-templates mode="#current">
             <xsl:with-param name="system_cache__dita:element" select="'lq'"/>
         </xsl:apply-templates>

+ 119 - 15
SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.xsl

@@ -27,6 +27,16 @@
     <xsl:include href="default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.deal_analys.xsl"/>
     <xsl:include href="default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.NWK3.xsl"/>
     
+    <xsl:include href="default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD__x3A__generate.xsl"/>
+    
+    <xsl:param name="default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.values.graph.fill.style"> </xsl:param><!-- with boxes  lw 3  fs solid  fillcolor  "blue" -->
+    
+    <xsl:param name="default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.cost.graph.fill.style"> with impulses  lw 2 </xsl:param><!-- axes x1y2 --><!-- lc "red" --><!-- , "" using 0:${column}:${column}:xtic(1)  with labels  center boxed notitle col axes x1y2 -->
+    <xsl:param name="default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.norm.graph.fill.style"> </xsl:param> <!-- with impulses lw 8   lc "red" , "" using ${column}:xtic(1)  notitle col with  points lw 4 ps 3 pt 4  lc "red"  -->
+    
+    <xsl:param name="default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.deal_analys__x3A__enable.param" select="1"/>
+    
+    
     <xsl:template match="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD" mode="ditamap_root">
         <!--<xsl:result-document href="energa_bledy_rum.ditamap">-->
         <map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -55,7 +65,8 @@
         <default_db__x3A__BI_audit_BENFORD:valueField>
             <xsl:choose>
                 <xsl:when test="default_db__x3A__BI_audit_BENFORD:valueField"><xsl:value-of select="default_db__x3A__BI_audit_BENFORD:valueField"/>
-                    <xsl:message>%57 input param default_db__x3A__BI_audit_BENFORD:groupField = <xsl:value-of select="default_db__x3A__BI_audit_BENFORD:valueField"/></xsl:message></xsl:when>
+                    <xsl:message>#57-68 input param default_db__x3A__BI_audit_BENFORD:groupField = <xsl:value-of select="default_db__x3A__BI_audit_BENFORD:valueField"/></xsl:message></xsl:when>
+                <xsl:when test="valueField"><xsl:value-of select="valueField"/></xsl:when>
                 <xsl:otherwise>Data_utworzenia_sprawy,Wprowadzajacy_wniosek___nazwisko_i_imie,Data_zawarcia,Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie__aktualna_</xsl:otherwise>
             </xsl:choose>
         </default_db__x3A__BI_audit_BENFORD:valueField>
@@ -65,13 +76,35 @@
         <default_db__x3A__BI_audit_BENFORD:groupField>
             <xsl:choose>
                 <xsl:when test="default_db__x3A__BI_audit_BENFORD:groupField"><xsl:value-of select="default_db__x3A__BI_audit_BENFORD:groupField"/>
-                    <xsl:message>%57 input param default_db__x3A__BI_audit_BENFORD:groupField = <xsl:value-of select="default_db__x3A__BI_audit_BENFORD:groupField"/></xsl:message></xsl:when>
+                    <xsl:message>#57-78 input param default_db__x3A__BI_audit_BENFORD:groupField = <xsl:value-of select="default_db__x3A__BI_audit_BENFORD:groupField"/></xsl:message></xsl:when>
+                <xsl:when test="groupField"><xsl:value-of select="groupField"/></xsl:when>
                 <xsl:otherwise>Data_utworzenia_sprawy,Wprowadzajacy_wniosek___nazwisko_i_imie,Data_zawarcia,Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie__aktualna_</xsl:otherwise>
             </xsl:choose>
         </default_db__x3A__BI_audit_BENFORD:groupField>
     </xsl:template>
     
+    <xsl:template name="default_db__x3A__BI_audit_BENFORD:timeField" >
+        <default_db__x3A__BI_audit_BENFORD:timeField>
+            <xsl:choose>
+                <xsl:when test="default_db__x3A__BI_audit_BENFORD:timeField"><xsl:value-of select="default_db__x3A__BI_audit_BENFORD:timeField"/>
+                    <xsl:message>#57-88 input param default_db__x3A__BI_audit_BENFORD:timeField = <xsl:value-of select="default_db__x3A__BI_audit_BENFORD:timeField"/></xsl:message></xsl:when>
+                <xsl:when test="timeField"><xsl:value-of select="timeField"/></xsl:when>
+                <xsl:otherwise>Data_zawarcia</xsl:otherwise>
+            </xsl:choose>
+        </default_db__x3A__BI_audit_BENFORD:timeField>
+    </xsl:template>
+    
     
+    <xsl:template name="default_db__x3A__BI_audit_BENFORD:NameField" >
+        <default_db__x3A__BI_audit_BENFORD:NameField>
+            <xsl:choose>
+                <xsl:when test="default_db__x3A__BI_audit_BENFORD:NameField"><xsl:value-of select="default_db__x3A__BI_audit_BENFORD:NameField"/>
+                    <xsl:message>#57-102 input param default_db__x3A__BI_audit_BENFORD:NameField = <xsl:value-of select="default_db__x3A__BI_audit_BENFORD:NameField"/></xsl:message></xsl:when>
+                <xsl:when test="NameField"><xsl:value-of select="NameField"/></xsl:when>
+                <xsl:otherwise><xsl:text>nazwisko,imiona,nazwa</xsl:text><xsl:message>##57-104 set default param default_db__x3A__BI_audit_BENFORD:NameField</xsl:message></xsl:otherwise>
+            </xsl:choose>
+        </default_db__x3A__BI_audit_BENFORD:NameField>
+    </xsl:template>
     
     <xsl:template mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD" match="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD">
         <topichead >
@@ -81,25 +114,59 @@
                 <xsl:copy-of select="system_cache__dita:files.key.href.map.context(.)" />
                 <xsl:copy-of select="system_cache__dita:files.context.title.keys(.,$title)" copy-namespaces="no"/>
                 <!--<xsl:copy-of select="system_cache__dita:files.context.title.keydef(.,'map',$title)" copy-namespaces="no"/>-->
+                <xsl:variable name="default_db__x3A__BI_audit_BENFORD:valueField">
+                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:valueField"/>
+                </xsl:variable>
+                <xsl:variable name="default_db__x3A__BI_audit_BENFORD:timeField">
+                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:timeField"/>
+                </xsl:variable>
+                <xsl:variable name="default_db__x3A__BI_audit_BENFORD:NameField">
+                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:NameField"/>
+                </xsl:variable>
+                <xsl:variable name="default_db__x3A__BI_audit_BENFORD:groupField">
+                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:groupField"/>
+                </xsl:variable>
                 <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.context(.)}"> 
-                    <topic >
+                    <topic props="raport.BT">
                         <xsl:copy-of select="system_cache__dita:files.key.topic.attrs.context(.,'topic')"/>
-                        <title>
+                        <title>(BT)
                             Raport analizy benforda Nr <xsl:value-of select="@p5:primaryKey"/> dla <xsl:value-of select="count(firstStep/count/number(text()))"/> rekordów 
-                            <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.info" />
+                            <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.info" >
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
+                            </xsl:apply-templates>
                         </title>
                         <body>
                             <ol>
                             <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.body" >
                                 <xsl:with-param name="system_cache__dita:element" select="'ol'"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
                             </xsl:apply-templates>
                             </ol>
                         </body>
                         
                     </topic>
                 </xsl:result-document>
-                <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table"/>
-                <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb" />
+               
+                <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.overwiev_table">
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField//text()" tunnel="yes"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField//text()" tunnel="yes"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField//text()" tunnel="yes"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField//text()" tunnel="yes"/>
+                </xsl:call-template>
+                
+                
+                <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.podglad_analizy_liczb" >
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField//text()"  tunnel="yes"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField//text()" tunnel="yes" />
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField//text()" tunnel="yes"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField//text()" tunnel="yes"/>
+                </xsl:apply-templates>
             </topicref>
             
             <xsl:variable name="default_db__x3A__BI_audit_BENFORD:valueField">
@@ -108,16 +175,38 @@
             <xsl:variable name="default_db__x3A__BI_audit_BENFORD:groupField">
                 <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:groupField"/>
             </xsl:variable>
+            <xsl:variable name="default_db__x3A__BI_audit_BENFORD:timeField">
+                <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:timeField"/>
+            </xsl:variable>
+            
+            
+            <xsl:variable name="default_db__x3A__BI_audit_BENFORD:NameField">
+                <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:NameField"/>
+            </xsl:variable>
             
             <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:NWK3">
-                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField//text()" />
-                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField//text()" />
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField//text()" tunnel="yes" />
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField//text()" tunnel="yes" />
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField//text()" tunnel="yes"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField//text()" tunnel="yes"/>
             </xsl:call-template>
-            
-            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys">
-                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField//text()" />
-                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField//text()" />
+            <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BNWK3T">
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField//text()" tunnel="yes" />
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField//text()" tunnel="yes" />
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField//text()" tunnel="yes"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField//text()" tunnel="yes"/>
             </xsl:call-template>
+            <xsl:choose>
+                <xsl:when test="number($default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.deal_analys__x3A__enable.param) &gt;0">
+                    <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.deal_analys">
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField//text()" tunnel="yes" />
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField//text()" tunnel="yes"/>
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField//text()" tunnel="yes"/>
+                        <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField//text()" tunnel="yes"/>
+                    </xsl:call-template>
+                </xsl:when>
+            </xsl:choose>
+            
         <xsl:choose>
             <xsl:when test=".//*[@fid]">
                 <xsl:variable name="system_cache__dita:files.key.title.context.href.all_table" select="system_cache__dita:files.key.title.context.href(.,'topic','podglad_analizy_liczb__records__all_table')"/>
@@ -135,7 +224,10 @@
                             <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="default_db__x3A__BI_audit_BENFORD:groupField"/>-->
                             <xsl:with-param name="system_cache__dita:topic_name" select="$system_cache__dita:topic_name"/>
                             <xsl:with-param name="system_cache__dita:files.key.title.context.href.all_table" select="$system_cache__dita:files.key.title.context.href.all_table"/>
-                            
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes"/>
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes" />
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
                         </xsl:apply-templates>
                     </xsl:result-document>
                 </topicref>
@@ -152,6 +244,10 @@
                                  <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="default_db__x3A__BI_audit_BENFORD:valueField"/>
                                  <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="default_db__x3A__BI_audit_BENFORD:groupField"/>-->
                                  <xsl:with-param name="system_cache__dita:topic_name" select="$system_cache__dita:topic_name"/>
+                                 <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                                 <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                                 <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                                 <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
                              </xsl:apply-templates>
                          </xsl:result-document>
         
@@ -171,6 +267,10 @@
                                  <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="default_db__x3A__BI_audit_BENFORD:valueField"/>
                                  <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="default_db__x3A__BI_audit_BENFORD:groupField"/>-->
                             <xsl:with-param name="system_cache__dita:topic_name" select="$system_cache__dita:topic_name"/>
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
                         </xsl:apply-templates>
                     </xsl:result-document>
                 </xsl:when>
@@ -182,6 +282,10 @@
     
     
     <xsl:template name="default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.navtitle.attr">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
         <xsl:attribute name="navtitle">
         <xsl:choose>
             <xsl:when test="firstStep">
@@ -202,7 +306,7 @@
             </xsl:when>
         </xsl:choose>
         </xsl:attribute>
-        <xsl:attribute name="props">BI_audit_BENFORD__162 mode__default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.navtitle.attr</xsl:attribute>
+        <xsl:attribute name="props">BI_audit_BENFORD__162 mode__default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD.navtitle.attr bocian.raport.BH</xsl:attribute>
     </xsl:template>
     
     

+ 107 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_BENFORD/default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD__x3A__generate.xsl

@@ -0,0 +1,107 @@
+<?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:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs Benford system_cache__appinfo system_cache__dita get_wfs p5 xlink default_db__x3A__BI_audit_BENFORD"
+    version="2.0">
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:template name="default_db__x3A__BI_audit_BENFORD:generate">
+        <xsl:param name="system_cache__dita:interested_row" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes" />
+        <!--<default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD>-->
+            <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:generate" select="$system_cache__dita:interested_row"/>
+        <!--</default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD>-->
+    </xsl:template>
+    
+    
+    <xsl:template mode="default_db__x3A__BI_audit_BENFORD:generate" match="BI_audit_ENERGA_RUM_UMOWY">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes" />
+        <xsl:copy>
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:generate.leadingNumber"/>
+            <xsl:apply-templates mode="#current"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template mode="default_db__x3A__BI_audit_BENFORD:generate" match="*">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes" />
+        <xsl:copy>
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="#current"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template mode="default_db__x3A__BI_audit_BENFORD:generate" match="text()">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template mode="default_db__x3A__BI_audit_BENFORD:generate.leadingNumber" match="*">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" tunnel="yes" />
+        <xsl:choose>
+            <xsl:when test="local-name()=$default_db__x3A__BI_audit_BENFORD:valueField  and number(text())">
+                <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:leadingNumber" select="substring(text(),1,1)"/>
+            </xsl:when>
+            <xsl:when test="local-name()=$default_db__x3A__BI_audit_BENFORD:timeField">
+                <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:leadingTime" select="system_cache__dita:year(text())"/>
+                <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:leadingTimeYear" select="system_cache__dita:year(text())"/>
+                <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:leadingTimeYear-month" select="system_cache__dita:year-month(text())"/>
+                <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:leadingTimeYear-quarter" select="system_cache__dita:year-quarter(text())"/>
+                
+                <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:leadingTimeUnit" select="'year'"/>
+            </xsl:when>
+        </xsl:choose>
+        <xsl:variable name="current" select="."/>
+        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:groupField,',')">
+            <xsl:choose>
+                <xsl:when test="$current/local-name() = current()">
+                    <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:leadingGroup" select="current()"/>
+                    <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:leadingGroupText" select="$current/text()"/>
+                </xsl:when>
+            </xsl:choose>
+        </xsl:for-each>
+        <xsl:call-template name="default_db__x3A__BI_audit_BENFORD:generate.leadingNumber.column">
+            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:FieldType" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
+            <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:FieldTypeName" select="'NameField'"/>
+        </xsl:call-template>
+    </xsl:template>
+    
+    <xsl:template name="default_db__x3A__BI_audit_BENFORD:generate.leadingNumber.column">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:FieldType" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:FieldTypeName" required="yes"/>
+        <xsl:param name="current" select="."/>
+        <xsl:for-each select="tokenize($default_db__x3A__BI_audit_BENFORD:FieldType,',')">
+            <xsl:choose>
+                <xsl:when test="$current/local-name() = current()">
+                    <xsl:attribute name="default_db__x3A__BI_audit_BENFORD:{$default_db__x3A__BI_audit_BENFORD:FieldTypeName}" select="current()"/>
+                </xsl:when>
+            </xsl:choose>
+        </xsl:for-each>
+    </xsl:template>
+    
+    <xsl:template mode="default_db__x3A__BI_audit_BENFORD:generate.leadingNumber" match="text()|comment()"/>
+    
+</xsl:stylesheet>

+ 192 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.dita.xsd

@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    elementFormDefault="qualified"
+    targetNamespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    vc:minVersion="1.1" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
+
+    <xs:annotation>
+        <xs:documentation>schema do raportu</xs:documentation>
+    </xs:annotation>
+    <xs:attribute name="interested_row.path"/>
+    <xs:complexType name="interested_row">
+        <xs:attribute ref="system_cache__dita:interested_row.path"/>
+    </xs:complexType>
+    <xs:complexType name="sources">
+        <xs:sequence>
+            <xs:element maxOccurs="unbounded" name="source">
+                <xs:complexType mixed="true">
+                    <xs:attribute name="source">
+                        <xs:annotation>
+                            <xs:documentation>KRS</xs:documentation>
+                        </xs:annotation>
+                    </xs:attribute>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:element name="DEBUG">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="graph_to_image"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <xs:group name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed">
+        <xs:annotation>
+            <xs:documentation>system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed($interested_row,$sources,$element)</xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="interested_row" type="system_cache__dita:interested_row"/>
+            <xs:element name="sources" type="system_cache__dita:sources"/>
+            <xs:element name="element">
+                <xs:annotation>
+                    <xs:documentation>may be * or real local name</xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:group>
+    <xs:element name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element maxOccurs="unbounded" name="fixed">
+                    <xs:complexType>
+                        <xs:attribute name="key">
+                            <xs:annotation>
+                                <xs:documentation>file:/opt/local/pl.procesy5/p5build_SE/temp/WPS_Functions/default_db/CRM_PROCES_tree/BI_audit_BENFORD_24/BI_audit_BENFORD_24.ditamap
+</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                        <xs:attribute name="fid">
+                            <xs:annotation>
+                                <xs:documentation>BI_audit_ENERGA_PRACOWNICY.432</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                        <xs:attribute name="source">
+                            <xs:annotation>
+                                <xs:documentation>KRS</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq">
+        <xs:annotation>
+            <xs:documentation>wyzwala sie na podstawie value fixed func</xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element maxOccurs="unbounded" name="uniq">
+                    <xs:complexType>
+                        <xs:attribute name="key">
+                            <xs:annotation>
+                                <xs:documentation>file:/opt/local/pl.procesy5/p5build_SE/temp/WPS_Functions/default_db/CRM_PROCES_tree/BI_audit_BENFORD_24/BI_audit_BENFORD_24.ditamap
+</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                        <xs:attribute name="fid">
+                            <xs:annotation>
+                                <xs:documentation>BI_audit_ENERGA_PRACOWNICY.432</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                        <xs:attribute name="source">
+                            <xs:annotation>
+                                <xs:documentation>KRS</xs:documentation>
+                            </xs:annotation>
+                        </xs:attribute>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <xs:group name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal">
+        <xs:annotation>
+            <xs:documentation>template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal</xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="title"/>
+            <xs:element name="sources">
+                <xs:annotation>
+                    <xs:documentation>foreach</xs:documentation>
+                </xs:annotation>
+                <xs:complexType>
+                    <xs:complexContent>
+                        <xs:extension base="system_cache__dita:sources">
+                            <xs:sequence>
+                                <xs:element name="topichead"/>
+                            </xs:sequence>
+                        </xs:extension>
+                    </xs:complexContent>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+    </xs:group>
+    <xs:group name="concept">
+        <xs:sequence>
+            <xs:element name="map_values"/>
+            <xs:element name="keys"/>
+            <xs:element name="associations"/>
+            <xs:element name="structure"/>
+            <xs:sequence>
+                <xs:annotation>
+                    <xs:documentation>kontrahent</xs:documentation>
+                </xs:annotation>
+                <xs:element name="powiazanie">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="context.path.begin.attrs">
+                                <xs:complexType>
+                                    <xs:attribute name="context.path.begin.attrs"/>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element name="path.row.attrs">
+                                <xs:complexType>
+                                    <xs:attribute name="path.row.attrs"/>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element name="context.path.begin.end">
+                                <xs:complexType>
+                                    <xs:attribute name="context.path.begin.end"/>
+                                </xs:complexType>
+                            </xs:element>
+                            <xs:element name="context.childs.attrs"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+            <xs:element name="dane_do_grafu">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:annotation>
+                            <xs:documentation>z grafu do dity opracowywane</xs:documentation>
+                        </xs:annotation>
+                        <xs:element name="kontrahent">
+                            <xs:complexType>
+                                <xs:sequence>
+                                    <xs:element name="ile_dowiazan"/>
+                                    <xs:element name="wartosc_umow"/>
+                                    <xs:element name="kryteria_kosztow"/>
+                                    <xs:element name="liczba_benford"/>
+                                </xs:sequence>
+                            </xs:complexType>
+                        </xs:element>
+                        <xs:element name="pracownik_od">
+                            <xs:complexType>
+                                <xs:sequence>
+                                    <xs:element name="ile_dowiazan"/>
+                                    <xs:element name="dlugosc_dowiazan"/>
+                                    <xs:element name="wartosc_umow"/>
+                                    <xs:element name="kryteria_kosztow"/>
+                                    <xs:element name="liczba_benford"/>
+                                </xs:sequence>
+                            </xs:complexType>
+                        </xs:element>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+        </xs:sequence>
+    </xs:group>
+</xs:schema>

+ 112 - 9
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.xsl

@@ -8,6 +8,8 @@
     xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
     xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
     xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
     exclude-result-prefixes="xs p5 get_wfs system_cache__dita"
     version="2.0">
     
@@ -23,14 +25,45 @@
         <xsl:param name="sources" required="yes"/>
         <xsl:param name="navtitle" required="yes" />
         <xsl:param name="element" required="yes"/>
-        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed"  select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed($interested_row,$sources,$element)"/>
-        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed,$sources)" />
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed"  required="yes" /><!-- select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed($interested_row,$sources,$element)" -->
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq" /><!-- select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed,$sources)" -->
         <xsl:param name="resulset" required="yes"/>
         <xsl:param name="mode" select="'system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal'"/><!-- np BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person -->
         <xsl:param name="processing-role"/>
         <xsl:param name="keys"/>
         <xsl:param name="title"/>
         <xsl:param name="toc"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"   required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"   required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"   required="yes" tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"/>
+        <!--<xsl:param name="system_cache__dita:bypass_pos_grouping"/>-->
+        <!--<xsl:variable name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed">
+            <xsl:choose>
+                <xsl:when test="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed">
+                    <xsl:copy-of select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:call-template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed">
+                        <xsl:with-param name="element" select="$element"/>
+                        <xsl:with-param name="interested_row" select="$interested_row"/>
+                        <xsl:with-param name="sources" select="$sources"/>
+                    </xsl:call-template>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>-->
+        
+        <xsl:variable name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq">
+            <xsl:choose>
+                <xsl:when test="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq">
+                    <xsl:copy-of select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq"/>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed,$sources)"></xsl:copy-of>
+                </xsl:otherwise>
+            </xsl:choose>
+            
+        </xsl:variable>
         
         <xsl:choose>
             <xsl:when test="$title">
@@ -49,7 +82,7 @@
             <xsl:message>#2555 system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal zrodlo = <xsl:value-of select="."/></xsl:message>
             <topichead > <!-- navtitle="żródło:{.}  Powiązania do osób z KRS ogólnie" -->
                 <xsl:attribute name="navtitle"><xsl:value-of select="."/> - <xsl:value-of select="$navtitle"/></xsl:attribute>
-                <xsl:attribute name="props">name__universal</xsl:attribute>
+                <xsl:attribute name="props">name__universal <xsl:value-of select="$title"/></xsl:attribute>
                 <xsl:if test="$processing-role">
                     <xsl:attribute name="processing-role" select="$processing-role"/>
                 </xsl:if>
@@ -58,25 +91,44 @@
                 </xsl:if>
                 <xsl:if test="$keys"><xsl:attribute name="keys" select="$keys"/></xsl:if>
                 <xsl:for-each select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq//uniq[@source=$source]">
-                    
-                    <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*[ position() = 1 and ( source= $source or not(source)) ]]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[ position() = 1 and  (  $element='*'  or  local-name()=$element ) and system_cache__dita:files.key.DETECT(@fid,'','','') = current()/@key ]" 
+                    <!--<xsl:variable name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.groupset">
+                        <xsl:call-template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.groupset">
+                            <xsl:with-param name="interested_row" select="$interested_row"/>
+                            <xsl:with-param name="system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.path" select="true()"/>
+                        </xsl:call-template>
+                    </xsl:variable>-->
+                    <!--<xsl:for-each select=""></xsl:for-each>--><!-- $interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*[ position() = 1 and ( source= $source or not(source)) ]]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[ position() = 1 and  (  $element='*'  or  local-name()=$element ) and system_cache__dita:files.key.DETECT(@fid,'','','') = current()/@key ] -->
+                    <xsl:for-each-group select="$interested_row/interested_row//*[  current()/@fid =  @fid]" 
                         group-by="@fid">
                         <xsl:variable name="group_name" select="system_cache__dita:files.key.DETECT(@fid,'','','')"/>
                         <!--<topichead navtitle="{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-->
                         
                         <!--<xsl:choose>
                                         <xsl:when test="//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID=$BI_audit_ENERGA_RUM_KONTRAHENCI.ID">-->
-                        <xsl:message>#533-2595 counting ile ** <xsl:value-of select="count($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed//fixed[@key = $group_name])"/></xsl:message>
+                        <xsl:message>
+                            #533-2595 $title=<xsl:value-of select="$title"/>; @generate-id=<xsl:value-of select="@generate-id"/>; counting ile ** <xsl:value-of select="count($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed//fixed[@key = $group_name])"/>; $group_name=<xsl:value-of select="$group_name"/></xsl:message>
                         <xsl:choose> <!-- testowanie czy jest w roznych zrodlach ten sam pesel -->
                             <xsl:when test="count($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed//fixed[@key = $group_name]) &gt; 1">
                                 <!-- pierwszy vs obecny _row powiazania z danym PESEL-->
                                 <xsl:variable name="min" select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[ local-name() = $element and system_cache__dita:files.key.DETECT(@fid,'','','') = $group_name ]][1]/@pos"/>
+                                <xsl:variable name="min">
+                                    <xsl:choose>
+                                        <xsl:when test="number($min)"><xsl:value-of select="$min"/></xsl:when>
+                                        <xsl:otherwise><xsl:value-of select="$interested_row//*[ @pos and descendant-or-self::*[@generate-id = current()/@generate-id ] ][1]/@pos"/></xsl:otherwise>
+                                    </xsl:choose>
+                                </xsl:variable>
                                 <xsl:variable name="curr" select="../.././@pos"/>
-                                <xsl:message>#538-2600 pozycja $min = <xsl:value-of select="$min"/> ; curr = <xsl:value-of select="$curr"/> $group_name = <xsl:value-of select="$group_name"/> ; position()=<xsl:value-of select="position()"/> </xsl:message>
+                                <xsl:variable name="curr">
+                                    <xsl:choose>
+                                        <xsl:when test="number($curr)"><xsl:value-of select="$curr"/></xsl:when>
+                                        <xsl:otherwise><xsl:value-of select="ancestor-or-self::*[@pos][1]/@pos"/></xsl:otherwise>
+                                    </xsl:choose>
+                                </xsl:variable>
+                                <xsl:message>#538-2600 pozycja $min = <xsl:value-of select="$min"/> ; curr = <xsl:value-of select="$curr"/> $group_name = <xsl:value-of select="$group_name"/> ; position()=<xsl:value-of select="position()"/> ; @fid=<xsl:value-of select="@fid"/></xsl:message>
                                 <xsl:choose>
                                     <xsl:when test="$curr = $min and position() = 1">
                                         <xsl:message>#547-2603 - generating first occurence of <xsl:value-of select="$group_name"/> ; $mode=<xsl:value-of select="$mode"/>; local-name=<xsl:value-of select="local-name()"/>; last/name=<xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[1]/local-name()"/> ;; last/@fid=<xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[1]/@fid"/></xsl:message>
-                                        <xsl:comment>#538 pos <xsl:value-of select="$curr"/></xsl:comment>
+                                        <xsl:comment>#538 pos <xsl:value-of select="$curr"/>=<xsl:value-of select="$curr"/>; min=<xsl:value-of select="$min"/>; @<xsl:value-of select="@generate-id"/></xsl:comment>
                                         <!--<xsl:copy-of select="../../."/>-->
                                         <xsl:choose>
                                             <xsl:when test="$mode = 'BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person'">
@@ -95,6 +147,46 @@
                                                     <xsl:with-param name="title" select="concat($title,$source)"/>
                                                 </xsl:apply-templates>
                                             </xsl:when>
+                                            <xsl:when test="$mode = 'system_cache__dita:ANALIZA_UMOW_4UA'">
+                                                <xsl:apply-templates mode="system_cache__dita:ANALIZA_UMOW_4UA" select="." >
+                                                    <xsl:with-param name="group_name" select="$group_name"/>
+                                                    <xsl:with-param name="position" select="position()"/>
+                                                    <xsl:with-param name="resulset" select="$resulset"/>
+                                                    <xsl:with-param name="title" select="concat($title,$source)"/>
+                                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField"    select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField"     select="$default_db__x3A__BI_audit_BENFORD:groupField"/>
+                                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField"   select="$default_db__x3A__BI_audit_BENFORD:timeField" />
+                                                    <xsl:with-param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed"/>
+                                                    <xsl:with-param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq"/>
+                                                    <xsl:with-param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed//fixed[@generate-id=current()/@generate-id][1]"/>
+                                                    <xsl:with-param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq//uniq[@generate-id=current()/@generate-id][1]"/>
+                                                    <xsl:with-param name="interested_row" select="$interested_row"/>
+                                                </xsl:apply-templates>
+                                            </xsl:when>
+                                            <xsl:when test="$mode = 'system_cache__dita:ANALIZA_UMOW_4UA_preprocess'">
+                                                <xsl:apply-templates mode="system_cache__dita:ANALIZA_UMOW_4UA_preprocess" select="." >
+                                                    <xsl:with-param name="group_name" select="$group_name"/>
+                                                    <xsl:with-param name="position" select="position()"/>
+                                                    <xsl:with-param name="resulset" select="$resulset"/>
+                                                    <xsl:with-param name="title" select="concat($title,$source)"/>
+                                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField"    select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField"     select="$default_db__x3A__BI_audit_BENFORD:groupField"/>
+                                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField"   select="$default_db__x3A__BI_audit_BENFORD:timeField" />
+                                                    <xsl:with-param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed"/>
+                                                    <xsl:with-param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq"/>
+                                                    <xsl:with-param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed//fixed[@generate-id=current()/@generate-id][1]"/>
+                                                    <xsl:with-param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq//uniq[@generate-id=current()/@generate-id][1]"/>
+                                                    <xsl:with-param name="interested_row" select="$interested_row"/>
+                                                </xsl:apply-templates>
+                                            </xsl:when>
+                                            <!--<xsl:when test="$mode = 'BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA'">
+                                                <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA" select="." >
+                                                    <xsl:with-param name="group_name" select="$group_name"/>
+                                                    <xsl:with-param name="position" select="position()"/>
+                                                    <xsl:with-param name="resulset" select="$resulset"/>
+                                                    <xsl:with-param name="title" select="concat($title,$source)"/>
+                                                </xsl:apply-templates>
+                                            </xsl:when>-->
                                             <xsl:otherwise>
                                                 <xsl:message terminate="no">#2613 unaviable $mode = <xsl:value-of select="$mode"/>  </xsl:message>
                                                 <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal" select=".">
@@ -107,7 +199,7 @@
                                         </xsl:choose>
                                     </xsl:when>
                                     <xsl:otherwise>
-                                        <xsl:message>#2594 OTHERWISE for @fid=<xsl:value-of select="@fid"/> $mode=<xsl:value-of select="$mode"/>; </xsl:message>
+                                        <xsl:message>#2594 OTHERWISE for @fid=<xsl:value-of select="@fid"/> $mode=<xsl:value-of select="$mode"/>;  </xsl:message>
                                         <xsl:variable name="refpos" select="concat($group_name,'_', position())"/> <!-- $temp}/{$uuid}/{$group_name}/{$refpos}.dita   -->
                                         <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.ignore" select=".">
                                             <xsl:with-param name="position" select="position()"/> <!-- to ignore som rowes -->
@@ -159,6 +251,7 @@
     </xsl:template>
     
     
+    
     <xsl:template mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.ignore" match="XXXXX">
         <xsl:message>#2645 IGONRED mode universal <xsl:value-of select="@fid"/> </xsl:message>
     </xsl:template>
@@ -311,6 +404,10 @@
         </title>
     </xsl:template>
     
+    <!--<xsl:template mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" match="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset">
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>-->
+    
     <xsl:template mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" match="*">
         <xsl:param name="title" select="'Ścieżka śledzenia do '"/>
         <xsl:param name="count"/>
@@ -327,6 +424,12 @@
         </xsl:choose>
         <xsl:choose>
             <xsl:when test="nazwa/text()|Pelna_nazwa_kontrahenta/text()">
+                <xsl:call-template name="system_cache__dita:indexterm">
+                    <xsl:with-param name="system_cache__dita:element">ph</xsl:with-param>
+                    <xsl:with-param name="indexterm" select="concat(nazwa,Pelna_nazwa_kontrahenta)"/>
+                    <xsl:with-param name="text"/>
+                    <xsl:with-param name="system_cache__dita:indexterm" select="system_cache__dita:indexterm('Ścieżka śledzenia','')"/>
+                </xsl:call-template>
                 <ph>
                     <xsl:if test="nazwa/text()"> nazwa: <b><xsl:value-of select="replace(nazwa,'SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ',' (Sp. z o.o.) ')"/></b></xsl:if>
                     <xsl:if test="Pelna_nazwa_kontrahenta/text()"> nazwa : <b><xsl:value-of select="replace(Pelna_nazwa_kontrahenta,'SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ',' (Sp. z o.o.) ')"/></b></xsl:if>

+ 562 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_4UA.xsl

@@ -0,0 +1,562 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template mode="system_cache__dita:ANALIZA_UMOW_4UA" match="text()|comment()"/>
+    
+    
+    
+    
+    <xsl:template mode="system_cache__dita:ANALIZA_UMOW_4UA_preprocess" match="*">
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="position" required="yes"/>
+        <xsl:param name="resulset" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"   required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"   required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"   required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed" required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq" required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current" required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current" required="yes"/>
+        <xsl:param name="interested_row" required="yes"/>
+        
+        <xsl:variable name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset">
+            <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset">
+                <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current/@default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs"/><!-- $system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current -->
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:variable name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset">
+            <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.unique">
+                <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current/@default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs"/><!-- $system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current -->
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:variable name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset">
+            <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.unique">
+                <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current/@default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs"/><!-- $system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current -->
+            </xsl:call-template>
+        </xsl:variable>
+        
+        <xsl:call-template name="system_cache__dita:ANALIZA_UMOW_4UA.graph">
+            <xsl:with-param name="generate_id" select="@fid"/>                                                                           
+            <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset"/>
+            <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset"/>
+            <xsl:with-param name="title" select="$title"/>
+        </xsl:call-template>
+        <xsl:call-template name="system_cache__dita:ANALIZA_UMOW_4UA.graph.deals">
+            <xsl:with-param name="generate_id" select="@fid"/>                                                                           
+            <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset"/>
+            <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset"/>
+            <xsl:with-param name="title" select="$title"/>
+        </xsl:call-template>
+        <xsl:call-template name="system_cache__dita:ANALIZA_UMOW_4UA.graph.related">
+            <xsl:with-param name="generate_id" select="@fid"/>                                                                           
+            <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset"/>
+            <xsl:with-param name="title" select="$title"/>
+        </xsl:call-template>
+    </xsl:template>
+    
+    
+    
+    <xsl:template mode="system_cache__dita:ANALIZA_UMOW_4UA_preprocess" match="text()|comment()"/>
+    
+    <xsl:template mode="system_cache__dita:ANALIZA_UMOW_4UA" match="*">
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="position" required="yes"/>
+        <xsl:param name="resulset" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"   required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"   required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"   required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed" required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq" required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current" required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current" required="yes"/>
+        <xsl:param name="interested_row" required="yes"/>
+        <xsl:comment>#32 system_cache__dita:ANALIZA_UMOW_4UA</xsl:comment>
+        <topicref  platform="{$position}" audience="{$title}" props="name {local-name()} {$default_db__x3A__BI_audit_BENFORD:valueField} {$default_db__x3A__BI_audit_BENFORD:timeField}"><!-- group_name="{$group_name}" -->
+                <!--<xsl:copy-of select="@*"/>-->
+                <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
+                <xsl:copy-of select="system_cache__dita:files.context.title.keys(current(),$title)" copy-namespaces="no"/> 
+                
+                <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(current(),$title)}"> <!--XX  href="{$temp}/{$uuid}/{system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position)}.dita -->
+                    
+                    <!--                    Analiza spójności liczbowej dla ID kontr <xsl:value-of select="current()/ID"/>
+-->                    
+                    
+                    <topic id="{$uuid}topic_analiza_umow_4ua_{$group_name}_{$position}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                        xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                        <xsl:call-template name="system_cache__dita:ANALIZA_UMOW_4UA.title" />
+                        
+                        <xsl:variable name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset">
+                            <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset">
+                                <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current/@default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs"/><!-- $system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current -->
+                            </xsl:call-template>
+                        </xsl:variable>
+                        
+                        <xsl:variable name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset">
+                            <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.unique">
+                                <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current/@default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs"/><!-- $system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current -->
+                            </xsl:call-template>
+                        </xsl:variable>
+                        
+                        <xsl:variable name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset">
+                            <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.unique">
+                                <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current/@default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs"/><!-- $system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.current -->
+                            </xsl:call-template>
+                        </xsl:variable>
+                        
+                        <!--<TEST beg_attrs="{$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.current/@default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs}"  cntcg="{count(current-group())}">
+                            <xsl:copy-of select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset"/>
+                        </TEST>-->
+                        <!--<xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset" group-by="//@fid">
+                            <row><xsl:value-of select="position()"/>; cnt=<xsl:value-of select="count(current-group())"/></row>
+                        </xsl:for-each-group>-->
+                        <prolog>
+                            <metadata>
+                                <xsl:call-template name="system_cache__dita:indexterm">
+                                    <xsl:with-param name="system_cache__dita:element"/>
+                                    <xsl:with-param name="indexterm" /><!-- select="*[local-name()=$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_KONTRAHENCI.Pelna_nazwa_kontrahenta]/text()" -->
+                                    <xsl:with-param name="text"/>
+                                </xsl:call-template>
+                            </metadata>
+                        </prolog>
+                        
+                        <body>
+                            <p> <!--<xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.last.title"/>-->
+                                <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="current()"/> 
+                            </p>
+                            
+                            <draft-comment author="a.binder">#807-X $group_name = <xsl:value-of select="$group_name"/>;  count(curr_gr)=<xsl:value-of select="count(current-group())"/> ; </draft-comment>
+                            
+                            <foreign>
+                                <!--<xsl:copy-of select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset"/>-->
+                                <xsl:copy-of select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset"/>
+                            </foreign>
+                            
+                            <xsl:call-template name="system_cache__dita:ANALIZA_UMOW_4UA.graph">
+                                <xsl:with-param name="generate_id" select="@fid"/>                                                                           
+                                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset"/>
+                                <xsl:with-param name="title" select="$title"/>
+                            </xsl:call-template>
+                            
+                            <xsl:call-template name="system_cache__dita:ANALIZA_UMOW_4UA.graph.deals">
+                                <xsl:with-param name="generate_id" select="@fid"/>                                                                           
+                                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset"/>
+                                <xsl:with-param name="title" select="$title"/>
+                            </xsl:call-template>
+                            
+                            
+                            <xsl:call-template name="system_cache__dita:ANALIZA_UMOW_4UA.graph.related">
+                                <xsl:with-param name="generate_id" select="@fid"/>                                                                           
+                                <xsl:with-param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset" select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset"/>
+                                <xsl:with-param name="title" select="$title"/>
+                            </xsl:call-template>
+                            <codeblock>
+                                
+                            </codeblock>
+                            <!--<xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="."/>-->
+                        </body>
+                        
+                        
+                        
+                    </topic>
+                </xsl:result-document>
+            </topicref>
+                
+                
+        
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__dita:ANALIZA_UMOW_4UA " match="text()|comment()"/>
+        
+    
+    
+    <xsl:template name="system_cache__dita:ANALIZA_UMOW_4UA.graph" >
+        <xsl:param name="generate_id" select="@generate-id"/>
+        <xsl:param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <!--<strow>
+            <xsl:copy-of select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset"/>
+        </strow>-->
+        <xsl:variable name="SIMPLETABLE_WTITLE">
+            <SIMPLETABLE_WTITLE>
+            <simpletable frame="all"
+                id="ANALIZA_UMOW_4UA.graph_table_2_5_{$generate_id}_{$title}"
+                props="print__no graph.ylabel.ilosc graph.y2label.dlugosc graph.style.histogram  "><!-- font15 -->
+                
+                <strow props="graph.headers">
+                    <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset//*" group-by="@fid">
+                        <stentry current-grouping-key="{@fid}" props="graph.xtic" audience="powiazania"><xsl:value-of select="position()"/><xsl:copy-of select="string-join(*[@default_db__x3A__BI_audit_BENFORD:NameField]/text(),' ')"></xsl:copy-of></stentry>
+                        <stentry current-grouping-key="{@fid}" props="graph.xtic" audience="powiazania"><xsl:value-of select="position()"/><xsl:copy-of select="string-join(*[@default_db__x3A__BI_audit_BENFORD:NameField]/text(),' ')"></xsl:copy-of><xsl:value-of select="nazwa"/></stentry>
+                    </xsl:for-each-group>
+                </strow>
+                <strow props="graph.data">
+                    <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset//*" group-by="@fid">
+                        <stentry current-grouping-key="{@fid}"><xsl:value-of select="count(current-group())"/></stentry>
+                        <stentry current-grouping-key="{@fid}"><xsl:value-of select="min(current-group()/number(@default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.precedings.count.parent.following))"/></stentry>
+                    </xsl:for-each-group>
+                    
+                </strow>
+                <strow props="graph.title">
+                    <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset//*" group-by="@fid">
+                        <stentry current-grouping-key="{@fid}" audience="powiazania">ilość powiązań</stentry>
+                        <stentry current-grouping-key="{@fid}" audience="powiazania">minimalna dł. ścieżki</stentry>
+                    </xsl:for-each-group>
+                </strow>
+                <strow props="graph.color.name">
+                    <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset//*" group-by="@fid">
+                        <stentry current-grouping-key="{@fid}">brown</stentry>
+                        <stentry current-grouping-key="{@fid}">orange</stentry>
+                    </xsl:for-each-group>
+                </strow>
+                <!--<strow props="graph.color.variable">
+                    <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset//*" group-by="@fid">
+                        <stentry current-grouping-key="{@fid}"><xsl:value-of select="position()"/></stentry>
+                        <stentry current-grouping-key="{@fid}"><xsl:value-of select="position()"/></stentry>
+                    </xsl:for-each-group>
+                </strow>-->
+                <strow props="graph.yaxis">
+                    <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset//*" group-by="@fid">
+                        <stentry current-grouping-key="{@fid}"/>
+                        <stentry current-grouping-key="{@fid}">2</stentry>
+                    </xsl:for-each-group>
+                </strow>
+                <strow props="graph.fill.style">
+                    <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset//*" group-by="@fid">
+                        <stentry current-grouping-key="{@fid}"> lw 2 </stentry>
+                        <stentry current-grouping-key="{@fid}"/>
+                    </xsl:for-each-group>
+                </strow>
+                <strow props="graph.newhistogram">
+                    <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset//*" group-by="@fid">
+                        <stentry audience="powiazania" current-grouping-key="{@fid}"> powiązania </stentry>
+                    </xsl:for-each-group>
+                </strow>
+            </simpletable>
+            </SIMPLETABLE_WTITLE>
+        </xsl:variable>
+        <xsl:variable name="simpletable">
+            <xsl:call-template name="system_cache__dita:graph.all.data.fit.fix__x3A__numerate.simpletable">
+                <xsl:with-param name="simpletable" select="$SIMPLETABLE_WTITLE"/>
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="$simpletable//stentry">
+                <p> (A3W) wykres </p>
+                <foreign>
+                    <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
+                </foreign>
+                <p>   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                    <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                    <xsl:with-param name="width" select="500"/>
+                    <xsl:with-param name="path.prefix">../</xsl:with-param>
+                </xsl:apply-templates>
+                </p>
+            </xsl:when>
+            <xsl:otherwise>
+                <p props="214a">
+                </p>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template name="system_cache__dita:ANALIZA_UMOW_4UA.graph.deals" >
+        <xsl:param name="generate_id" select="@generate-id"/>
+        <xsl:param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:FieldType" select="'default_db__x3A__BI_audit_BENFORD:leadingTimeYear-month'"/>
+        <!--<strow>
+            <xsl:copy-of select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset"/>
+        </strow>-->
+        <xsl:variable name="SIMPLETABLE_WTITLE">
+            <SIMPLETABLE_WTITLE>
+                <simpletable frame="all"
+                    id="ANALIZA_UMOW_4UA.graph.deals_table_2_5_{$generate_id}_{$title}"
+                    props="print__no graph.ylabel.ilosc graph.y2label.wartosc graph.style.histogram   "><!-- font15 -->
+                    
+                    <strow props="graph.headers">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry  current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" props="graph.xtic" audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>-->
+                            <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <strow props="graph.data">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" ><xsl:value-of select="count(current-group())"/></stentry>-->
+                            <stentry audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" ><xsl:value-of select="sum(current-group()/*[@default_db__x3A__BI_audit_BENFORD:leadingNumber]/number())"/></stentry>
+                            <xsl:variable name="current-group.parent.count" select="count(current-group())"/>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="count(current-group()) div $current-group.parent.count"/></stentry>
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="sum(current-group()/*[@default_db__x3A__BI_audit_BENFORD:leadingNumber]/number())"/></stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                        
+                    </strow>
+                    <strow props="graph.title">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" group="rozklad" audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">rozkład</stentry>-->
+                            <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" group="koszt" audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">koszt.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry><!--<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/>-->
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" group="iloscB"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">ilość B.<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry><!--<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/>-->
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" group="kosztB" audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">koszt B.<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry><!--<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/>-->
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <strow props="graph.color.name">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">blue</stentry>-->
+                            <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">brown</stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  >blue</stentry>
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  >red</stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <!--<strow props="graph.color.variable">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset//*" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                            <stentry current-grouping-key="{@default_db__x3A__BI_audit_BENFORD:leadingNumber}">blue</stentry>
+                            <stentry current-grouping-key="{@default_db__x3A__BI_audit_BENFORD:leadingNumber}">red</stentry>
+                        </xsl:for-each-group>
+                    </strow>-->
+                    <strow props="graph.yaxis">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"/>-->
+                            <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">2</stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  />
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  >2</stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <strow props="graph.fill.style">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset//*" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <stentry props="graph.notitle" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"/>
+                            <!--<stentry current-grouping-key="{@default_db__x3A__BI_audit_BENFORD:leadingNumber}"/>-->
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry props="graph.notitle" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}_{@default_db__x3A__BI_audit_BENFORD:leadingNumber}"  />
+                                <stentry props="graph.notitle" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}_{@default_db__x3A__BI_audit_BENFORD:leadingNumber}"  />
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <strow props="graph.newhistogram">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <stentry audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"> analiza \n rozkładu</stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"> analiza \n rozkładu</stentry>
+                                <!--<stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">an. <xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>-->
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                </simpletable>
+            </SIMPLETABLE_WTITLE>
+        </xsl:variable>
+        <xsl:variable name="simpletable">
+            <xsl:call-template name="system_cache__dita:graph.all.data.fit.fix__x3A__numerate.simpletable">
+                <xsl:with-param name="simpletable" select="$SIMPLETABLE_WTITLE"/>
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="$simpletable//stentry">
+                <p> (A3W) wykres </p>
+                <foreign>
+                    <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
+                </foreign>
+                <p>   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                    <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                    <xsl:with-param name="width" select="500"/>
+                    <xsl:with-param name="path.prefix">../</xsl:with-param>
+                </xsl:apply-templates>
+                </p>
+            </xsl:when>
+            <xsl:otherwise>
+                <p props="214a">
+                </p>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="system_cache__dita:ANALIZA_UMOW_4UA.graph.related" >
+        <xsl:param name="generate_id" select="@generate-id"/>
+        
+        <xsl:param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:FieldType" select="'default_db__x3A__BI_audit_BENFORD:leadingTimeYear-month'"/>
+        <!--<strow>
+            <xsl:copy-of select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs.nodeset"/>
+        </strow>-->
+        <xsl:variable name="SIMPLETABLE_WTITLE">
+            <SIMPLETABLE_WTITLE>
+                <simpletable frame="all"
+                    id="ANALIZA_UMOW_4UA.graph.related.deals_table_2_5_{$generate_id}_{$title}"
+                    props="print__no graph.ylabel.ilosc graph.y2label.wartosc graph.style.histogram   "><!-- font15 -->
+                    
+                    <strow props="graph.headers">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry  current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" props="graph.xtic" audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>-->
+                            <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <strow props="graph.data">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" ><xsl:value-of select="count(current-group())"/></stentry>-->
+                            <xsl:variable name="current-group.parent.count" select="count(current-group())"/>
+                            <stentry audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" ><xsl:value-of select="sum(current-group()/*[@default_db__x3A__BI_audit_BENFORD:leadingNumber]/number())"/></stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="count(current-group()) div $current-group.parent.count"/></stentry>
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"><xsl:value-of select="sum(current-group()/*[@default_db__x3A__BI_audit_BENFORD:leadingNumber]/number())"/></stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                        
+                    </strow>
+                    <strow props="graph.title">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" group="rozklad" audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">rozkład</stentry>-->
+                            <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" group="koszt" audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">koszt.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry><!--<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/>-->
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" group="iloscB.{@default_db__x3A__BI_audit_BENFORD:leadingNumber}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">ilość B.<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry><!--<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/>-->
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" group="kosztB.{@default_db__x3A__BI_audit_BENFORD:leadingNumber}" audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">koszt B.<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry><!--<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>.<xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/>-->
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <strow props="graph.color.name">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">blue</stentry>-->
+                            <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">brown</stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  >#<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>0<xsl:value-of select="@default_db__x3A__BI_audit_BENFORD:leadingNumber"/>0FF</stentry>
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  >red</stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <!--<strow props="graph.color.variable">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset//*" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                            <stentry current-grouping-key="{@default_db__x3A__BI_audit_BENFORD:leadingNumber}">blue</stentry>
+                            <stentry current-grouping-key="{@default_db__x3A__BI_audit_BENFORD:leadingNumber}">red</stentry>
+                        </xsl:for-each-group>
+                    </strow>-->
+                    <strow props="graph.yaxis">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <!--<stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"/>-->
+                            <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">2</stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  />
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  >2</stentry>
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <strow props="graph.fill.style">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset//*" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <stentry props="graph.notitle" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"/>
+                            <!--<stentry current-grouping-key="{@default_db__x3A__BI_audit_BENFORD:leadingNumber}"/>-->
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry props="graph.notitle" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}_{@default_db__x3A__BI_audit_BENFORD:leadingNumber}"  />
+                                <stentry props="graph.notitle" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}_{@default_db__x3A__BI_audit_BENFORD:leadingNumber}"  />
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                    <strow props="graph.newhistogram">
+                        <xsl:for-each-group select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs.nodeset/*/*" group-by="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]">
+                            <xsl:sort select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]" order="ascending"/>
+                            <stentry audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}" current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"> analiza \n rozkładu</stentry>
+                            <xsl:for-each-group select="current-group()" group-by="@default_db__x3A__BI_audit_BENFORD:leadingNumber">
+                                <stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"> analiza \n rozkładu</stentry>
+                                <!--<stentry current-grouping-key="{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}"  audience="rozklad_{@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]}">an. <xsl:value-of select="@*[ name()=$default_db__x3A__BI_audit_BENFORD:FieldType ]"/></stentry>-->
+                            </xsl:for-each-group>
+                        </xsl:for-each-group>
+                    </strow>
+                </simpletable>
+            </SIMPLETABLE_WTITLE>
+        </xsl:variable>
+        <xsl:variable name="simpletable">
+            <xsl:call-template name="system_cache__dita:graph.all.data.fit.fix__x3A__numerate.simpletable">
+                <xsl:with-param name="simpletable" select="$SIMPLETABLE_WTITLE"/>
+            </xsl:call-template>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="$simpletable//stentry">
+                <p> (A3W) wykres </p>
+                <foreign>
+                    <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
+                </foreign>
+                <p>   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                    <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                    <xsl:with-param name="width" select="500"/>
+                    <xsl:with-param name="path.prefix">../</xsl:with-param>
+                </xsl:apply-templates>
+                </p>
+            </xsl:when>
+            <xsl:otherwise>
+                <p props="214a">
+                </p>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template name="system_cache__dita:ANALIZA_UMOW_4UA.title">
+        <title>APU4 kontekst <xsl:value-of select="system_cache__dita:localname.translate(name())"/> [il.<xsl:value-of select="count(*)"/>]
+            <!--<xsl:apply-templates mode="system_cache__dita:ANALIZA_UMOW_4UA.title" select="."/>-->
+        </title>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="system_cache__dita:ANALIZA_UMOW_4UA.title">
+        <xsl:value-of select="name()"/><xsl:value-of select="text()"/> <xsl:text>
+        </xsl:text><!--<xsl:apply-templates mode="#current"/>-->
+    </xsl:template>
+    
+    <xsl:template match="text()|comment()" mode="system_cache__dita:ANALIZA_UMOW_4UA.title"/>
+    
+</xsl:stylesheet>

+ 382 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_BI_audit_ENERGA_RUM_KONTRAHENCI.xsl

@@ -0,0 +1,382 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI" match="text()|comment()">
+        <xsl:message>#1788 fixed text leackage </xsl:message>
+    </xsl:template>
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI|BI_audit_ENERGA_PRACOWNICY|BI_audit_KRS|BI_audit_KRS_person|BI_audit_MSIG|BI_audit_MSIG_person|BI_audit_CEIDG|BI_audit_CEIDG_pelnomocnicy|BI_audit_KRS_company|BI_audit_MSIG_company" mode="BI_audit_ENERGA_RUM_KONTRAHENCI">
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="resulset" required="yes"/>
+        <xsl:param name="position" required="yes"/>
+        <xsl:param name="title"  select="'__NO_TITLE__'"/>
+        <xsl:variable name="refpos" select="concat($group_name,'_', position())"/>
+        <xsl:comment>#1745 test for <xsl:value-of select="local-name()"/>; @fid = <xsl:value-of select="@fid"/>; </xsl:comment>
+        <topicref ><!-- XX7 href="{system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','','1'))}" --> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position) -->
+            <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
+            <xsl:copy-of select="system_cache__dita:files.context.title.keys(.,$title)" copy-namespaces="no"/> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.dita.key.attr(.) -->
+            <xsl:attribute name="props">
+                <xsl:choose>
+                    <xsl:when test="position()=1">pos__first</xsl:when>
+                    <xsl:when test="position()=last()">pos__last</xsl:when>
+                    <xsl:otherwise>pos_else</xsl:otherwise>
+                </xsl:choose>
+                <xsl:text> mode__BaERK</xsl:text>
+            </xsl:attribute>
+            <xsl:message>#781 debug : $$title=<xsl:value-of select="$title"/>;  result doc: <xsl:value-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','','1'))"/>. dita</xsl:message>
+            
+            <xsl:variable name="BI_audit_ENERGA_RUM_UMOWY_fix" select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[@fid = current()/@fid ]"/> <!-- ]$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[ID/text()= current()/ID ] --><!-- XX1  -->
+            <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI_used" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_used($resulset,current())"/>
+            <!--<xsl:variable name="BI_audit_ENERGA_RUM_UMOWY_fix">
+                        <xsl:for-each select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[ID/text()= current()/ID ]">
+                            <xsl:element name="{name()}">
+                                <Data_zawarcia.rok><xsl:value-of select=""/></Data_zawarcia.rok>
+                                <xsl:copy-of select="."/>
+                            </xsl:element>
+                        </xsl:for-each>
+                    </xsl:variable>-->
+            
+            
+            
+            <!--<xsl:result-document href="/Users/a.binder/Downloads/kont_old.xml">
+                <xsl:copy-of select="$BI_audit_ENERGA_RUM_UMOWY_fix"/>
+                <xsl:comment>count = <xsl:value-of select="count($BI_audit_ENERGA_RUM_UMOWY_fix//*)"/></xsl:comment>
+            </xsl:result-document>-->
+            
+            <!--<xsl:result-document href="/Users/a.binder/Downloads/kont_new.xml">
+                <xsl:copy-of select="$BI_audit_ENERGA_RUM_UMOWY_fix"/>
+                <xsl:comment>count = <xsl:value-of select="count($BI_audit_ENERGA_RUM_KONTRAHENCI_used//*)"/></xsl:comment>
+            </xsl:result-document>-->
+            
+            <xsl:variable name="polarize_spolka_nazwa" select="Pelna_nazwa_kontrahenta"/>
+            <xsl:variable name="polarize_spolka" select="ID"/>
+            
+            <xsl:variable name="Spolka_glowna">
+                <Spolka_glowna_root>
+                    <xsl:for-each-group select="$BI_audit_ENERGA_RUM_UMOWY_fix/BI_audit_ENERGA_RUM_UMOWY" group-by="Spolka_glowna">
+                        <xsl:sort select="Spolka_glowna"/>
+                        <xsl:copy-of select="Spolka_glowna"/>
+                    </xsl:for-each-group>
+                </Spolka_glowna_root>
+            </xsl:variable>
+            
+            
+            <xsl:variable name="Spolka_glowna" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_Spolka_glowna($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+            
+            
+            
+            
+            <xsl:variable name="Osoba_merytoryczna___nazwisko_i_imie" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_Osoba_merytoryczna___nazwisko_i_imie($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+            
+            
+            
+            <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY.rok or system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_RUM_UMOWY.rok -->
+            
+            
+            <xsl:variable name="rok" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_RUM_UMOWY.rok($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+            
+            <!--<xsl:result-document href="/Users/a.binder/Downloads/rok_umowy.xml">
+                <xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_RUM_UMOWY.rok($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+            </xsl:result-document>-->
+            
+            <!--<xsl:result-document href="/Users/a.binder/Downloads/rok_faktury.xml">
+                <xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY.rok($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+            </xsl:result-document>-->
+            
+            <!--<debugs.993>
+                                <xsl:copy-of select="$Spolka_glowna"/>
+                                <xsl:copy-of select="$Osoba_merytoryczna___nazwisko_i_imie"/>
+                                <xsl:copy-of select="$rok"/>
+                            </debugs.993>-->
+            <!--Analiza podpisywanych umow w RUM kwotowo wszystkie spółki - w mln (7)-->
+            
+            
+            
+            <!--<debug.1187>
+                            <xsl:copy-of select="$topic"/>
+                        </debug.1187>-->
+
+            <!--<related-links>
+                        <xsl:apply-templates mode="ditamap_root.embedded_map" select="$topic">
+                            <xsl:with-param name="path_rel" select="'../'"/>
+                            <xsl:with-param name="xref" select="'link'"/>
+                        </xsl:apply-templates>
+                    </related-links>-->
+            <!--<xsl:apply-templates mode="Benford:ditamap_root.embedded_map.body.topic.cleanup" select="$topic"/>-->
+            
+            
+            <xsl:variable name="topic.faktury">
+                <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY" select=".">
+                    <xsl:with-param name="group_name" select="$group_name"/>
+                    <xsl:with-param name="resulset"  select="$resulset"/>
+                </xsl:apply-templates>
+            </xsl:variable>
+            
+            <!--<xsl:result-document href="/Users/a.binder/Downloads/topic.faktury.xml">
+                <xsl:copy-of select="$topic.faktury"/>
+            </xsl:result-document>-->
+            
+            <xsl:variable name="topic">
+                <xsl:choose>
+                    <xsl:when test="number($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.DISABLE)&gt;0"/>
+                    <xsl:when test="$Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie">
+                        <topic id="topic_ghxf_rum_aos_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                            <xsl:variable name="polarize_osoba_string" select="'Hirsz' "/>
+                            <title>Analiza podpisywanych umow w RUM [] - Osoby merytoryczne (1). </title>
+                            <xsl:message>#1106 Analiza podpisywanych umow w RUM - Osoby merytoryczne. </xsl:message>
+                            <body>
+                                <draft-comment author="a.binder">#150D-443
+                                    count($Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie) <xsl:value-of select="count($Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie)"/>
+                                    c($rok//Data_zawarcia.rok) <xsl:value-of select="count($rok//Data_zawarcia.rok)"/>
+                                    c($topic.faktury) = <xsl:value-of select="count($topic.faktury//*)"/>
+                                    c($$BI_audit_ENERGA_RUM_UMOWY_fix) = <xsl:value-of select="count($BI_audit_ENERGA_RUM_UMOWY_fix)"/>
+                                    $rok sample = <xsl:copy-of select="$rok"></xsl:copy-of>
+                                </draft-comment>
+                                <xsl:choose>
+                                    <xsl:when test="$Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie">
+                                        <simpletable frame="all"  id="simpgletablesss_inaaz_fwf_{generate-id()}" system_cache__dita:width_cols="auto"  system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" props="RUMU152"> <!-- system_cache__dita:width_cols="10" system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" -->
+                                            
+                                            <sthead>
+                                                <stentry>Osoba</stentry>
+                                                <xsl:for-each select="$rok//Data_zawarcia.rok">
+                                                    <stentry><xsl:value-of select="."/></stentry>
+                                                </xsl:for-each>
+                                                <stentry>Suma</stentry>
+                                            </sthead>
+                                            <xsl:for-each select="$Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie  ">
+                                                <xsl:variable name="Osoba" select="."/>
+                                                <strow>
+                                                    <stentry><xsl:value-of select="."/></stentry>
+                                                    <xsl:for-each select="$rok//Data_zawarcia.rok">
+                                                        <xsl:variable name="rok_cur" select="."/>
+                                                        <xsl:message>#194 Osoba <xsl:value-of select="$Osoba"/> / Rok <xsl:value-of select="$rok_cur"/></xsl:message>
+                                                        <stentry>
+                                                            <xsl:value-of select="system_cache__dita:big_values_format(sum($BI_audit_ENERGA_RUM_UMOWY_fix//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and system_cache__dita:year(Data_zawarcia) = $rok_cur ]/number(Wartosc)))   "/>
+                                                            <xsl:variable name="Benford:table">
+                                                                <Benford:table>
+                                                                    <xsl:attribute name="Benford:year" select="."/>
+                                                                    <xsl:attribute name="Benford:subject" select="$Osoba"/>
+                                                                    <xsl:for-each select="$BI_audit_ENERGA_RUM_UMOWY_fix//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and system_cache__dita:year(Data_zawarcia) = $rok_cur and not(Wartosc = '0' )]">
+                                                                        <Benford:value><xsl:value-of select="substring( Wartosc,1,1)"/></Benford:value>
+                                                                    </xsl:for-each>
+                                                                </Benford:table>
+                                                            </xsl:variable>
+                                                            <TEST>
+                                                                <xsl:copy-of select="$Benford:table"></xsl:copy-of>
+                                                            </TEST>
+                                                            <xsl:comment>#179 if $Benford:table//Benford:value = <xsl:if test="$Benford:table//Benford:value">== true </xsl:if></xsl:comment>
+                                                            <xsl:if test="$Benford:table//Benford:value">
+                                                                <!--<xsl:copy-of select="$Benford:table"/>-->
+                                                                <xsl:variable name="Benford:table_analys">
+                                                                    <xsl:apply-templates mode="Benford:table_analys" select="$Benford:table"/>
+                                                                </xsl:variable>
+                                                                
+                                                                <xsl:comment>#1138 lower $Benford:table_analys</xsl:comment>
+                                                                <xsl:copy-of select="$Benford:table_analys"/>
+                                                                <xsl:comment>#1138B upper EOF $Benford:table_analys</xsl:comment>
+                                                                <xsl:apply-templates mode="system_cache__dita:topic" select="$Benford:table_analys">
+                                                                    <xsl:with-param name="Benford:subject.xml" select="$BI_audit_ENERGA_RUM_UMOWY_fix//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and system_cache__dita:year(Data_zawarcia) = $rok_cur ]"/>
+                                                                    <xsl:with-param name="Benford:subject" select="'Osoba_merytoryczna___nazwisko_i_imie'"/>
+                                                                    <xsl:with-param name="Benford:year" select="'Data_zawarcia'"/>
+                                                                    <xsl:with-param name="Benford:subject.value" select="'Wartosc'"/>
+                                                                    <xsl:with-param name="Benford:subject.description" select="'Data_zawarcia Numer_rejestrowy Przedmiot_umowy Kontrahenci'"/>
+                                                                    <xsl:with-param name="Benford:force_raport" select="true()"/>
+                                                                    <!--<xsl:with-param name="id" select="concat('simpleetableadddaa_benford',position(),'_',generate-id())"/>-->
+                                                                </xsl:apply-templates>
+                                                            </xsl:if>
+                                                        </stentry>
+                                                        <!-- '###,###.00' -->
+                                                    </xsl:for-each>
+                                                    <stentry>
+                                                        <xsl:value-of select="system_cache__dita:big_values_format(sum($BI_audit_ENERGA_RUM_UMOWY_fix//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)   ]/number(Wartosc)   ))"/>
+                                                        <xsl:variable name="Benford:table">
+                                                            <Benford:table>
+                                                                <xsl:attribute name="Benford:year" select="'SUMA'"/>
+                                                                <xsl:attribute name="Benford:subject" select="$Osoba"/>
+                                                                <xsl:for-each select="$BI_audit_ENERGA_RUM_UMOWY_fix//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and not(Wartosc = '0' )]">
+                                                                    <Benford:value><xsl:value-of select="substring( Wartosc,1,1)"/></Benford:value>
+                                                                </xsl:for-each>
+                                                            </Benford:table>
+                                                        </xsl:variable>
+                                                        <xsl:if test="$Benford:table//Benford:value">
+                                                            <!--<xsl:copy-of select="$Benford:table"/>-->
+                                                            <xsl:variable name="Benford:table_analys">
+                                                                <xsl:apply-templates mode="Benford:table_analys" select="$Benford:table"/>
+                                                            </xsl:variable>
+                                                            <xsl:copy-of select="$Benford:table_analys"/>
+                                                            <xsl:apply-templates mode="system_cache__dita:topic" select="$Benford:table_analys">
+                                                                <xsl:with-param name="Benford:subject.xml" select="$BI_audit_ENERGA_RUM_UMOWY_fix//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  ]"/>
+                                                                <xsl:with-param name="Benford:subject" select="'Osoba_merytoryczna___nazwisko_i_imie'"/>
+                                                                <xsl:with-param name="Benford:year" select="'Data_zawarcia'"/>
+                                                                <xsl:with-param name="Benford:subject.value" select="'Wartosc'"/>
+                                                                <xsl:with-param name="Benford:subject.description" select="'Data_zawarcia Numer_rejestrowy Przedmiot_umowy Kontrahenci'"/>
+                                                                <!--<xsl:with-param name="id" select="concat('simpleetableahhaa_benford',position(),'_',generate-id())"/>-->
+                                                            </xsl:apply-templates>
+                                                        </xsl:if>
+                                                    </stentry>
+                                                </strow>
+                                                <!--<debug.1182.rum_umowy>
+                                            <xsl:copy-of select="$BI_audit_ENERGA_RUM_UMOWY_fix//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  ]"/>
+                                        </debug.1182.rum_umowy>-->
+                                            </xsl:for-each>
+                                        </simpletable>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <p>3.Raport nie zawiera informacji o umowach z uwagi (nie były dostępne takie dane wejściowe dla modułu raportu).</p>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                                
+                            </body>
+                        </topic>
+                    </xsl:when>
+                </xsl:choose>
+                
+            </xsl:variable>
+            
+            <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY_vs_BI_audit_ENERGA_RUM_UMOWY">
+                <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY_vs_BI_audit_ENERGA_RUM_UMOWY" select=".">
+                    <xsl:with-param name="group_name" select="$group_name"/>
+                    <xsl:with-param name="resulset"  select="$resulset"/>
+                </xsl:apply-templates>
+                <!--</xsl:result-document>-->
+            </xsl:variable>
+            
+            <xsl:message>#266 will save to <xsl:value-of select="$title"/>; con/@generate-id=<xsl:value-of select="@generate-id"/>;</xsl:message>
+            <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}"> <!--XX  href="{$temp}/{$uuid}/{system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position)}.dita -->
+                                
+                <!--                    Analiza spójności liczbowej dla ID kontr <xsl:value-of select="current()/ID"/>
+-->                    
+               
+                <topic id="{$uuid}topic_simpletable_person_{$group_name}_{position()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                    <xsl:variable name="count">
+                        <count>
+                            <xsl:for-each-group select="current-group()/../../." group-by="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip) , BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip))">
+                                <row/>
+                            </xsl:for-each-group>
+                        </count>
+                    </xsl:variable>
+                    
+                    <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.title" select="parent::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object">
+                        <xsl:with-param name="count" select="count($count//row)"/>
+                    </xsl:apply-templates>
+                    <prolog>
+                        <metadata>
+                            <xsl:call-template name="system_cache__dita:indexterm">
+                                <xsl:with-param name="system_cache__dita:element"/>
+                                <xsl:with-param name="indexterm" select="*[local-name()=$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_KONTRAHENCI.Pelna_nazwa_kontrahenta]/text()"/>
+                                <xsl:with-param name="text"/>
+                            </xsl:call-template>
+                        </metadata>
+                    </prolog>
+                    
+                    <body>
+                        <draft-comment author="a.binder">#807-X $group_name = <xsl:value-of select="$group_name"/>;  count(curr_gr)=<xsl:value-of select="count(current-group())"/> ; </draft-comment>
+                        <simpletable frame="all" relcolwidth="1* 3* 3*" id="{$uuid}simpletable_rows__child_person_{$group_name}_{$refpos}" props="RUMK_298">
+                            <strow>
+                                <stentry>Lp</stentry>
+                                <!--<stentry>Uwagi!</stentry>-->
+                                <stentry>Osoba od</stentry>
+                                <stentry>Firma do.</stentry>
+                            </strow>
+                            <!-- <xsl:for-each select="current-group()[ position() &lt; 10 ] ">-->
+                            <xsl:variable name="current_group_person" select="current-group()/../../."/>
+                            <xsl:for-each-group select="current-group()/../../.[ position() &lt; 10 ] " group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"><!-- firmy do -->
+                                <xsl:variable name="position_1" select="position()"/>    
+                                <xsl:variable name="firma_do_id" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/>
+                                <xsl:comment>#278 firma do <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/></xsl:comment>
+                                <xsl:message>#278 firma do <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/></xsl:message>
+                                <xsl:variable name="context" select="."/>
+                                <xsl:for-each-group select="$current_group_person[ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last()]/*[position()=1]/@fid = $firma_do_id  and position() &lt; 10 ] " group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/@fid"> <!-- pracownicy -->
+                                    <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.middle_ref" select=".">
+                                        <xsl:with-param name="position_1" select="$position_1"/>
+                                        <xsl:with-param name="position" select="position()"/>
+                                        <xsl:with-param name="context" select="$context"/>
+                                        <xsl:with-param name="title" select="$title"/>
+                                    </xsl:apply-templates>
+                                </xsl:for-each-group>
+                            </xsl:for-each-group>
+                            <!--</xsl:for-each>-->
+                        </simpletable>
+                    </body>
+ 
+                <xsl:choose>
+                    <xsl:when test="number($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.DISABLE)&gt;0"/>
+                    <xsl:otherwise>
+                        <xsl:apply-templates mode="ditamap_root.embedded_map" select="$topic">
+                            <xsl:with-param name="path_rel" select="'../'"/>
+                            <xsl:with-param name="xref" select="'topic'"/>
+                        </xsl:apply-templates>
+                        <xsl:apply-templates mode="ditamap_root.embedded_map" select="$topic.faktury">
+                            <xsl:with-param name="path_rel" select="'../'"/>
+                            <xsl:with-param name="xref" select="'topic'"/>
+                        </xsl:apply-templates>
+                        <xsl:choose>
+                            <xsl:when test="number($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.FXU.DISABLE) &gt;0"/>
+                            <xsl:otherwise>
+                                <xsl:apply-templates mode="ditamap_root.embedded_map" select="$BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY_vs_BI_audit_ENERGA_RUM_UMOWY">
+                                    <xsl:with-param name="path_rel" select="'../'"/>
+                                    <xsl:with-param name="xref" select="'topic'"/>
+                                </xsl:apply-templates>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        
+                    </xsl:otherwise>
+                </xsl:choose>
+                  
+                </topic>
+            </xsl:result-document>
+            
+            <!--<debug.1221>
+                <xsl:copy-of select="$topic"/>
+            </debug.1221>-->
+            
+            <xsl:choose>
+                <xsl:when test="number($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.DISABLE)&gt;0"/>
+                <xsl:when test="$Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie">
+                    <xsl:apply-templates mode="ditamap_root.embedded_map.topic_child_to_ditamap" select="$topic">
+                        <xsl:with-param name="path_rel" select="''"/>
+                    </xsl:apply-templates>
+                    <xsl:apply-templates mode="ditamap_root.embedded_map.topic_child_to_ditamap" select="$topic.faktury">
+                        <xsl:with-param name="path_rel" select="''"/>
+                    </xsl:apply-templates>
+                    <xsl:comment>#1732</xsl:comment>
+                </xsl:when>
+            </xsl:choose>
+            
+            
+            
+            <!--<topicref href="{$group_name}/{$refpos}_FXU.dita">
+                <!-\-<xsl:result-document href="{$temp}/{$uuid}/{$group_name}/{$refpos}_FXU.dita">-\->
+                    
+            </topicref>-->
+        </topicref>
+        <xsl:comment>EOF #1745 test for <xsl:value-of select="local-name()"/>; @fid = <xsl:value-of select="@fid"/>; </xsl:comment>
+        
+        
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 448 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_ENERGA_RUM_UMOWY.xsl

@@ -0,0 +1,448 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Alter.Wartosc">
+        <xsl:param name="BI_audit_ENERGA_RUM_UMOWY"/>     
+        <xsl:choose>
+            <xsl:when test="$BI_audit_ENERGA_RUM_UMOWY/Wartosc"><xsl:value-of select="$BI_audit_ENERGA_RUM_UMOWY/Wartosc"/></xsl:when>
+            <xsl:when test="$BI_audit_ENERGA_RUM_UMOWY/Kwota_netto"><xsl:value-of select="$BI_audit_ENERGA_RUM_UMOWY/Kwota_netto"/></xsl:when>
+            <xsl:otherwise><xsl:value-of select="$BI_audit_ENERGA_RUM_UMOWY/Wartosc"/></xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_RUM_UMOWY.rok">
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI_used" required="yes"/>
+        <xsl:message>#241 test for <xsl:value-of select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used/default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY/name()"/>; yerar(<xsl:value-of select="system_cache__dita:year($BI_audit_ENERGA_RUM_KONTRAHENCI_used[1]/default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:Data_zawarcia)"/>)</xsl:message>
+        <rok>
+            <xsl:for-each-group select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used" group-by="system_cache__dita:year((default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:Data_zawarcia|Data_zawarcia))">
+                <xsl:sort select="system_cache__dita:year((Data_zawarcia|default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:Data_zawarcia))"/><!-- TODO pole ma format teraz  2017-10-10T00:00:00 -->
+                <xsl:message>#244 rok <xsl:value-of select="default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:Data_zawarcia"/></xsl:message>
+                <xsl:element name="Data_zawarcia.rok">
+                    <xsl:attribute name="ID" select="(ID|default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:ID)"/>
+                    <xsl:value-of select="system_cache__dita:year((Data_zawarcia|default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:Data_zawarcia))"/>
+                </xsl:element>
+            </xsl:for-each-group>
+        </rok>
+    </xsl:function>
+    
+    
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.rok.UMOWY__FAKTURY">
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI_used" required="yes"/>
+        <rok>
+            <xsl:variable name="rok_all">
+                <rok_all>
+                    <xsl:for-each-group select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used/(BI_audit_ENERGA_RUM_UMOWY|default_db__x3A__BI_audit_ENERGA_RUM_UMOWY:BI_audit_ENERGA_RUM_UMOWY)" group-by="system_cache__dita:year(Data_zawarcia)">
+                        <xsl:sort select="system_cache__dita:year(Data_zawarcia)"/><!-- TODO pole ma format teraz  2017-10-10T00:00:00 -->
+                        <xsl:element name="Data_zawarcia.rok">
+                            <xsl:attribute name="ID" select="ID"/>
+                            <xsl:value-of select="system_cache__dita:year(Data_zawarcia)"/>
+                        </xsl:element>
+                    </xsl:for-each-group>
+                    <xsl:for-each-group select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used/BI_audit_ENERGA_FAKTURY" group-by="system_cache__dita:year(data_sprzedazy)">
+                        <xsl:sort select="system_cache__dita:year(data_sprzedazy)"/><!-- TODO pole ma format teraz  2017-10-10T00:00:00 -->
+                        <xsl:element name="Data_zawarcia.rok">
+                            <xsl:attribute name="ID" select="ID"/>
+                            <xsl:value-of select="system_cache__dita:year(data_sprzedazy)"/>
+                        </xsl:element>
+                    </xsl:for-each-group>
+                </rok_all>
+            </xsl:variable>
+            <xsl:for-each-group select="$rok_all/rok_all/Data_zawarcia.rok" group-by="text()">
+                <xsl:copy copy-namespaces="no">
+                    <xsl:copy-of select="@*" copy-namespaces="no"/>
+                    <xsl:copy-of select="text()" copy-namespaces="no"/>
+                </xsl:copy>
+            </xsl:for-each-group>
+        </rok>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY.rok">
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI_used" required="yes"/>
+        <rok>
+            <xsl:for-each-group select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used/BI_audit_ENERGA_FAKTURY" group-by="system_cache__dita:year(data_sprzedazy)">
+                <xsl:sort select="system_cache__dita:year(data_sprzedazy)"/><!-- TODO pole ma format teraz  2017-10-10T00:00:00 -->
+                <xsl:element name="Data_zawarcia.rok">
+                    <xsl:attribute name="ID" select="ID"/>
+                    <xsl:value-of select="system_cache__dita:year(data_sprzedazy)"/>
+                </xsl:element>
+            </xsl:for-each-group>
+        </rok>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_Osoba_merytoryczna___nazwisko_i_imie">
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI_used" required="yes"/>
+        <Osoba_merytoryczna___nazwisko_i_imie_root>
+            <xsl:for-each-group select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used/BI_audit_ENERGA_RUM_UMOWY" group-by="Osoba_merytoryczna___nazwisko_i_imie">
+                <xsl:sort select="Osoba_merytoryczna___nazwisko_i_imie"/>
+                <xsl:copy-of select="Osoba_merytoryczna___nazwisko_i_imie" copy-namespaces="no"/>
+            </xsl:for-each-group>
+            <!--<xsl:for-each-group select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used/BI_audit_ENERGA_FAKTURY" group-by="Osoba_merytoryczna___nazwisko_i_imie">
+                <xsl:sort select="Osoba_merytoryczna___nazwisko_i_imie"/>
+                <xsl:copy-of select="Osoba_merytoryczna___nazwisko_i_imie"/>
+            </xsl:for-each-group>-->
+        </Osoba_merytoryczna___nazwisko_i_imie_root>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_Spolka_glowna">
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI_used" required="yes"/>
+        <Spolka_glowna_root>
+            <xsl:for-each-group select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used/BI_audit_ENERGA_RUM_UMOWY" group-by="*[ name()=$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Spolka_glowna]">
+                <xsl:sort select="*[ name()=$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Spolka_glowna]"/>
+                <xsl:copy-of select="*[ name()=$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Spolka_glowna]" copy-namespaces="no"/>
+            </xsl:for-each-group>
+        </Spolka_glowna_root>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_used">
+        <xsl:param name="resulset" required="yes"/>
+        <xsl:param name="current"/>
+        <xsl:copy-of select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI[@fid = $current/@fid ]" copy-namespaces="no"/> <!-- XX1 SURE? -->
+    </xsl:function>
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY_vs_BI_audit_ENERGA_RUM_UMOWY" match="*|text()|comment()"/>
+    
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY_vs_BI_audit_ENERGA_RUM_UMOWY" match="BI_audit_ENERGA_RUM_KONTRAHENCI" > <!-- do analizy faktur na podstawie template analizy umow -->
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="resulset" required="yes"/>
+        
+        
+        <xsl:variable name="polarize_spolka" select="ID"/>
+        <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI_used" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_used($resulset,current())"/>
+        
+        
+        <xsl:variable name="Spolka_glowna" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_Spolka_glowna($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+        <xsl:variable name="Osoba_merytoryczna___nazwisko_i_imie" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_Osoba_merytoryczna___nazwisko_i_imie($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+        
+        <xsl:variable name="rok" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.rok.UMOWY__FAKTURY($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+        
+        <!--<xsl:result-document href="/Users/a.binder/Downloads/rok_VS.xml">
+            <xsl:copy-of select="$rok"/>
+        </xsl:result-document>-->
+        <!--system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_RUM_UMOWY.rok-->
+        
+        <xsl:variable name="FAKTURY_vs_UMOWY">
+            <FAKTURY_vs_UMOWY>
+                <BI_audit_ENERGA_FAKTURY navtitle="faktury"
+                    subject.value="{$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_FAKTURY.Kwota_netto}"
+                    subject.date="{$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_FAKTURY.data_sprzedazy}"
+                    subject.date2="{$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Data_zawarcia}"
+                />
+                <BI_audit_ENERGA_RUM_UMOWY navtitle="umowy"
+                    subject.value="{$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Wartosc}"
+                    subject.date="{$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Data_zawarcia}"
+                />
+            </FAKTURY_vs_UMOWY>
+        </xsl:variable>
+        
+        <topic id="topic_ghxxxf_fxu_uaam_aos_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <xsl:variable name="polarize_osoba_string" select="'Hirsz' "/>
+            <xsl:choose>
+                <xsl:when test="$rok//Data_zawarcia.rok"></xsl:when>
+            </xsl:choose>
+            <title>Analiza FAKTUR vs UMOWY - kwoty (FXU). </title>
+            <xsl:message>#220 Analiza FAKTUR - Osoby merytoryczne. </xsl:message>
+            <body>
+                <draft-comment author="a.binder">#150-222
+                    $system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Data_zawarcia = <xsl:value-of select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.Data_zawarcia"/>
+                    count($Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie) <xsl:value-of select="count($Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie)"/>
+                    c($rok//Data_zawarcia.rok) <xsl:value-of select="count($rok//Data_zawarcia.rok)"/>
+                    c/$BI_audit_ENERGA_RUM_KONTRAHENCI_used = <xsl:value-of select="count($BI_audit_ENERGA_RUM_KONTRAHENCI_used//*)"/>
+                    
+                     = <!--<xsl:copy-of select="$rok"></xsl:copy-of>-->
+                    <!--<DEBUG.BI_audit_ENERGA_RUM_KONTRAHENCI_used>
+                        <xsl:copy-of select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used"></xsl:copy-of>
+                    </DEBUG.BI_audit_ENERGA_RUM_KONTRAHENCI_used>-->
+                </draft-comment>
+                <xsl:choose>
+                    <xsl:when test="$rok//Data_zawarcia.rok">
+                        <xsl:variable name="simpletable">
+                            <simpletable frame="all"  id="simpglefxu_taakbslesss_inaaz_fwf_{generate-id()}" system_cache__dita:width_cols="auto"  system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" props="nograph"> <!-- system_cache__dita:width_cols="10" system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" -->
+                                
+                                <sthead>
+                                    <stentry>Rejestr</stentry>
+                                    <xsl:for-each select="$rok//Data_zawarcia.rok">
+                                        <stentry><xsl:value-of select="."/></stentry>
+                                    </xsl:for-each>
+                                    <stentry>Suma</stentry>
+                                </sthead>
+                                
+                                <xsl:for-each select="$FAKTURY_vs_UMOWY/FAKTURY_vs_UMOWY/*">
+                                    <xsl:variable name="rej" select="."/>
+                                    <strow>
+                                        <stentry><xsl:value-of select="@navtitle"/></stentry>
+                                        <xsl:for-each select="$rok//Data_zawarcia.rok">
+                                            <xsl:variable name="rok_cur" select="."/>
+                                            <xsl:message>#306 navtitle <xsl:value-of select="$rej/@navtitle"/> / Rok <xsl:value-of select="$rok_cur"/></xsl:message>
+                                            <stentry>
+                                                <xsl:value-of select="sum($BI_audit_ENERGA_RUM_KONTRAHENCI_used//*[ local-name()=$rej/local-name()  and system_cache__dita:year(*[local-name()=$rej/@subject.date]) = $rok_cur ]/number(*[local-name()=$rej/@subject.value]))  "/>
+                                                <!--<xsl:variable name="Benford:table">
+                                                    <Benford:table>
+                                                        <xsl:attribute name="Benford:year" select="."/>
+                                                        <xsl:attribute name="Benford:subject" select="$rej/@navtitle"/>
+                                                        <xsl:for-each select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//*[ local-name()=$rej/local-name()   and system_cache__dita:year(*[local-name()=$rej/@subject.date]) = $rok_cur and not(*[local-name()=$rej/@subject.value] = '0' )]">
+                                                            <Benford:value><xsl:value-of select="substring( *[local-name()=$rej/@subject.value],1,1)"/></Benford:value>
+                                                        </xsl:for-each>
+                                                    </Benford:table>
+                                                </xsl:variable>-->
+                                                <!--<xsl:if test="$Benford:table//Benford:value">
+                                                    <!-\-<xsl:copy-of select="$Benford:table"/>-\->
+                                                    <xsl:variable name="Benford:table_analys">
+                                                        <xsl:apply-templates mode="Benford:table_analys" select="$Benford:table"/>
+                                                    </xsl:variable>
+                                                    
+                                                    <xsl:comment>#1138 lower $Benford:table_analys</xsl:comment>
+                                                    <xsl:copy-of select="$Benford:table_analys"/>
+                                                    <xsl:comment>#1138B upper EOF $Benford:table_analys</xsl:comment>
+                                                    <xsl:apply-templates mode="system_cache__dita:topic" select="$Benford:table_analys">
+                                                        <xsl:with-param name="Benford:subject.xml" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and system_cache__dita:year(data_sprzedazy) = $rok_cur ]"/>
+                                                        <xsl:with-param name="Benford:subject" select="'Osoba_merytoryczna___nazwisko_i_imie'"/>
+                                                        <xsl:with-param name="Benford:year" select="'data_sprzedazy'"/>
+                                                        <xsl:with-param name="Benford:subject.value" select="'Kwota_netto'"/>
+                                                        <xsl:with-param name="Benford:subject.description" select="'Kwota_netto nrFaktury usluga Nazwa'"/>
+                                                        <xsl:with-param name="Benford:force_raport" select="true()"/>
+                                                        <!-\-<xsl:with-param name="id" select="concat('simpleetableadddaa_benford',position(),'_',generate-id())"/>-\->
+                                                    </xsl:apply-templates>
+                                                </xsl:if>-->
+                                            </stentry>
+                                            <!-- '###,###.00' -->
+                                        </xsl:for-each>
+                                        <stentry>
+                                            <xsl:value-of select="sum($BI_audit_ENERGA_RUM_KONTRAHENCI_used//*[  local-name()=$rej/local-name()  ]/number(*[local-name()=$rej/@subject.value])   )"/>
+                                            <!--<xsl:variable name="Benford:table">
+                                                <Benford:table>
+                                                    <xsl:attribute name="Benford:year" select="'SUMA'"/>
+                                                    <xsl:attribute name="Benford:subject" select="$Osoba"/>
+                                                    <xsl:for-each select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and not(Kwota_netto = '0' )]">
+                                                        <Benford:value><xsl:value-of select="substring( Kwota_netto,1,1)"/></Benford:value>
+                                                    </xsl:for-each>
+                                                </Benford:table>
+                                            </xsl:variable>-->
+                                            <!--<xsl:if test="$Benford:table//Benford:value">
+                                                <!-\-<xsl:copy-of select="$Benford:table"/>-\->
+                                                <xsl:variable name="Benford:table_analys">
+                                                    <xsl:apply-templates mode="Benford:table_analys" select="$Benford:table"/>
+                                                </xsl:variable>
+                                                <xsl:copy-of select="$Benford:table_analys"/>
+                                                <xsl:apply-templates mode="system_cache__dita:topic" select="$Benford:table_analys">
+                                                    <xsl:with-param name="Benford:subject.xml" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  ]"/>
+                                                    <xsl:with-param name="Benford:subject" select="'Osoba_merytoryczna___nazwisko_i_imie'"/>
+                                                    <xsl:with-param name="Benford:year" select="'data_sprzedazy'"/>
+                                                    <xsl:with-param name="Benford:subject.value" select="'Kwota_netto'"/>
+                                                    <xsl:with-param name="Benford:subject.description" select="'Kwota_netto nrFaktury usluga Nazwa'"/>
+                                                    <!-\-<xsl:with-param name="id" select="concat('simpleetableahhaa_benford',position(),'_',generate-id())"/>-\->
+                                                </xsl:apply-templates>
+                                            </xsl:if>-->
+                                        </stentry>
+                                    </strow>
+                                    <!--<debug.1182.rum_umowy>
+                                                <xsl:copy-of select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  ]"/>
+                                            </debug.1182.rum_umowy>-->
+                                </xsl:for-each>
+                            </simpletable>
+                        </xsl:variable>
+                        <xsl:for-each select="$simpletable/*">
+                            <xsl:copy copy-namespaces="no">
+                                <xsl:copy-of select="@*" copy-namespaces="no"/>
+                                <xsl:copy-of select="sthead" copy-namespaces="no"/>
+                                <xsl:for-each select="strow">
+                                    <xsl:copy  copy-namespaces="no">
+                                        <xsl:copy-of select="@*" copy-namespaces="no"/>
+                                        <xsl:for-each select="stentry">
+                                            <xsl:copy copy-namespaces="no">
+                                                <xsl:copy-of select="@*"/>
+                                                <xsl:choose>
+                                                    <xsl:when test="position() = 1">
+                                                        <xsl:copy-of select="text()" copy-namespaces="no"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise><xsl:value-of select="system_cache__dita:big_values_format(text())"/></xsl:otherwise>
+                                                </xsl:choose>
+                                            </xsl:copy>
+                                        </xsl:for-each>
+                                    </xsl:copy>
+                                </xsl:for-each>
+                                <xsl:choose>
+                                    <xsl:when test="number($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.FXU.differences.DISABLE)&gt;0"/>
+                                    <xsl:otherwise>
+                                        <strow props="FXU.differences">
+                                            <xsl:for-each select="sthead[1]/stentry">
+                                                <xsl:variable name="pos" select="position()"/>
+                                                <xsl:choose >
+                                                    <xsl:when test="position() = 1" >
+                                                        <stentry >różnice</stentry>
+                                                    </xsl:when>
+                                                    <xsl:when test="position() = last()"> <!-- system_cache__dita:big_values_format -->
+                                                        <stentry ><xsl:value-of select="system_cache__dita:big_values_format($simpletable//strow[1]/stentry[ $pos]/text() - $simpletable//strow[2]/stentry[ $pos]/text() )"/></stentry>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <stentry><xsl:value-of select="system_cache__dita:big_values_format($simpletable//strow[1]/stentry[ $pos]/text() - $simpletable//strow[2]/stentry[ $pos]/text()) "/></stentry> <!-- poss="{$pos}" val1="{$simpletable//strow[1]/stentry[$pos]/text()}" val2="{$simpletable//strow[2]/stentry[ $pos]/text()}" -->
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </xsl:for-each>
+                                        </strow>
+                                    </xsl:otherwise>
+                                </xsl:choose>
+                                
+                            </xsl:copy>
+                        </xsl:for-each>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <p>2.Raport nie zawiera informacji o umowach z uwagi (nie były dostępne takie dane wejściowe dla modułu raportu).</p>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
+            </body>
+        </topic>
+    </xsl:template>
+    
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY" match="BI_audit_ENERGA_RUM_KONTRAHENCI" > <!-- do analizy faktur na podstawie template analizy umow -->
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="resulset" required="yes"/>
+        
+        
+        <xsl:variable name="polarize_spolka" select="ID"/>
+        <xsl:variable name="BI_audit_ENERGA_RUM_KONTRAHENCI_used" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_used($resulset,current())"/>
+        
+        
+        <xsl:variable name="Spolka_glowna" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_Spolka_glowna($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+        <xsl:variable name="Osoba_merytoryczna___nazwisko_i_imie" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_Osoba_merytoryczna___nazwisko_i_imie($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+        
+        <xsl:variable name="rok" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_FAKTURY.rok($BI_audit_ENERGA_RUM_KONTRAHENCI_used)"/>
+        <!--system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI.BI_audit_ENERGA_RUM_UMOWY.rok-->
+        
+        
+        <topic id="topic_ghxf_ruaam_aos_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <xsl:variable name="polarize_osoba_string" select="'Hirsz' "/>
+            <title>Analiza FAKTUR [] - Osoby merytoryczne (1). </title>
+            <xsl:message>#220 Analiza FAKTUR - Osoby merytoryczne. </xsl:message>
+            <body>
+                <draft-comment author="a.binder">#150-444
+                    c/$BI_audit_ENERGA_RUM_KONTRAHENCI_used = <xsl:value-of select="count($BI_audit_ENERGA_RUM_KONTRAHENCI_used//*)"/>
+                    $polarize_osoba_string = <xsl:value-of select="$polarize_osoba_string"/>
+                    count($Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie) <xsl:value-of select="count($Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie)"/>
+                    c($rok//Data_zawarcia.rok) <xsl:value-of select="count($rok//Data_zawarcia.rok)"/>
+                    
+                    
+                    $rok sample = <xsl:copy-of select="$rok"></xsl:copy-of>
+                </draft-comment>
+                <xsl:choose>
+                    <xsl:when test="$Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie">
+                        <simpletable frame="all"  id="simpgletablesss_inaaz_fwf_{generate-id()}" system_cache__dita:width_cols="auto"  system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true"> <!-- system_cache__dita:width_cols="10" system_cache__dita:bypass_rows_with_zero="true" system_cache__dita:bypass_rows_empty="true" -->
+                            
+                            <sthead>
+                                <stentry>Osoba</stentry>
+                                <xsl:for-each select="$rok//Data_zawarcia.rok">
+                                    <stentry><xsl:value-of select="."/></stentry>
+                                </xsl:for-each>
+                                <stentry>Suma</stentry>
+                            </sthead>
+                            
+                            
+                            <xsl:for-each select="$Osoba_merytoryczna___nazwisko_i_imie//Osoba_merytoryczna___nazwisko_i_imie  ">
+                                <xsl:variable name="Osoba" select="."/>
+                                <strow>
+                                    <stentry><xsl:value-of select="."/></stentry>
+                                    <xsl:for-each select="$rok//Data_zawarcia.rok">
+                                        <xsl:variable name="rok_cur" select="."/>
+                                        <xsl:message>#194 Osoba <xsl:value-of select="$Osoba"/> / Rok <xsl:value-of select="$rok_cur"/></xsl:message>
+                                        <stentry>
+                                            <xsl:value-of select="system_cache__dita:big_values_format(sum($BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and system_cache__dita:year(data_sprzedazy) = $rok_cur ]/number(Kwota_netto)))   "/>
+                                            <xsl:variable name="Benford:table">
+                                                <Benford:table>
+                                                    <xsl:attribute name="Benford:year" select="."/>
+                                                    <xsl:attribute name="Benford:subject" select="$Osoba"/>
+                                                    <xsl:for-each select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and system_cache__dita:year(data_sprzedazy) = $rok_cur and not(Kwota_netto = '0' )]">
+                                                        <Benford:value><xsl:value-of select="substring( Kwota_netto,1,1)"/></Benford:value>
+                                                    </xsl:for-each>
+                                                </Benford:table>
+                                            </xsl:variable>
+                                            <xsl:if test="$Benford:table//Benford:value">
+                                                <!--<xsl:copy-of select="$Benford:table"/>-->
+                                                <xsl:variable name="Benford:table_analys">
+                                                    <xsl:apply-templates mode="Benford:table_analys" select="$Benford:table"/>
+                                                </xsl:variable>
+                                                
+                                                <xsl:comment>#1138 lower $Benford:table_analys</xsl:comment>
+                                                <xsl:copy-of select="$Benford:table_analys" copy-namespaces="no"/>
+                                                <xsl:comment>#1138B upper EOF $Benford:table_analys</xsl:comment>
+                                                <xsl:apply-templates mode="system_cache__dita:topic" select="$Benford:table_analys">
+                                                    <xsl:with-param name="Benford:subject.xml" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and system_cache__dita:year(data_sprzedazy) = $rok_cur ]"/>
+                                                    <xsl:with-param name="Benford:subject" select="'Osoba_merytoryczna___nazwisko_i_imie'"/>
+                                                    <xsl:with-param name="Benford:year" select="'data_sprzedazy'"/>
+                                                    <xsl:with-param name="Benford:subject.value" select="'Kwota_netto'"/>
+                                                    <xsl:with-param name="Benford:subject.description" select="'Kwota_netto nrFaktury usluga Nazwa'"/>
+                                                    <xsl:with-param name="Benford:force_raport" select="true()"/>
+                                                    <!--<xsl:with-param name="id" select="concat('simpleetableadddaa_benford',position(),'_',generate-id())"/>-->
+                                                </xsl:apply-templates>
+                                            </xsl:if>
+                                        </stentry>
+                                        <!-- '###,###.00' -->
+                                    </xsl:for-each>
+                                    <stentry>
+                                        <xsl:value-of select="system_cache__dita:big_values_format(sum($BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)   ]/number(Kwota_netto)   ))"/>
+                                        <xsl:variable name="Benford:table">
+                                            <Benford:table>
+                                                <xsl:attribute name="Benford:year" select="'SUMA'"/>
+                                                <xsl:attribute name="Benford:subject" select="$Osoba"/>
+                                                <xsl:for-each select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  and not(Kwota_netto = '0' )]">
+                                                    <Benford:value><xsl:value-of select="substring( Kwota_netto,1,1)"/></Benford:value>
+                                                </xsl:for-each>
+                                            </Benford:table>
+                                        </xsl:variable>
+                                        <xsl:if test="$Benford:table//Benford:value">
+                                            <!--<xsl:copy-of select="$Benford:table"/>-->
+                                            <xsl:variable name="Benford:table_analys">
+                                                <xsl:apply-templates mode="Benford:table_analys" select="$Benford:table"/>
+                                            </xsl:variable>
+                                            <xsl:copy-of select="$Benford:table_analys" copy-namespaces="no"/>
+                                            <xsl:apply-templates mode="system_cache__dita:topic" select="$Benford:table_analys">
+                                                <xsl:with-param name="Benford:subject.xml" select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_FAKTURY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  ]"/>
+                                                <xsl:with-param name="Benford:subject" select="'Osoba_merytoryczna___nazwisko_i_imie'"/>
+                                                <xsl:with-param name="Benford:year" select="'data_sprzedazy'"/>
+                                                <xsl:with-param name="Benford:subject.value" select="'Kwota_netto'"/>
+                                                <xsl:with-param name="Benford:subject.description" select="'Kwota_netto nrFaktury usluga Nazwa'"/>
+                                                <!--<xsl:with-param name="id" select="concat('simpleetableahhaa_benford',position(),'_',generate-id())"/>-->
+                                            </xsl:apply-templates>
+                                        </xsl:if>
+                                    </stentry>
+                                </strow>
+                                <!--<debug.1182.rum_umowy>
+                                            <xsl:copy-of select="$BI_audit_ENERGA_RUM_KONTRAHENCI_used//BI_audit_ENERGA_RUM_UMOWY[ lower-case(Osoba_merytoryczna___nazwisko_i_imie) = lower-case($Osoba)  ]"/>
+                                        </debug.1182.rum_umowy>-->
+                            </xsl:for-each>
+                        </simpletable>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <p>1. Raport nie zawiera informacji o umowach z uwagi (nie były dostępne takie dane wejściowe dla modułu raportu).</p>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
+            </body>
+        </topic>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 135 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_context.path.xsl

@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    
+    <xsl:template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs">
+        <xsl:param name="system_cache__dita:interested_row" required="yes"/>
+        <xsl:param name="context" required="yes"/>
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs" select="root()//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position()=last() and child::*[@fid=current()/@fid ]] ]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position()=1]/*[position()=1]/@fid"/><!-- *[ position()=1 and following-sibling::*[*[@fid = current()/@fid]] ] -->
+    </xsl:template>
+    
+    <xsl:template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.end.attrs">
+        <xsl:param name="system_cache__dita:interested_row" required="yes"/>
+        <xsl:param name="context" required="yes"/>
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.end.attrs" select="root()//*[ position()=last() and preceding-sibling::*[*[@fid = current()/@fid]] ]/@fid"/>
+    </xsl:template>
+    
+    <xsl:template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.row.attrs">
+        <xsl:param name="system_cache__dita:interested_row" required="yes"/>
+        <xsl:param name="context" required="yes"/>
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.row.attrs" select="root()//*[  child::*[child::*[@fid=current()/@fid]] ]/@fid"/>
+    </xsl:template>
+    
+    <xsl:template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs">
+        <xsl:param name="system_cache__dita:interested_row" required="yes"/>
+        <xsl:param name="context" required="yes"/>
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs" select="root()//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[@fid=current()/@fid]/descendant::BI_audit_ENERGA_RUM_UMOWY/@fid"/>
+    </xsl:template>
+    
+    
+    <xsl:template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs">
+        <xsl:param name="system_cache__dita:interested_row" required="yes"/>
+        <xsl:param name="context" required="yes"/>
+        <!--<xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs" >
+            <xsl:for-each select="root()//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object [ position()=1 and @fid=current()/@fid  ] ]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position()=last()]/*[1]/descendant::BI_audit_ENERGA_RUM_UMOWY">
+                <xsl:value-of select="@fid"/><xsl:text> </xsl:text>
+            </xsl:for-each>
+        </xsl:attribute>-->
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs"  select="root()//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object [ position()=1 and *[position()=1 and @fid=current()/@fid ] ] ]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position()=last()]/*[1]/descendant::BI_audit_ENERGA_RUM_UMOWY/@fid"/><!--   -->
+            
+        
+    </xsl:template>
+    
+    
+    <xsl:template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset">
+        <xsl:param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs" required="yes"/>
+        <xsl:param name="system_cache__dita:interested_row"/>
+        <xsl:for-each select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs">
+            <default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs="{$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs}">
+                <xsl:for-each select="tokenize(current(),' ')">
+                    <xsl:apply-templates mode="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset" select="$system_cache__dita:interested_row//*[@fid = current()]"/>
+                </xsl:for-each>
+            </default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset>
+        </xsl:for-each>
+        
+    </xsl:template>
+    
+    <xsl:template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.unique">
+        <xsl:param name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs" required="yes"/>
+        <xsl:param name="system_cache__dita:interested_row"/>
+        <xsl:for-each select="$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs">
+            <default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs="{$default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs}">
+                    <xsl:variable name="tags">
+                        <tags>
+                            <xsl:for-each select="tokenize(current(),' ')">
+                                <tag><xsl:value-of select="."/></tag>
+                            </xsl:for-each>
+                        </tags>
+                    </xsl:variable>
+                    <xsl:for-each-group select="$tags//tag" group-by="text()" >
+                        <xsl:for-each select="$system_cache__dita:interested_row//*[@fid = current()]">
+                            <xsl:if test="position() = 1">
+                                <xsl:apply-templates mode="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset" select="." />
+                            </xsl:if>
+                        </xsl:for-each>
+                    </xsl:for-each-group>
+            </default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset>
+        </xsl:for-each>
+        
+    </xsl:template>
+    
+    
+    <xsl:template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.precedings.count">
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.precedings.count.all" select="count(preceding-sibling::*)+count(following-sibling::*)"/>
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.precedings.count.parent.all" select="parent::*/(count(preceding-sibling::*)+count(following-sibling::*))"/>
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.precedings.count.parent.preceding" select="parent::*/(count(preceding-sibling::*))"/>
+        <xsl:attribute name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.precedings.count.parent.following" select="parent::*/(count(following-sibling::*))"/>
+    </xsl:template>
+    
+    
+    <xsl:template mode="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset" match="*[*]">
+        <xsl:copy>
+            <xsl:copy-of select="@*"/>
+            <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset.precedings.count"/>
+            <xsl:apply-templates mode="#current"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template mode="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset" match="*[not(*) and not(@*)]"/>
+        
+    
+    
+    <xsl:template mode="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset" match="*[@* and not(*)]">
+        <xsl:copy>
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="#current"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template mode="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.attrs__x3A__to_nodeset" match="text()|comment()">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 82 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_middle_ref.xsl

@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template match="*" mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.middle_ref">
+        <xsl:param name="position_1" required="yes"/>
+        <xsl:param name="position" required="yes"/>
+        <xsl:param name="context" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <!-- uwaga lapie BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object -->
+        <xsl:message>#2599 MID REF $position_1 = <xsl:value-of select="$position_1"/>; $position=<xsl:value-of select="$position"/> ; @fid = <xsl:value-of select="@fid"/>; </xsl:message>
+        <xsl:comment>#278b pracownik od <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/@fid"/></xsl:comment>
+        <xsl:message>#278b pracowni INNEk od <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/@fid"/></xsl:message>
+        <xsl:comment>#278a  firma do <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/></xsl:comment>
+        <xsl:message>#278a  firma INNE do <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/></xsl:message>
+        <!--<curr_parrent2><xsl:copy-of select="current-group()/../../."></xsl:copy-of></curr_parrent2>-->
+        <xsl:variable name="group_name_refpos.begin" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1)"/>
+        <xsl:variable name="group_name_refpos.kon" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last() ]/*[ position() = 1]/ system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1)"/> <!-- X11 bylo @fid samo --> <!-- TODO tu jest blad dla ogolnych szukanych powiazan -->
+        <xsl:variable name="refpos" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/* [ position() = 1]/concat(name(),ID),'_', 1)"/>
+        <!--<draft-comment author="a.binder">#2584-XX1  </draft-comment>-->
+        <strow>
+            <stentry><xsl:value-of select="$position_1"/> / <!--<xsl:value-of select="$position"/> / --><xsl:value-of select="$position"/> </stentry>
+            <!--<stentry>-->
+            <!--<xsl:choose>
+            <xsl:when test="../../BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 2]/BI_audit_KRS_person/pesel[ //]"></xsl:when>
+            </xsl:choose>-->
+            <!--</stentry>-->
+            <stentry>
+                <xref > <!-- href="../{ system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/@fid ,BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/name(),BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/@fid,@pos))}" -->
+                    <xsl:copy-of select="system_cache__dita:files.dita_pair.keyref(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/@fid,BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[  last() ]/*[1]/@fid)" copy-namespaces="no"/>
+                    link
+                    <!--<xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[ position() = 1 ]/concat(imiona,' ',nazwisko,' (',source,')')"/>-->
+                    
+                </xref>
+                <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[  position()=1 ]/*[1]"/>
+                <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.middle_ref.note" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/*"/>
+                
+                
+                <!--<test>
+                    <xsl:copy-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]"></xsl:copy-of>
+                </test>-->
+            </stentry>
+            
+            <stentry>
+                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[last()]/*[1]/system_cache__dita:localname.translate(local-name())"/>
+                <xsl:text> </xsl:text>
+                <xref>
+                    <xsl:copy-of select="system_cache__dita:files.context.title.keyref(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/*[1],'BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA')" copy-namespaces="no"/>
+                    link
+                </xref>
+                <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ 1]"/>
+                
+            </stentry>
+        </strow>
+    </xsl:template>
+    
+    <xsl:template match="text()|comment()" mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.middle_ref">
+        <xsl:message>#2362 fixed text leackage</xsl:message>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 171 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_operational_raport_note.xsl

@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:template name="system_cache__dita:BI_audit_operational_raport_note_uniq">
+        <xsl:param name="sources" required="yes"/>
+        <xsl:param name="BI_audit_operational_raport_note_fixed" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
+        <BI_audit_operational_raport_note_uniq>
+            <xsl:for-each select="$sources/sources/source">
+                <xsl:variable name="source" select="."/>
+                <xsl:for-each-group select="$BI_audit_operational_raport_note_fixed//element[@source=$source]" group-by="@key">
+                    <element>
+                        <xsl:attribute name="key" select="@key"/>
+                        <xsl:attribute name="fid" select="@fid"/>
+                        <xsl:attribute name="source" select="$source"/>
+                    </element>
+                </xsl:for-each-group>
+            </xsl:for-each>
+        </BI_audit_operational_raport_note_uniq>
+    </xsl:template>
+    
+    
+    <xsl:template name="system_cache__dita:BI_audit_operational_raport_note">
+        <xsl:param name="sources" required="yes"/>
+        <xsl:param name="interested_row" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
+        <topichead navtitle="Wykryte powiązania do śledzonych obiektów w ramach Operacyjnej Bazy Danych (podział na źródła)" props="BI_audit_operational_raport_note_fixed">
+            
+            <xsl:variable name="BI_audit_operational_raport_note_fixed">
+                <BI_audit_operational_raport_note_fixed>
+                    <xsl:for-each select="$sources/sources/source">
+                        <xsl:variable name="source" select="."/>
+                        <xsl:for-each select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1]/source=current() or not(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1]/source)]//BI_audit_operational_raport_note" >
+                            <element>
+                                <xsl:attribute name="key" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.ID.key(ID),'','','1')"/> <!--X11 system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(ID) -->
+                                <xsl:attribute name="fid" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.ID.key(ID)"/>
+                                <xsl:attribute name="source" select="$source"/>
+                            </element>
+                        </xsl:for-each>
+                    </xsl:for-each>
+                </BI_audit_operational_raport_note_fixed>
+            </xsl:variable>
+            
+            <xsl:result-document href="{$temp}/{$uuid}/BI_audit_operational_raport_note_fixed.OPER.xml">
+                <xsl:copy-of select="$BI_audit_operational_raport_note_fixed"/>
+            </xsl:result-document>
+            
+            <xsl:variable name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.star" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed($interested_row,$sources,'*')"/>
+            <xsl:result-document href="{$temp}/{$uuid}/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.star.xml">
+                <xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed($interested_row,$sources,'*')"/>
+            </xsl:result-document>
+            
+            <xsl:result-document href="{$temp}/{$uuid}/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.star.xml">
+                <xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed.star,$sources)"/>
+            </xsl:result-document>
+            
+            
+            <xsl:variable name="BI_audit_operational_raport_note_uniq">
+                <xsl:call-template name="system_cache__dita:BI_audit_operational_raport_note_uniq">
+                    <xsl:with-param name="BI_audit_operational_raport_note_fixed" select="$BI_audit_operational_raport_note_fixed"/>
+                    <xsl:with-param name="sources" select="$sources"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
+                </xsl:call-template>
+            </xsl:variable>
+            
+            <xsl:result-document href="{$temp}/{$uuid}/BI_audit_operational_raport_note_uniq.OPER.xml">
+                <xsl:copy-of select="$BI_audit_operational_raport_note_uniq"/>
+            </xsl:result-document>
+            
+            <xsl:for-each select="$sources/sources/source">
+                <xsl:variable name="source" select="."/>
+                <xsl:message>#719 Powiązania do BI_audit_operational_raport_note (podział na źródła) = <xsl:value-of select="."/>;count_lite=<xsl:value-of select="count($interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/*[1]//BI_audit_operational_raport_note)"/> ; count = <xsl:value-of select="count($interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1]/source= $source or not(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1]/source= $source)
+                    and system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.ID.key(ID),'','','1') = current()/@key
+                    ]//BI_audit_operational_raport_note)"/></xsl:message>
+                <topichead navtitle="zrodlo:{.}  Powiązania do śledzonych obiektów">
+                    <xsl:for-each select="$BI_audit_operational_raport_note_uniq//element[@source=$source]">  
+                        <xsl:message>#1731__- $souce <xsl:copy-of select="$source/@*" copy-namespaces="no"/> ; key = <xsl:value-of select="@key"/> ; test_lite=<xsl:value-of select="count($interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1]/source= $source or not(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1]/source= $source)]) "/>
+                            down 
+                        </xsl:message>
+                        <xsl:for-each-group select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[  position() = 1  and ( source= $source or not(source) ) ]]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[  position() = 1 ]//BI_audit_operational_raport_note[   system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.ID.key(ID),'','','1') = current()/@key ]"  group-by="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.ID.key(ID),'','','1')"> <!--X11 system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(ID)  --> <!-- X11 group system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'') -->
+                            
+                            <xsl:variable name="group_name" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.ID.key(ID),'','',position(),$source)"/> <!-- X11 system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(ID) -->
+                            <!--<topichead navtitle="{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last()]/*/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc,' ',NIP)} powiązań ({ count( current-group())}) ">-->
+                            
+                            <!--<xsl:choose>
+                                        <xsl:when test="//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_old/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI/ID=$BI_audit_ENERGA_RUM_KONTRAHENCI.ID">-->
+                            <xsl:message>#733  ID=<xsl:value-of select="ID"/>;  (count/current-group=<xsl:value-of select="count(.)"/>); counting check=<xsl:value-of select="count($BI_audit_operational_raport_note_fixed//element[@key = $group_name]) &gt; 1"/>; ile notes dla $group_name=<xsl:value-of select="$group_name"/> ;; <xsl:value-of select="count($BI_audit_operational_raport_note_fixed//element[@key = $group_name])"/></xsl:message>
+                            <xsl:choose> <!-- testowanie czy jest w roznych zrodlach ten sam pesel -->
+                                <xsl:when test="count($BI_audit_operational_raport_note_fixed//element[@key = $group_name]) &gt; 1">
+                                    <!-- pierwszy vs obecny _row powiazania z danym PESEL-->
+                                    <xsl:variable name="min" select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object//BI_audit_operational_raport_note[ system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.ID.key(ID),'','','1') = $group_name ]][1]/@pos"/> <!--X11 system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_operational_raport_note.key(ID) -->
+                                    <xsl:variable name="curr" select="../../.././@pos"/>
+                                    <xsl:message>#740 pozycja  $min = <xsl:value-of select="$min"/> ; (..../@pos)curr = <xsl:value-of select="$curr"/> $group_name = <xsl:value-of select="$group_name"/> ; position()=<xsl:value-of select="position()"/> </xsl:message>
+                                    <xsl:choose>
+                                        <xsl:when test="$curr = $min and position() = 1">
+                                            <xsl:message>#742 - generating first occurence of <xsl:value-of select="$group_name"/></xsl:message>
+                                            <xsl:comment>#744 pos <xsl:value-of select="$curr"/></xsl:comment>
+                                            <!--<xsl:copy-of select="../../."/>-->
+                                            
+                                            <xsl:variable name="refpos" select="concat($group_name,'_', position())"/>
+                                            
+                                            <xsl:apply-templates mode="BI_audit_operational_raport_note" select="." >
+                                                <xsl:with-param name="group_name" select="$group_name"/>
+                                                <xsl:with-param name="refpos" select="$refpos"/>
+                                                <xsl:with-param name="position" select="position()"/>
+                                            </xsl:apply-templates>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                            <xsl:variable name="refpos" select="concat($group_name,'_', position())"/>
+                                            <topicref href="{system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href($group_name)}">
+                                                <xsl:attribute name="props">
+                                                    <xsl:choose>
+                                                        <xsl:when test="position()=1">pos__first</xsl:when>
+                                                        <xsl:when test="position()=last()">pos__last</xsl:when>
+                                                        <xsl:otherwise>pos__else</xsl:otherwise>
+                                                    </xsl:choose>
+                                                    <xsl:text> mode__cust_fe1626</xsl:text>
+                                                </xsl:attribute>
+                                            </topicref>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:message>#522 otherwise</xsl:message>
+                                    <xsl:variable name="refpos" select="concat($group_name,'_', position())"/>
+                                    <xsl:apply-templates mode="BI_audit_operational_raport_note" select="." >
+                                        <xsl:with-param name="group_name" select="$group_name"/>
+                                        <xsl:with-param name="refpos" select="$refpos"/>
+                                        <xsl:with-param name="position" select="position()"/>
+                                    </xsl:apply-templates>
+                                </xsl:otherwise>
+                            </xsl:choose> 
+                        </xsl:for-each-group>
+                    </xsl:for-each>
+                </topichead>
+            </xsl:for-each>
+        </topichead>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 143 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person.xsl

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person" match="text()|comment()">
+        <xsl:message>#2128 fixed text leackage</xsl:message>
+    </xsl:template>
+    
+    <xsl:template match="BI_audit_KRS_person|BI_audit_MSIG_person|BI_audit_MSIG|BI_audit_KRS|TERYT_adresy|BI_audit_MSIG_adress|BI_audit_KRS_company|BI_audit_MSIG_company" mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person">
+        <xsl:param name="group_name" required="yes"/>
+        <xsl:param name="position" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <xsl:variable name="refpos" select="concat($group_name,'_', position())"/>
+        <xsl:variable name="context" select="."/>
+        <topicref > <!-- XX7 {system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position))} --> <!-- {$group_name}/{$refpos}.dita --> <!-- {system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,parent::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[position() =  last()]/*[1]/local-name(),parent::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[position() =  last()]/*[1]/@fid,$position)}.dita -->
+            <xsl:attribute name="print" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person.print"/>
+            <xsl:attribute name="props">
+                <xsl:value-of select="concat('print_',$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person.print)"/>
+                <xsl:choose>
+                    <xsl:when test="position()=1"> pos__first </xsl:when>
+                    <xsl:when test="position()=last()"> pos__last </xsl:when>
+                    <xsl:otherwise> pos__else</xsl:otherwise>
+                </xsl:choose>
+                <xsl:text> mode__BaERKPp</xsl:text>
+            </xsl:attribute>
+            <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
+            <xsl:copy-of select="system_cache__dita:files.context.title.keys(.,$title)" copy-namespaces="no"/>
+            <xsl:copy-of select="system_cache__dita:files.context.title.keydef(.,'map',$title)" copy-namespaces="no"/>
+            <!--<xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.dita.key.attr(.)"/>--> <!-- TODO X11 keyref -->
+            <!--XX7 <xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.dita.fid.keydef(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position)),@fid)"/>-->
+            <!--<xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.dita_pair.key.attr(concat(local-name(),'/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person',generate-id(),'.dita'),@fid,ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[1]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]/@fid)"/>-->
+            <!--<xsl:message>#690-X debug : result doc: <xsl:value-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[1]/local-name(),ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[1]/@fid,$position)"/> ;  parent::last/@fid= <xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[1]/@fid"/> $position=<xsl:value-of select="$position"/>; </xsl:message>-->
+            
+            <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}" ><!-- XX7 href="{system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position))}" --><!-- {$temp}/{$uuid}/{$group_name}/{$refpos}.dita --> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[1]/local-name(),ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[1]/@fid,$position) --><!-- {$temp}/{$uuid}/{$group_name}/{$refpos}.dita XXS -->
+                <topic id="{$uuid}topic_simpletable_person_{$group_name}_{position()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                    <xsl:variable name="count">
+                        <count>
+                            <!--<xsl:for-each-group select="current-group()/../../." group-by="concat(parent::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid , parent::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/@fid)">
+                                <row/>
+                            </xsl:for-each-group>-->
+                            <xsl:for-each-group select="root()//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1 and @fid = current()/@fid]" group-by="@fid">
+                                <row><xsl:value-of select="count(current-group())"/></row>
+                            </xsl:for-each-group>
+                        </count>
+                    </xsl:variable>
+                    <xsl:message>#2459 XX $count = <xsl:value-of select="$count//row/text()"/>; 
+                        current-group()/name=<xsl:value-of select="current-group()/local-name()[1]"/>;
+                        
+                        parent::@last/@fid=<xsl:value-of select="parent::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/> ;  
+                        parent::pos1/@fid=<xsl:value-of select="parent::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/@fid"/>;  parent::pos1/@fid=<xsl:value-of select="parent::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/@fid"/>; 
+                        -
+                        ancestor::[1]pos1/@fid=<xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[1]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/@fid"/>;  
+                        ancestor::[1]pos/last/@fid=<xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[1]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]/@fid"/>;
+                        -
+                        ancestor::last/@fid=<xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/>;  
+                        ancestor::pos1/@fid=<xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ 1]/*[1]/@fid"/>
+                        -
+                        preceding-sibling::last/@fid=<xsl:value-of select="parent::*/preceding-sibling::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/>;  
+                        folowing-sibling::pos/@fid=<xsl:value-of select="parent::*/following-sibling::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[1]/@fid"/>
+                        -
+                        current-group()/../../. (name)/@fid = <xsl:value-of select="current-group()/../.././@fid"/>
+                        
+                    </xsl:message>
+                    <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.title" select="parent::*">
+                        <xsl:with-param name="count" select="$count//row/text()"/>
+                    </xsl:apply-templates>
+                    
+                    <!--<curr><xsl:copy-of select="current-group()"></xsl:copy-of></curr>-->
+                    <!--<curr_parrent><xsl:copy-of select="current-group()/../../."></xsl:copy-of></curr_parrent>-->
+                    <!--<parent><xsl:copy-of select="../../."/></parent>-->
+                    <xsl:variable name="title_copy_to_middle_ref" select="."/>
+                    <body>
+                        
+                        <draft-comment author="a.binder">#698 - Tu jest blad dla szukania ogolnego  ($count = <xsl:value-of select="$count"/>;) - zaklada ze sa kontrahenci - trzeba zrobic funckje TODO. $context/@fid=<xsl:value-of select="$context/@fid"/>; "$title=<xsl:value-of select="$title"/>" , $context/parent::*/fid=<xsl:value-of select="$context/parent::*/@fid"/>; $context/ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid=<xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid"/>; </draft-comment>
+                        <!--<xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="."/>-->
+                        
+                        <xsl:variable name="current_group_person" select="current-group()/../../."/>
+                        
+                        <draft-comment author="a.binder">#2253 - testing  </draft-comment>                        
+                        
+                        <simpletable frame="all" relcolwidth="1* 3* 3*" id="{$uuid}simpletable_rows__child_person_{$group_name}_{$refpos}">
+                            <strow>
+                                <stentry>Lp</stentry>
+                                <!--<stentry>Uwagi!</stentry>-->
+                                <stentry> od</stentry>
+                                <!--<stentry> w</stentry>-->
+                                <stentry> do</stentry>
+                            </strow>                            
+                            <!--<debug.1444>
+                                <xsl:copy-of select="current-group()"/>
+                            </debug.1444>-->
+                            <!-- <xsl:for-each select="current-group()[ position() &lt; 10 ] ">-->
+                            <xsl:variable name="current_group_person" select="current-group()/../../."/>
+                            <!--<debug.current_group_person>
+                                <xsl:copy-of select="$current_group_person"></xsl:copy-of>
+                            </debug.current_group_person>-->
+                            <xsl:message>#2425 current-group()/../../.[ position() &lt; 10 ]  = <xsl:value-of select="count(current-group()/../../.[ position() &lt; 10 ]) "/></xsl:message>
+                            <xsl:for-each-group select="current-group()/../../.[ position() &lt; 10 ] " group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"><!-- firmy do -->
+                                <xsl:variable name="position_1" select="position()"/>    
+                                <xsl:variable name="firma_do_id" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/> <!-- X11 -->
+                                <xsl:comment>#278 $firma_do_id=<xsl:value-of select="$firma_do_id"/>; $position_1=<xsl:value-of select="$position_1"/>; do <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/></xsl:comment>
+                                <xsl:message>#278 $firma_do_id=<xsl:value-of select="$firma_do_id"/>; $position_1=<xsl:value-of select="$position_1"/>; do <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/@fid"/></xsl:message>
+                                <xsl:for-each-group select="$current_group_person[ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last()]/*[position()=1]/@fid = $firma_do_id  and position() &lt; 10 ] " group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  1]/*[ position() = 1]/@fid"> <!-- pracownicy --> <!-- X11 -->
+                                    <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.middle_ref" select=".">
+                                        <xsl:with-param name="position_1" select="$position_1"/>
+                                        <xsl:with-param name="position" select="position()"/>
+                                        <xsl:with-param name="context" select="$context"/>
+                                        <xsl:with-param name="title" select="$title"/>
+                                        
+                                    </xsl:apply-templates>
+                                </xsl:for-each-group>
+                            </xsl:for-each-group>
+                            <!--</xsl:for-each>-->
+                        </simpletable>
+                    </body>
+                </topic>
+            </xsl:result-document>
+        </topicref>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 625 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.xsl

@@ -0,0 +1,625 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" match="text()|comment()">
+        <xsl:message>#3189 fixed text leackage</xsl:message>
+    </xsl:template>
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row">
+        <!--<xsl:param name="group_name" required="yes"/>-->
+        <xsl:param name="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" required="yes"/>
+        <xsl:param name="limit_same_entry_side" select="'source'"/>
+        <xsl:param name="limit" select="10"/>
+        <xsl:param name="title" required="yes"/>
+        <xsl:variable name="position_src" select="position()"/>
+        
+        <!--INFO: group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*[ position() = 1]/@fid" -->
+        <xsl:for-each-group select="current-group()"  group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]/@fid"> <!-- group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() =  last()]/*[ position() = 1]/concat(name(),ID,imiona,nazwisko,pesel,nip,regon,krs)" -->
+            <xsl:for-each select="current-group()">
+            <xsl:sort select="count(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object)" order="ascending"/>
+            <xsl:variable name="position" select="position()"/>
+            <xsl:variable name="position_save" select="concat($position_src,'_',position())"/>
+            <!--<xsl:variable name="group_name_root" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_PRACOWNICY.root_key(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/ID)"/>-->
+            <!--<xsl:variable name="group_name" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_PRACOWNICY.key(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/ID,object[ position() =  last()]/*[position() = 1]/name(),object[ position() =  last()]/*[position() = 1]/ID,@pos)"/>--><!-- XX1 -->
+            <xsl:variable name="group_name" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/@fid,BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() =  last()]/*[position() = 1]/name(),BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() =  last()]/*[position() = 1]/@fid,@pos)"/>
+            <xsl:variable name="group_name.id" select=" replace($group_name,'/','_')"/>
+            <!--<xsl:for-each select="current-group()">-->
+            <xsl:message>#3257-X $group_name = <xsl:value-of select="$group_name"/>;  last= <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() =  last()]/*[position() = 1]/@fid"/>; </xsl:message>
+                <!-- TEST IF PREV -->
+                <!--<xsl:variable name="current_pesel" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last() ]/*[1]/@fid"/>-->
+                <!--<xsl:variable name="test_if_prev_worker">
+                    <xsl:for-each select= "BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[not(@fid = $current_pesel)]">
+                        <xsl:variable name="current_pesel_2" select="@fid"/>
+                        <!-\-testuje:<xsl:value-of select="$current_pesel_2"/>,-\->
+                        <xsl:for-each select="$BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA//BI_audit_ENERGA_PRACOWNICY[pesel/text()=$current_pesel_2][1]">
+                            <prev pesel="{pesel}">
+                                <xsl:value-of select="nazwisko"/>
+                            </prev>
+                        </xsl:for-each>
+                    </xsl:for-each>
+                </xsl:variable>-->
+                <!-- TEST IF PREV -->
+                <xsl:choose>
+                    <!--<xsl:when test="$test_if_prev_worker/prev">
+                        <xsl:comment>#1527 test prev was <xsl:value-of select="$test_if_prev_worker"/></xsl:comment>
+                    </xsl:when>-->
+                    <xsl:when test="1 = 2"></xsl:when>
+                    <xsl:otherwise>
+                        <!--<xsl:variable name="refpos" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/* [ position() = 1]/concat(name(),ID),'_', 1)"/>--> <!-- position() -->
+                        
+                        <xsl:variable name="group_name_refpos.kon" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last() ]/*[ position() = 1]/ system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_KONTRAHENCI.key(@fid,'','',1)"/> <!-- XX1system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_KONTRAHENCI.key(ID) -->
+                        <xsl:variable name="refpos.kon" select="1"/>
+                        <xsl:choose>
+                            <xsl:when test=" position() = 0 ">
+                                <topichead navtitle=" Pominięto więcej przykładów z uwagi na ilość"/>
+                                <xsl:attribute name="props">mode__POWIAZANIA_row</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test=" position() = 0 ">
+                                <xsl:variable name="current-save-file-id" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position_save))"/>
+                                <!--<xsl:for-each select="current-group()">-->
+                                
+                                    <xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.dita_pair.key.attr($current-save-file-id,@fid,BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/@fid)" copy-namespaces="no"/>
+                                
+                                <!-- concat($group_name,'.',generate-id(),'.dita'),@fid,BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/@fid) -->
+                                <!--</xsl:for-each>-->
+                                <!--<xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.dita.fid.keydef(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position_save)),system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',position()))"/>-->
+                                <xsl:copy-of select="system_cache__dita:files.context.title.keydef(.,'map',$title)" copy-namespaces="no"/>
+                                <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}"> <!-- {system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position_save))} --> <!-- {$temp}/{$uuid}/{$group_name}.{generate-id()}.dita --> <!-- TODO XX2 -->
+                                    <topic id="{$uuid}topic_simpletable_cheat_pos_{position()}_row_{$group_name}__{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                                        xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                                        <!--<xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.dita.fid.key.attr(@fid)"/>-->
+                                        <title>
+                                           <!-- <xsl:if test="$test_if_prev_worker/prev">
+                                                !! nadmiarowe wzajemne !!
+                                                <xsl:for-each-group select="$test_if_prev_worker/prev" group-by="@pesel"><xsl:text> </xsl:text> <xsl:value-of select="."/></xsl:for-each-group>
+                                            </xsl:if>-->
+                                            Powiązanie <xsl:value-of select="position()"/> /<xsl:value-of select="count( current-group())"/> dla  
+                                            <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/imiona"/><xsl:text> </xsl:text>
+                                            <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nazwisko"/><xsl:text> </xsl:text>
+                                            <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nip"/><xsl:text> </xsl:text>
+                                            <xsl:choose>
+                                                <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/source/text()">
+                                                    źródło:<xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/source"/><xsl:text> </xsl:text>         
+                                                </xsl:when>
+                                            </xsl:choose>
+                                           
+                                           do :<xsl:value-of select="system_cache__dita:localname.translate(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/local-name())"/><xsl:text> </xsl:text>  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,nazwa,nazwisko,' - ',Miejscowosc,imiona,imie,' ',NIP,' ',regon,' ',Nr_dzialki,firma,' ',Nr_KW,' ',Seller_person,pesel,miejscowosc)"/><xsl:text> </xsl:text>
+                                            <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/Seller_person"/><xsl:text> </xsl:text> poprzez: <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/relation_from"/>
+                                            (gł.szuk.: <xsl:value-of select="count(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object)"/>) ;
+                                        </title>
+                                        
+                                        <body>
+                                            <draft-comment author="a.binder">#1171</draft-comment>
+                                            <p>
+                                                Ścieżka śledzenia do 
+                                                <xsl:choose>
+                                                    <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KW_requested_person">
+                                                        
+                                                        działki:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                        
+                                                    </xsl:when>
+                                                    <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                                        <xref href="../{$group_name_refpos.kon}/{$group_name_refpos.kon}_{$refpos.kon}.dita">
+                                                            kontrahenta:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                        </xref>
+                                                    </xsl:when>
+                                                    <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS">
+                                                        <xsl:variable name="group_name" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/concat('KRSY_',krs)"/>
+                                                        <xref href="../{$group_name}/{$refpos.kon}.dita">
+                                                            KRS:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwa,' ',S_miejscowosc, ' ',nip)"/>
+                                                        </xref>
+                                                    </xsl:when>
+                                                    <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS_company">
+                                                        KRS (firma):  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwa,' ',S_miejscowosc, ' ',nip)"/>
+                                                    </xsl:when>
+                                                    <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS_person">
+                                                        <xref href="../{ system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key( nazwisko,imiona,pesel,'')}/{system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key( nazwisko,imiona,pesel,'')}_{$refpos.kon}.dita">
+                                                        KRS (osoba):  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwisko,' ',imiona, ' ',pesel)"/>
+                                                        </xref>
+                                                    </xsl:when>
+                                                    <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_CEIDG">
+                                                        CEIDG (osoba):  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwisko,' ',imie, ' ',firma,' ',nip,' ',miejscowosc)"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        
+                                                            Kontrahenta:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                        
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                                
+                                                <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.last.table" select="."/>
+                                                
+                                                
+                                                
+                                            </p>
+                                            <!--TODO to separate raport xlink <xsl:choose>
+                                    <xsl:when test="deal">
+                                        <p>
+                                            Podpisane umowy?
+                                            <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1*" id="{$uuid}simpletable_rows__child_cheat_5{$group_name}_{ $refpos}_{generate-id()}">
+                                                <strow>
+                                                    <stentry>Data utw. spr./ Tytul dokumentu</stentry>
+                                                    <stentry>Wprowadzajacy wniosek</stentry>
+                                                    <stentry>Kontrahent</stentry>
+                                                    <stentry>Akceptujacy merytorycznie</stentry>
+                                                    <stentry>Osoba merytoryczna</stentry>
+                                                    <stentry>Przedmiot umowy</stentry>
+                                                </strow>
+                                                <strow>
+                                                    <stentry>(dane dla poprz.rek.)</stentry>
+                                                    <stentry>Typ umowy</stentry>
+                                                    <stentry>Wartosc zlecenia zamowienia netto w PLN</stentry>
+                                                    <stentry>Wartosc zlecenia zamowienia netto w walucie</stentry>
+                                                    <stentry>Wartosc przedmiotu umowy netto w PLN</stentry>
+                                                    <stentry>Wartosc kosztowa przedmiotu umowy netto w walucie </stentry>
+                                                </strow>
+                                                <xsl:for-each select="deal">
+                                                    <xsl:sort select="Wartosc_przedmiotu_umowy_netto_w_PLN" order="descending"/>
+                                                    <xsl:choose>
+                                                        <xsl:when test=" position() &lt; 100">
+                                                            <strow>
+                                                                <stentry><xsl:value-of select="Data_utworzenia_sprawy"/> / 
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Tytul_dokumentu">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!-\-<xsl:value-of select="field[@name='Tytul_dokumentu']"/>-\-></stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Wprowadzajacy_wniosek___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Pelna_nazwa_kontrahenta">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Akceptujacy_merytorycznie___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Osoba_merytoryczna___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Przedmiot_umowy">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!-\-<xsl:value-of select="field[@name='Przedmiot_umowy']"/>-\-></stentry>
+                                                            </strow>
+                                                            <strow>
+                                                                <stentry>(dane dla poprz.rek.)</stentry>
+                                                                <stentry><xsl:value-of select="Typ_umowy__aktualny_"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_PLN"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_walucie"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie"/></stentry>
+                                                            </strow>
+                                                        </xsl:when>
+                                                        <xsl:when test="position() = 100">
+                                                            <strow>
+                                                                <stentry>Zestawienie zawiera więcej rekordów</stentry>
+                                                                <stentry>Pominięto z uwagi na wielkość raportu</stentry>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                            </strow>
+                                                        </xsl:when>
+                                                        <xsl:otherwise/>
+                                                    </xsl:choose>
+                                                </xsl:for-each>
+                                            </simpletable>
+                                        </p>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <p> Dane transakcji 
+                                            <simpletable frame="all" relcolwidth="1* 4*" id="{$uuid}simpletable_rows__child_cheat_9{$group_name}_{ $refpos}_{generate-id()}">
+                                                <strow>
+                                                    <stentry>Kolumna</stentry>
+                                                    <stentry>Wartosc</stentry>
+                                                </strow>
+                                                <xsl:for-each select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*">
+                                                    <strow>
+                                                        <stentry><xsl:value-of select="name()"/></stentry>
+                                                        <stentry><xsl:value-of select="."/></stentry>
+                                                    </strow>
+                                                </xsl:for-each>
+                                            </simpletable>
+                                        
+                                        </p>
+                                    </xsl:otherwise>
+                                </xsl:choose>-->
+                                            
+                                        </body>
+                                    </topic>
+                                </xsl:result-document>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:variable name="current-save-file-id" select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position_save))"/>
+                                
+                                <topicref > <!-- <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)"/> --> <!-- {$group_name}.dita XXS -->
+                                    <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
+                                    <xsl:attribute name="props">
+                                        <xsl:choose>
+                                            <xsl:when test="position()=1">pos_first</xsl:when>
+                                            <xsl:when test="position()=last()">pos_last</xsl:when>
+                                            <xsl:otherwise>pos_else</xsl:otherwise>
+                                        </xsl:choose>
+                                        <xsl:text> mode__POWIAZANIA_row_3624 </xsl:text>
+                                    </xsl:attribute>
+                                    <xsl:choose>
+                                        <xsl:when test="position() &gt; $limit">
+                                            <xsl:attribute name="processing-role">resource-only</xsl:attribute> 
+                                        </xsl:when>
+                                    </xsl:choose>
+                                    <!--<xsl:for-each select="current-group()">-->
+                                        <!--<xsl:copy-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.dita_pair.key.attr($current-save-file-id,system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[1]/*[1]/@fid,'','','1'),system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/*[1]/@fid,'','','1'))"/>--> <!-- concat($group_name,'.dita')XXf -->
+                                    <!--</xsl:for-each>-->
+                                    <xsl:copy-of select="system_cache__dita:files.context.title.keydef(.,'map',$title)" copy-namespaces="no"/>
+                                    <xsl:comment>#3369 system_cache__dita:files.href.dita_pair.title.keydef.attr </xsl:comment>
+                                    <xsl:copy-of select="system_cache__dita:files.dita_pair.context.title.keydef.attr(.,'map',$title,BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/@fid,BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]/@fid)" copy-namespaces="no"/>
+                                    
+                                    <!-- for middle-ref match for whole row  -->
+                                    <xsl:copy-of select="system_cache__dita:files.href.dita_pair.title.keydef.attr(system_cache__dita:files.key.href.write.topic.title.context(.,$title),ancestor-or-self::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid,ancestor-or-self::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid)" copy-namespaces="no"/>
+                                    
+                                    <xsl:message>#1762 writing <xsl:value-of select="$group_name"/> ; also href = <xsl:value-of select="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position_save))"/>; </xsl:message>
+                                    <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}"><!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position_save)) --><!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',$position_save)) --> <!-- {$temp}/{$uuid}/{$group_name}.dita -->
+                                        <topic id="{$uuid}topiaac_simpletable_cheat_OTHER_pos_{position()}_row_{$group_name.id}_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                                            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                                            <title    >
+                                                <!--<xsl:if test="$test_if_prev_worker/prev">
+                                                    !! nadmiarowe wzajemne !!
+                                                    <xsl:for-each-group select="$test_if_prev_worker/prev" group-by="@pesel"><xsl:text> </xsl:text> <xsl:value-of select="."/></xsl:for-each-group>
+                                                </xsl:if>-->
+                                                
+                                                
+                                                <menucascade>
+                                                    <uicontrol>Powiązanie</uicontrol>
+                                                    <uicontrol><varname>[ <xsl:value-of select="system_cache__dita:localname.translate(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/local-name())"/> ] <xsl:text> </xsl:text></varname></uicontrol>
+                                                    <uicontrol><varname>nr</varname></uicontrol>
+                                                    <uicontrol><xsl:value-of select="position()"/> /<xsl:value-of select="count( current-group())"/></uicontrol>
+                                                    <xsl:choose>
+                                                        <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/source/text()">
+                                                            <uicontrol><varname>źródło</varname></uicontrol>
+                                                            <uicontrol><varname><xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/source"/></varname></uicontrol>
+                                                                    
+                                                        </xsl:when>
+                                                    </xsl:choose>
+                                                    <uicontrol><varname>dla</varname></uicontrol>
+                                                    <uicontrol> <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/imiona"/><xsl:text> </xsl:text>
+                                                        <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nazwisko"/><xsl:text> </xsl:text>
+                                                        <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nip"/><xsl:text> </xsl:text>
+                                                        <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/Pelna_nazwa_kontrahenta"/><xsl:text> </xsl:text>
+                                                        <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nazwa"/><xsl:text> </xsl:text></uicontrol>
+                                                    
+                                                </menucascade>
+                                                <menucascade>
+                                                    <uicontrol><varname>do</varname></uicontrol>
+                                                    <uicontrol>  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,nazwa,nazwisko,' - ',Miejscowosc,imiona,imie,' ',NIP,' ',regon,' ',Nr_dzialki,firma,' ',Nr_KW,' ',Seller_person,pesel,miejscowosc)"/><xsl:text> </xsl:text>
+                                                        <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/Seller_person"/><xsl:text> </xsl:text> 
+                                                    </uicontrol>
+                                                </menucascade>
+                                               
+                                                <menucascade>
+                                                    
+                                                    <uicontrol><varname>dlugosc</varname></uicontrol>
+                                                    <uicontrol><xsl:value-of select="count(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object)"/></uicontrol>
+                                                    <uicontrol><varname>przez</varname></uicontrol>
+                                                    <uicontrol><xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/system_cache__dita:localname.translate(relation_from)"/></uicontrol>
+                                                </menucascade>
+                                                
+                                            </title>
+                                            
+                                            <body>
+                                                <draft-comment author="a.binder">#1376a-1 $group_name=<xsl:value-of select="$group_name"/>; </draft-comment>
+                                                <!-- ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid=<xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid"/>; /n=<xsl:value-of select="ancestor::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/name()"/>;  current-group()/ancestor-or-self::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid=<xsl:value-of select="current-group()/ancestor-or-self::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid"/>;;;;  ancestor-or-self::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid=<xsl:value-of select="ancestor-or-self::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/@fid"/>; -->
+                                                <p>
+                                                    <!--<xsl:call-template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA.ends.desc.table">
+                                                        <xsl:with-param name="row_obj_first" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ 1]/*[1]"/>
+                                                        <xsl:with-param name="row_obj_last" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]"/>
+                                                        <!-\-<xsl:with-param name="context" select="$context"/>-\->
+                                                    </xsl:call-template>-->
+                                                    
+                                                    <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.last.title" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1 ]">
+                                                        <xsl:with-param name="title">Ścieżka śledzenia do </xsl:with-param>
+                                                    </xsl:apply-templates>
+                                                    <!--<xsl:choose>
+                                                        <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KW_requested">
+                                                            
+                                                            działki:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                            
+                                                        </xsl:when>
+                                                        
+                                                        <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS">
+                                                            <xsl:variable name="krs" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS/krs"/>
+                                                            <xref href="../{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1))}.dita"> <!-\- ../{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS.key(@fid,'','',1)}.dita -\-> <!-\- todo keys X11 -\->
+                                                                KRS.:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwa,' ',S_miejscowosc, ' ',nip)"/>
+                                                            </xref>
+                                                            
+                                                        </xsl:when>
+                                                        
+                                                        <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_MSIG">
+                                                            <xsl:variable name="krs" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_MSIG/krs"/>
+                                                            <xref href="../{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_MSIG/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1))}.dita"> <!-\- X11 ../MSIG_{$krs}/{$krs}_1.dita -\->
+                                                                MSIG:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwa,' ',S_miejscowosc, ' ',nip)"/>
+                                                            </xref>
+                                                            
+                                                        </xsl:when>
+                                                        
+                                                        <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS_company">
+                                                                <xsl:variable name="krs" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS_company/krs"/>
+                                                            <xref href="../{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS_company/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1))}.dita"> <!-\- X11../KRS_{$krs}/{$krs}_1.dita -\->
+                                                                    <!-\-KRS:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwa,' ',S_miejscowosc, ' ',nip)"/>-\->
+                                                                </xref>
+                                                               <!-\- KRS (firma):  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwa,' ',S_miejscowosc, ' ',nip)"/>-\->
+                                                        </xsl:when>
+                                                        
+                                                        <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_KRS_person">
+                                                            <xref href="../{ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_MSIG_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key( @fid,'','',$refpos.kon))}.dita"> <!-\- X11 ../{ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_MSIG_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key( @fid,'','',)}/{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_MSIG_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key( nazwisko,imiona,pesel,'')}_{$refpos.kon}.dita -\->
+                                                                KRS (osoba):  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwisko,' ',imiona, ' ',pesel)"/>
+                                                            </xref>
+                                                        </xsl:when>
+                                                        
+                                                        <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_MSIG_person">
+                                                            <xref href="../{ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_MSIG_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key( @fid,'','',$refpos.kon))}.dita"> <!-\- X11 -\->
+                                                                MSIG (osoba):  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwisko,' ',imiona, ' ',pesel)"/>
+                                                            </xref>
+                                                        </xsl:when>
+                                                        
+                                                        <xsl:when test="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/BI_audit_CEIDG">
+                                                            CEIDG (osoba):  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(nazwisko,' ',imie, ' ',firma,' ',nip,' ',miejscowosc)"/>
+                                                        </xsl:when>
+                                                        
+                                                        <xsl:otherwise>
+                                                            <xref href="../{$group_name_refpos.kon}/{$group_name_refpos.kon}_{$refpos.kon}.dita">
+                                                                kontrahenta:  <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[ position() = 1]/concat(Pelna_nazwa_kontrahenta,' ',Miejscowosc, ' ',NIP,' ',Nr_dzialki,' ',Nr_KW,' ',Seller_Person)"/>
+                                                            </xref>
+                                                            <draft-comment author="a.binder">#1376a-OTHERWISE <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*[1]/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_MSIG_person.key(@fid,'','',$refpos.kon))"/> ; $group_name = <xsl:value-of select="$group_name"/>;</draft-comment>
+                                                        </xsl:otherwise>
+                                                    </xsl:choose>-->
+<!--                                                    <draft-comment author="a.binder">#1411_debug obj:</draft-comment>
+                                                    <xsl:copy-of select="."/>-->
+                                                    
+                                                    <draft-comment author="a.binder">#1376a-2 $group_name=<xsl:value-of select="$group_name"/>; curr/@fid = <xsl:value-of select="@fid"/></draft-comment>
+                                                    
+                                                    <!--<DEBUG_3618>
+                                                        <xsl:copy-of select="."/>
+                                                    </DEBUG_3618>-->
+                                                    
+                                                    <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.last.table" select=".">
+                                                        <xsl:with-param name="title">Ścieżka śledzenia do </xsl:with-param>
+                                                    </xsl:apply-templates>
+                                                    
+                                                    
+                                                    <!--<simpletable frame="all" relcolwidth="1* 2* 2* 4*" id="{$uuid}simpletable_rows__child_cheat_7{$group_name.id}_path__{generate-id()}">
+                                                        <strow>
+                                                            <stentry>Lp</stentry>
+                                                            <stentry>Sposób wyszukania</stentry>
+                                                            <stentry>Rejestr</stentry>
+                                                            <stentry>Dane z rejestru</stentry>
+                                                        </strow>
+                                                        <xsl:for-each select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object">
+                                                            <strow>
+                                                                <stentry><xsl:value-of select="position()"/></stentry>
+                                                                <stentry>
+                                                                    <!-\-<xsl:apply-templates mode="enter_to_ph_text" select="relation_from">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>-\->
+                                                                    <xsl:choose>
+                                                                        <xsl:when test="relation_from/text()='BI_audit_ENERGA_PRACOWNICY'">Prac./Osoby</xsl:when>
+                                                                        <xsl:when test="relation_from/text()='BI_audit_ENERGA_RUM_KONTRAHENCI'">Kontrah.</xsl:when>
+                                                                        <xsl:when test="relation_from/text()='BI_audit_KRS_person'">KRS/o</xsl:when>
+                                                                        <xsl:when test="relation_from/text()='BI_audit_KRS'">KRS</xsl:when>
+                                                                        <xsl:when test="relation_from/text()='BI_audit_KRS_company'">KRS/f</xsl:when>
+                                                                        <xsl:when test="relation_from/text()='BI_audit_MSIG'">MSIG</xsl:when>
+                                                                        <xsl:when test="relation_from/text()='BI_audit_MSIG_person'">MSIG/o</xsl:when>
+                                                                        <xsl:when test="relation_from/text()='BI_audit_MSIG_company'">MSIG/f</xsl:when>
+                                                                        <xsl:otherwise>
+                                                                            <xsl:variable name="name">
+                                                                                <name><xsl:value-of select="replace(replace(relation_from/text(),'ENERGA',''),'BI_audit_','')"/></name>
+                                                                            </xsl:variable>
+                                                                            <xsl:apply-templates mode="enter_to_ph_text" select="$name/name">
+                                                                                <xsl:with-param name="element" select="'entry'"/>
+                                                                            </xsl:apply-templates>
+                                                                        </xsl:otherwise>
+                                                                    </xsl:choose>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:choose>
+                                                                        <xsl:when test="*/name()='BI_audit_ENERGA_PRACOWNICY'">Prac./Osoby</xsl:when>
+                                                                        <xsl:when test="*/name()='BI_audit_ENERGA_RUM_KONTRAHENCI'">Kontrah.</xsl:when>
+                                                                        <xsl:when test="*/name()='BI_audit_KRS_person'">KRS/o</xsl:when>
+                                                                        <xsl:when test="*/name()='BI_audit_KRS'">KRS</xsl:when>
+                                                                        <xsl:when test="*/name()='BI_audit_KRS_company'">KRS/f</xsl:when>
+                                                                        <xsl:when test="*/name()='BI_audit_MSIG'">MSIG</xsl:when>
+                                                                        <xsl:when test="*/name()='BI_audit_MSIG_person'">MSIG/o</xsl:when>
+                                                                        <xsl:when test="*/name()='BI_audit_MSIG_company'">MSIG/f</xsl:when>
+                                                                        <xsl:otherwise>
+                                                                            <xsl:variable name="name">
+                                                                                <name><xsl:value-of select="*/replace(replace(replace(name(),'ENERGA',''),'BI_audit_',''),'relation_from',' relacja od ')"/></name>
+                                                                            </xsl:variable>
+                                                                            <xsl:apply-templates mode="enter_to_ph_text" select="$name/name">
+                                                                                <xsl:with-param name="element" select="'entry'"/>
+                                                                            </xsl:apply-templates>
+                                                                        </xsl:otherwise>
+                                                                    </xsl:choose>
+                                                                    
+                                                                    <!-\-<xsl:value-of select="string(*/name())"/>-\->
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:choose>
+                                                                        <xsl:when test="BI_audit_KRS_person">
+                                                                            <!-\-<xref href="../{BI_audit_KRS_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'')}/{BI_audit_KRS_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'')}_1.dita"/>-\-><!-\- XX1 ? -\->
+                                                                            <xref href="../{BI_audit_KRS_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1))}"/> 
+                                                                        </xsl:when>
+                                                                        <xsl:when test="BI_audit_MSIG_person">
+                                                                            <!-\-<xref href="../{BI_audit_MSIG_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_MSIG_person.key(nazwisko,imiona,pesel,'')}/{BI_audit_MSIG_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_MSIG_person.key(nazwisko,imiona,pesel,'')}_1.dita"/>-\-><!-\- XX1 ? -\->
+                                                                            <xref href="../{BI_audit_MSIG_person/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1))}"/>
+                                                                        </xsl:when>
+                                                                        <xsl:when test="BI_audit_KRS">
+                                                                            <xref href="../{system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(BI_audit_KRS/@fid,'','',1))}"> <!-\- ../KRSY_{BI_audit_KRS/krs}/{BI_audit_KRS/krs}_1.dita -\->
+                                                                                <xsl:value-of select="BI_audit_KRS/nazwa"/><xsl:text> </xsl:text>
+                                                                                <xsl:value-of select="BI_audit_KRS/S_miejscowosc"/><xsl:text> </xsl:text>
+                                                                            </xref>
+                                                                        </xsl:when>
+                                                                        <xsl:when test="BI_audit_MSIG">
+                                                                            <xref href="../{BI_audit_MSIG/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1))}"> <!-\- XX1../{BI_audit_MSIG/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_MSIG.key(krs)}/{BI_audit_MSIG/krs}_1.dita -\->
+                                                                                <xsl:value-of select="BI_audit_MSIG/nazwa"/><xsl:text> </xsl:text>
+                                                                                <xsl:value-of select="BI_audit_MSIG/S_miejscowosc"/><xsl:text> </xsl:text>
+                                                                            </xref>
+                                                                        </xsl:when>
+                                                                        <xsl:otherwise>
+                                                                            <xsl:for-each select="*/*">
+                                                                                <xsl:if test="text() and not(name()='A_STATUS') and not(name()='A_ADM_COMPANY') and not(name()='A_CLASSIFIED') and not(name()='cached') and not(name()='TERYT_SYM') and not(name()='TERYT_SYM_UL') ">
+                                                                                    <b><xsl:value-of select="name()"/></b><xsl:text> </xsl:text>
+                                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="text()">
+                                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                                    </xsl:apply-templates>
+                                                                                    <xsl:text> </xsl:text>
+                                                                                </xsl:if>
+                                                                            </xsl:for-each>
+                                                                        </xsl:otherwise>
+                                                                    </xsl:choose>
+                                                                    <xsl:apply-templates mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.middle_ref.note" select="*/*">
+                                                                        <xsl:with-param name="group_name" select="$group_name"/>
+                                                                        <xsl:with-param name="group_name_refpos.kon" select="$group_name_refpos.kon"/>
+                                                                    </xsl:apply-templates>
+                                                                </stentry>
+                                                            </strow>
+                                                        </xsl:for-each>
+                                                    </simpletable>-->
+                                                    <xsl:choose>
+                                                        <xsl:when test="position() = $limit">
+                                                            <xsl:text>  </xsl:text> <b> UWAGA pominięto pozostałych <xsl:value-of select="count(current-group()) - position()"/> przykładów.</b> 
+                                                        </xsl:when>
+                                                    </xsl:choose>
+                                                </p>
+                                                <!--TODO to separate raport xlink <xsl:choose>
+                                    <xsl:when test="deal">
+                                        <p>
+                                            Podpisane umowy?
+                                            <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1*" id="{$uuid}simpletable_rows__child_cheat_5{$group_name}_{ $refpos}_{generate-id()}">
+                                                <strow>
+                                                    <stentry>Data utw. spr./ Tytul dokumentu</stentry>
+                                                    <stentry>Wprowadzajacy wniosek</stentry>
+                                                    <stentry>Kontrahent</stentry>
+                                                    <stentry>Akceptujacy merytorycznie</stentry>
+                                                    <stentry>Osoba merytoryczna</stentry>
+                                                    <stentry>Przedmiot umowy</stentry>
+                                                </strow>
+                                                <strow>
+                                                    <stentry>(dane dla poprz.rek.)</stentry>
+                                                    <stentry>Typ umowy</stentry>
+                                                    <stentry>Wartosc zlecenia zamowienia netto w PLN</stentry>
+                                                    <stentry>Wartosc zlecenia zamowienia netto w walucie</stentry>
+                                                    <stentry>Wartosc przedmiotu umowy netto w PLN</stentry>
+                                                    <stentry>Wartosc kosztowa przedmiotu umowy netto w walucie </stentry>
+                                                </strow>
+                                                <xsl:for-each select="deal">
+                                                    <xsl:sort select="Wartosc_przedmiotu_umowy_netto_w_PLN" order="descending"/>
+                                                    <xsl:choose>
+                                                        <xsl:when test=" position() &lt; 100">
+                                                            <strow>
+                                                                <stentry><xsl:value-of select="Data_utworzenia_sprawy"/> / 
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Tytul_dokumentu">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!-\-<xsl:value-of select="field[@name='Tytul_dokumentu']"/>-\-></stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Wprowadzajacy_wniosek___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Pelna_nazwa_kontrahenta">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Akceptujacy_merytorycznie___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:value-of select="Osoba_merytoryczna___nazwisko_i_imie"/>
+                                                                </stentry>
+                                                                <stentry>
+                                                                    <xsl:apply-templates mode="enter_to_ph_text" select="Przedmiot_umowy">
+                                                                        <xsl:with-param name="element" select="'entry'"/>
+                                                                    </xsl:apply-templates>
+                                                                    <!-\-<xsl:value-of select="field[@name='Przedmiot_umowy']"/>-\-></stentry>
+                                                            </strow>
+                                                            <strow>
+                                                                <stentry>(dane dla poprz.rek.)</stentry>
+                                                                <stentry><xsl:value-of select="Typ_umowy__aktualny_"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_PLN"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_zlecenia_zamowienia_netto_w_walucie"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_"/></stentry>
+                                                                <stentry><xsl:value-of select="Wartosc_kosztowa_przedmiotu_umowy_netto_w_walucie"/></stentry>
+                                                            </strow>
+                                                        </xsl:when>
+                                                        <xsl:when test="position() = 100">
+                                                            <strow>
+                                                                <stentry>Zestawienie zawiera więcej rekordów</stentry>
+                                                                <stentry>Pominięto z uwagi na wielkość raportu</stentry>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                                <stentry/>
+                                                            </strow>
+                                                        </xsl:when>
+                                                        <xsl:otherwise/>
+                                                    </xsl:choose>
+                                                </xsl:for-each>
+                                            </simpletable>
+                                        </p>
+                                    </xsl:when>
+                                    <xsl:otherwise>
+                                        <p> Dane transakcji 
+                                            <simpletable frame="all" relcolwidth="1* 4*" id="{$uuid}simpletable_rows__child_cheat_9{$group_name}_{ $refpos}_{generate-id()}">
+                                                <strow>
+                                                    <stentry>Kolumna</stentry>
+                                                    <stentry>Wartosc</stentry>
+                                                </strow>
+                                                <xsl:for-each select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/*">
+                                                    <strow>
+                                                        <stentry><xsl:value-of select="name()"/></stentry>
+                                                        <stentry><xsl:value-of select="."/></stentry>
+                                                    </strow>
+                                                </xsl:for-each>
+                                            </simpletable>
+                                        
+                                        </p>
+                                    </xsl:otherwise>
+                                </xsl:choose>-->
+                                                
+                                            </body>
+                                        </topic>
+                                    </xsl:result-document>
+                                </topicref>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:for-each>
+            <!--</xsl:for-each>-->
+        </xsl:for-each-group>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 273 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA.xsl

@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA" match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row">
+        
+        <xsl:param name="group_name" required="yes"/>
+        
+        <xsl:param name="position"  required="yes"/>
+        <xsl:param name="current-grouping-key" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <xsl:param name="context" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]"/> <!-- sometimes position=last() -->
+        <xsl:param name="system_cache__dita:bocian-graph-2-html.read.group" select="'src'"/>
+        <xsl:variable name="group_name.ref_prac" select="system_cache__appinfo:truncate_special_and_do_uppercase(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*[ position() = 1] /concat(imiona,'_',nazwisko,'_',nip))"/>
+        <xsl:variable name="refpos.ref_prac" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last()]/* [ position() = 1]/concat(name(),ID),'_', position())"/>
+        <xsl:message>#3405 awaria <xsl:value-of select="@fid"/> ; for $current-grouping-key=<xsl:value-of select="$current-grouping-key"/>; $position = <xsl:value-of select="$position"/>; $title=<xsl:value-of select="$title"/>; position()="<xsl:value-of select="position()"/>"; row_obj_fisrt/*/@f="<xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[1]/*[1]/@fid"/>"; row_obj_last/*/@f="<xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/*[1]/@fid"/>"; </xsl:message>
+        
+        <!--<xsl:variable name="group_name_refpos.kon" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last() ]/*[ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta)),'KONTR_DO')"/>-->
+        <xsl:variable name="group_name_refpos.kon" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last() ]/*[ position() = 1]/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'KONTR_DO','',position())"/><!-- XX1 sure -->
+        <xsl:variable name="refpos.kon" select="1"/>
+        <topicref toc="no"> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'',$current-grouping-key,$position)) --><!-- {$group_name}_LIST.dita -->
+            <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
+            <xsl:copy-of select="system_cache__dita:files.context.title.keys($context/*[1],$title)" copy-namespaces="no"/>
+            <xsl:if test="string-length($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.print.middle) &gt; 0 and not(position() = 1) and not(position() = last())">
+                <xsl:attribute name="print">
+                    <!-- <xsl:choose>
+                        <xsl:when test="not(position() = 1) and not(position() = last())">-->
+                    <xsl:value-of select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.print.middle"/>
+                    <!--</xsl:when>
+                    </xsl:choose>-->
+                </xsl:attribute>
+                <xsl:attribute name="props" select="concat('print_',$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.print.middle)"/>
+            </xsl:if>
+            <xsl:attribute name="props">
+                <xsl:choose>
+                    <xsl:when test="position()=1">pos__first</xsl:when>
+                    <xsl:when test="position()= last()">pos__last</xsl:when>
+                    <xsl:otherwise>pos__else</xsl:otherwise>
+                </xsl:choose>
+                <xsl:text> mode__row_LISTA</xsl:text>
+            </xsl:attribute>
+            <xsl:comment>#3063 system_cache__dita:files.href.context.title.keydef</xsl:comment>
+            <xsl:copy-of select="system_cache__dita:files.href.context.title.keydef(system_cache__dita:files.key.title.context.href(current(),'map',$title),BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[1]/*[1],'BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA')" copy-namespaces="no"/>
+            <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}"> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'',$current-grouping-key,$position)) --><!-- {$temp}/{$uuid}/{$group_name}_LIST.dita -->
+                <topic id="{$uuid}topic_simpletable_cheat_row_{replace($group_name,'/','')}_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                    <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.title" select="$context"/>
+                    <!--<title>Powiązań dla <xsl:value-of select="count( current-group())"/> dla  
+                                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/imiona"/><xsl:text> </xsl:text>
+                                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nazwisko"/><xsl:text> </xsl:text>
+                                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nip"/><xsl:text> </xsl:text>
+                                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nazwa"/><xsl:text> </xsl:text>
+                                żródło:<xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/source"/><xsl:text> </xsl:text>
+                                ;
+                            </title>-->
+                    
+                    <body><draft-comment author="a.binder">#2196 src/dst=<xsl:value-of select="$system_cache__dita:bocian-graph-2-html.read.group"/>; $context/fid=<xsl:value-of select="$context/@fid"/>; mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA" match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" </draft-comment>
+                        <p>
+                            
+                            <xsl:choose>
+                                <xsl:when test="$system_cache__dita:bocian-graph-2-html.read.group='src'">
+                                    <xsl:variable name="graph_data">
+                                        <BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA>
+                                            <xsl:attribute name="fid" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[1]/*[1]/@fid,'_',$system_cache__dita:bocian-graph-2-html.read.group)"/>
+                                            <xsl:copy-of select="current-group()" copy-namespaces="no"/>
+                                        </BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA>
+                                    </xsl:variable>
+                                    <xsl:comment>#2970-A obrazek dla danego kontrahenta - grupa <xsl:value-of select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[1]/*[1]/@fid,'_',$system_cache__dita:bocian-graph-2-html.read.group)"/></xsl:comment>
+                                    <xsl:apply-templates mode="system_cache__dita:bocian-graph-2-html.read" select="$graph_data">
+                                        <xsl:with-param name="fileindex" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[1]/*[1]/@fid,'_',$system_cache__dita:bocian-graph-2-html.read.group)"/>
+                                        <xsl:with-param name="map_or_indita" select="'topic'"/>
+                                        <xsl:with-param name="width" select="500"/>
+                                    </xsl:apply-templates>
+                                </xsl:when>
+                                <xsl:when test="$system_cache__dita:bocian-graph-2-html.read.group='dst'">
+                                    <xsl:variable name="graph_data">
+                                        <BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA>
+                                            <xsl:attribute name="fid" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/*[1]/@fid,'_',$system_cache__dita:bocian-graph-2-html.read.group)"/>
+                                            <xsl:copy-of select="current-group()" copy-namespaces="no"/>
+                                        </BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA>
+                                    </xsl:variable>
+                                    <xsl:comment>#2970-B obrazek dla danego kontrahenta - grupa <xsl:value-of select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/*[1]/@fid,'_',$system_cache__dita:bocian-graph-2-html.read.group)"/></xsl:comment>
+                                    <xsl:apply-templates mode="system_cache__dita:bocian-graph-2-html.read" select="$graph_data">
+                                        <xsl:with-param name="fileindex" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/*[1]/@fid,'_',$system_cache__dita:bocian-graph-2-html.read.group)"/>
+                                        <xsl:with-param name="map_or_indita" select="'topic'"/>
+                                        <xsl:with-param name="width" select="500"/>
+                                    </xsl:apply-templates>
+                                </xsl:when>
+                            </xsl:choose>
+                            
+                            
+                            
+                            
+                            <!--<xref> <!-\- ../{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1) }.dita -\-><!-\- XX1 sure -\->
+                                        <xsl:copy-of select="system_cache__dita:files.context.title.keyref(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1],'topic',$title)"></xsl:copy-of>
+                                        <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/concat(imiona,' ', nazwisko, ' ',nazwa,' ', nip)"/><!-\- XX1 sure -\->
+                                    </xref>-->
+                            
+                            <simpletable frame="all" relcolwidth="1* 1* 3* 3*" >
+                                <sthead>
+                                    <stentry>rejestr</stentry>
+                                    <stentry>ilosc</stentry>
+                                    <!--<stentry>od</stentry>-->
+                                    <stentry>od</stentry>
+                                    <stentry>do</stentry>
+                                </sthead>
+                                <xsl:for-each-group select="current-group()" group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/*[1]/local-name()">
+                                    <strow>
+                                        <stentry><xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]/system_cache__dita:localname.translate(local-name())"/></stentry>
+                                        <stentry><xsl:value-of select="count(current-group())"/></stentry>
+                                        <!--<stentry><xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[1]/*[1]/@fid"/></stentry>-->
+                                        
+                                        <stentry>
+                                            <xref>
+                                                <xsl:copy-of select="system_cache__dita:files.context.title.keyref(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ 1]/*[1],$title)" copy-namespaces="no"/>
+                                                link
+                                            </xref>
+                                            <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ 1]/*[1]"/>
+                                        </stentry>
+                                        <stentry>
+                                            <!--<xsl:value-of select="system_cache__dita:localname.translate(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]/local-name())"/>-->
+                                            <xref>
+                                                <xsl:copy-of select="system_cache__dita:files.dita_pair.keyref(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ 1]/*[1]/@fid,BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]/@fid)" copy-namespaces="no"/>
+                                                link
+                                            </xref>
+                                            <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]"/>
+                                        </stentry>
+                                    </strow>
+                                    
+                                </xsl:for-each-group>
+                            </simpletable>
+                            <!--<xsl:for-each-group select="current-group()" group-by="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/*[1]/local-name()">
+                                        <xsl:call-template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA.ends.desc.table">
+                                            <xsl:with-param name="row_obj_first" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ 1]/*[1]"/>
+                                            <xsl:with-param name="row_obj_last" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]"/>
+                                            <xsl:with-param name="context" select="$context"/>
+                                        </xsl:call-template>
+                                    </xsl:for-each-group>-->
+                        </p>
+                    </body>
+                </topic>
+            </xsl:result-document>
+        </topicref>
+    </xsl:template>
+    
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA" match="comment()|text()">
+        <xsl:message>#3100 fixed text leackage</xsl:message>
+    </xsl:template>
+   
+    <xsl:template mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA" match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object">
+        
+        <xsl:param name="group_name" required="yes"/>
+        
+        <xsl:param name="position"  required="yes"/>
+        <xsl:param name="current-grouping-key" required="yes"/>
+        <xsl:param name="title" required="yes"/>
+        <xsl:param name="context" select="."/> <!-- sometimes position=last() -->
+        
+        <xsl:message>#3471 awaria <xsl:value-of select="@fid"/> ; for $current-grouping-key=<xsl:value-of select="$current-grouping-key"/>; $position = <xsl:value-of select="$position"/>; $title=<xsl:value-of select="$title"/>; </xsl:message>
+        <!--<xsl:variable name="group_name_refpos.kon" select="concat(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = last() ]/*[ position() = 1]/system_cache__appinfo:truncate_special_and_do_uppercase(concat(ID,Pelna_nazwa_kontrahenta)),'KONTR_DO')"/>-->
+        
+        <topicref> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'',$current-grouping-key,$position)) --><!-- {$group_name}_LIST.dita -->
+            <xsl:copy-of select="system_cache__dita:files.key.title.context.href(current(),'map',$title)" copy-namespaces="no"/>
+            <xsl:copy-of select="system_cache__dita:files.context.title.keys($context/*[1],$title)" copy-namespaces="no"/>
+            <xsl:attribute name="toc" select="'no'"/>
+            <xsl:attribute name="props">
+                <xsl:choose>
+                    <xsl:when test="position() = 1 ">pos_first</xsl:when>
+                    <xsl:when test="position() = last()">pos_last</xsl:when>
+                    <xsl:otherwise>pos_else</xsl:otherwise>
+                </xsl:choose>
+                <xsl:text> mode__row_LISTA</xsl:text>
+            </xsl:attribute>
+            <xsl:choose>
+                <xsl:when test="not(position()=1) and not(position()=last()) and string-length($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.print.middle) &gt;0">
+                    <xsl:attribute name="print" select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.print.middle"/>
+                </xsl:when>
+            </xsl:choose>
+            
+            <xsl:comment>#3063_B system_cache__dita:files.href.context.title.keydef</xsl:comment>
+            <xsl:copy-of select="system_cache__dita:files.href.context.title.keydef(system_cache__dita:files.key.title.context.href(current(),'map',$title),*[1],'BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA')" copy-namespaces="no"/>
+            <xsl:result-document href="{system_cache__dita:files.key.href.write.topic.title.context(.,$title)}"> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.href.write(system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'',$current-grouping-key,$position)) --><!-- {$temp}/{$uuid}/{$group_name}_LIST.dita -->
+                <topic id="{$uuid}topic_simpletable_cheat_row_{replace($group_name,'/','')}_{ generate-id()}" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                    xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+                    <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.title" select="$context"/>
+                    <!--<title>Powiązań dla <xsl:value-of select="count( current-group())"/> dla  
+                                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/imiona"/><xsl:text> </xsl:text>
+                                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nazwisko"/><xsl:text> </xsl:text>
+                                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nip"/><xsl:text> </xsl:text>
+                                <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/nazwa"/><xsl:text> </xsl:text>
+                                żródło:<xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*/source"/><xsl:text> </xsl:text>
+                                ;
+                            </title>-->
+                    <body><draft-comment author="a.binder">#2196-B prec-sibl=<xsl:value-of select="preceding-sibling::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]/@fid"/>; mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA" match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" </draft-comment>
+                        <p>
+                            <!--<xref> <!-\- ../{BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.DETECT.key(@fid,'','',1) }.dita -\-><!-\- XX1 sure -\->
+                                        <xsl:copy-of select="system_cache__dita:files.context.title.keyref(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1],'topic',$title)"></xsl:copy-of>
+                                        <xsl:value-of select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]/concat(imiona,' ', nazwisko, ' ',nazwa,' ', nip)"/><!-\- XX1 sure -\->
+                                    </xref>-->
+                            <!--<xsl:call-template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA.ends.desc.table">
+                                <xsl:with-param name="row_obj_first" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ 1]/*[1]"/>
+                                <xsl:with-param name="row_obj_last" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]"/>
+                                <xsl:with-param name="context" select="$context"/>
+                            </xsl:call-template>-->
+                            <!--<xsl:call-template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA.ends.desc.table">
+                                <xsl:with-param name="row_obj_first" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ 1]/*[1]"/>
+                                <xsl:with-param name="row_obj_last" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ last()]/*[1]"/>
+                                <!-\-<xsl:with-param name="context" select="$context"/>-\->
+                            </xsl:call-template>-->
+                            <simpletable frame="all" relcolwidth="1* 1*" >
+                                <sthead>
+                                    <!--<stentry>rejestr</stentry>-->
+                                    <!--<stentry>ilosc</stentry>-->
+                                    <!--<stentry>od</stentry>-->
+                                    <stentry>od</stentry>
+                                    <!--<stentry>ilosc</stentry>-->
+                                    <stentry>do</stentry>
+                                </sthead>
+                                <strow>
+                                    <stentry>
+                                        <xsl:for-each-group select="preceding-sibling::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]" group-by="@fid">
+                                            <xsl:text> </xsl:text><xsl:value-of select="*[1]/system_cache__dita:localname.translate(local-name())"/>
+                                            <xsl:text> </xsl:text> <xsl:value-of select="count(current-group())"/><xsl:text> </xsl:text>
+                                            <xref>
+                                                <xsl:copy-of select="system_cache__dita:files.context.title.keyref(*[1],$title)" copy-namespaces="no"/>
+                                                link
+                                            </xref>
+                                            <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="*[1]"/>
+                                        </xsl:for-each-group>
+                                    </stentry>
+                                    <stentry>
+                                        <xsl:for-each-group select="following-sibling::BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[last()]" group-by="@fid">
+                                            <xsl:text> </xsl:text><xsl:value-of select="*[1]/system_cache__dita:localname.translate(local-name())"/>
+                                            <xsl:text> </xsl:text> <xsl:value-of select="count(current-group())"/><xsl:text> </xsl:text>
+                                            <xref>
+                                                <xsl:copy-of select="system_cache__dita:files.context.title.keyref(*[1],$title)" copy-namespaces="no"/>
+                                                link
+                                            </xref>
+                                            <xsl:apply-templates mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.body" select="*[1]"/>
+                                        </xsl:for-each-group>
+                                    </stentry>
+                                    
+                                </strow>
+                                
+                            </simpletable>
+                        </p>
+                    </body>
+                </topic>
+            </xsl:result-document>
+        </topicref>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 208 - 0
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.xsl

@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" mode="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.dita">
+        <topic id="{$uuid}topic_simpletable_statystyka_pracownik.dita" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title>Statystyka powiązań    
+                
+            </title>
+            <xsl:comment>#972 </xsl:comment>
+            <body>
+                
+                
+                
+                <xsl:variable name="simpletable"> 
+                    <simpletable frame="all" id="{$uuid}topic_simpletable_statystyka_pracownik.dita_table" props="print__no nograph">
+                        <strow>
+                            <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('skala 0')"/></stentry>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]" group-by="@fid">
+                                <stentry>
+                                    
+                                    <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat('[',ID,'] ',imiona,' ',nazwisko,' ', nazwa, Pelna_nazwa_kontrahenta ))"/>
+                                    
+                                    <!--<xsl:value-of select="ID"/>-->
+                                </stentry>
+                            </xsl:for-each-group>
+                            <!--<stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat('skala ',$avg.scale_max))"/></stentry>-->
+                        </strow>
+                        <strow>
+                            <stentry>0</stentry>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]" group-by="@fid">
+                                <xsl:variable name="pracownik" select="ID"/>
+                                <stentry><xsl:value-of select=" count( current-group() )"/></stentry>
+                            </xsl:for-each-group>
+                            <!--<stentry><xsl:value-of select="$avg.scale_max"/></stentry>-->
+                        </strow>
+                    </simpletable>
+                </xsl:variable>
+                <xsl:choose>
+                    <xsl:when test="$simpletable//stentry">
+                        <p> Ilości powiązań </p>
+                        <foreign>
+                            <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
+                        </foreign>
+                        <p>   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                            <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                            <xsl:with-param name="width" select="500"/>
+                        </xsl:apply-templates>
+                        </p>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <p>
+                            Uwaga - raport nie zawiera informacji o powiązaniach. Wybierz inne kryteria wyszukiwania.
+                        </p>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
+                
+                
+                <xsl:variable name="current" select="."/>
+                
+                <xsl:comment>#1016 </xsl:comment>
+                
+                <!--<xsl:variable name="avg">
+                    <stentry><xsl:value-of select=" round(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/count(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object))"/></stentry>
+                </xsl:variable>-->
+                
+                <xsl:variable name="simpletable"> 
+                    <simpletable frame="all" id="{$uuid}topic_simpletable_statystyka_pracownik.dita_table_srednie" props="print__no nograph">
+                        <strow>
+                            <stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names('skala 0')"/></stentry>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]" group-by="@fid">
+                                <stentry>
+                                    <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat('[',ID,'] ',imiona,' ',nazwisko,' ', nazwa, Pelna_nazwa_kontrahenta ))"/>
+                                </stentry>
+                            </xsl:for-each-group>
+                            <!--<stentry><xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat('skala ',$avg.scale_max))"/></stentry>-->
+                        </strow>
+                        <strow>
+                            <stentry>0</stentry>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]" group-by="@fid">
+                                <xsl:variable name="pracownik" select="@fid"/>
+                                <stentry><xsl:value-of select=" round(count( $current/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[*[1]/@fid=$pracownik][ position() = 1]]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object) div count( current-group() ) )"/></stentry>
+                            </xsl:for-each-group>
+                            <!--<stentry><xsl:value-of select="$avg.scale_max"/></stentry>-->
+                        </strow>
+                    </simpletable>
+                </xsl:variable>
+                
+                <xsl:choose>
+                    <xsl:when test="$simpletable//stentry">
+                        <p>Średnie długości powiązań</p>
+                        <!--<xsl:value-of select="count( $current/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY/ID=$PROCES_INIT_tree.ditamap]/object)"/>-->
+                        <foreign>
+                            <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
+                        </foreign>
+                        <p>   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                            <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                            <xsl:with-param name="width" select="500"/>
+                        </xsl:apply-templates>
+                        </p>
+                    </xsl:when>
+                    <xsl:otherwise/>
+                </xsl:choose>
+                
+                
+                
+                
+                <xsl:variable name="simpletable"> 
+                    <simpletable frame="all" id="{$uuid}topic_simpletable_statystyka_pracownik.dita_table_kwoty" props="nograph">
+                        <strow>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                                <stentry>
+                                    <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat(ID,' ',imiona,' ',nazwisko,' ', substring(nazwa,1,10), substring(Pelna_nazwa_kontrahenta,1,10) ))"/>
+                                    
+                                </stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                        <strow>
+                            <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/BI_audit_ENERGA_PRACOWNICY" group-by="ID">
+                                <xsl:variable name="pracownik" select="ID"/>
+                                <xsl:variable name="transakcje">
+                                    <transakcje>
+                                        <xsl:for-each select="$current/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[ BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/BI_audit_ENERGA_PRACOWNICY/ID=$pracownik]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last() ]/BI_audit_ENERGA_RUM_KONTRAHENCI">
+                                            
+                                            <xsl:variable name="kontrach" select="ID"/>
+                                            <!--(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) )-->
+                                            <!--(xs:double(sum(current-group()/field[@name='Wartosc_zlecenia_zamowienia_netto_w_PLN__aktualna_'][ string(replace(text(),',','.')) != 'NaN']/number(replace(text(),',','.')) ) )-->
+                                            <!-- sum( $current/BI_audit_ENERGA_RUM_KONTRAHENCI[ID=$kontrach]/BI_audit_ENERGA_RUM_UMOWY/Wartosc_przedmiotu_umowy_netto_w_PLN__aktualna_) -->
+                                            <sum kontrach="{$kontrach}"><xsl:value-of select="xs:double(sum( $current/BI_audit_ENERGA_RUM_KONTRAHENCI[ID=$kontrach]/BI_audit_ENERGA_RUM_UMOWY/number(replace(Wartosc,',','.'))))"/></sum>
+                                        </xsl:for-each>
+                                    </transakcje>
+                                </xsl:variable>
+                                <!--<debug.transakcje>
+                                    <xsl:copy-of select="$transakcje"/>
+                                </debug.transakcje>-->
+                                <stentry><xsl:value-of select=" format-number(xs:double(sum($transakcje/transakcje/sum[ not(text()='NaN')]) div 1000000),'####')"/></stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                    </simpletable>
+                </xsl:variable>
+                <xsl:choose>
+                    <xsl:when test="number($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_ENERGA_RUM_UMOWY.DISABLE)&gt;0"/>
+                    <xsl:when test="not($current//BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_UMOWY/Wartosc/text())"/>
+                    <xsl:when test="$simpletable//stentry">
+                        <p>Kwoty transakcji <note>w mln PLN</note></p>
+                        <foreign>
+                        <xsl:copy-of select="$simpletable"/>
+                        </foreign>
+                        <p>   <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
+                            <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
+                            <xsl:with-param name="width" select="500"/>
+                        </xsl:apply-templates>
+                        </p>
+                    </xsl:when>
+                </xsl:choose>
+                
+            </body>
+        </topic>
+        
+    </xsl:template>
+    
+    <xsl:template mode="bocian-graph-2-html.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.dita" match="comment()|text()">
+        <xsl:message>#1626 fixed text leack </xsl:message>
+    </xsl:template>
+    
+    
+    <xsl:template match="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA" mode="bocian-graph-2-html.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.dita">
+        <topic id="{$uuid}bocian-graph-2-html.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.dita" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
+            <title>Graf powiązań    
+            </title>
+            <xsl:comment>#1373 </xsl:comment>
+            <body>
+                
+                <p>
+                    <xsl:apply-templates mode="system_cache__dita:bocian-graph-2-html.read" select=".">
+                        <xsl:with-param name="fileindex" select="@fid"/>
+                        <xsl:with-param name="width" select="500"/>
+                    </xsl:apply-templates>
+                </p>
+                
+            </body>
+        </topic>
+    </xsl:template>
+    
+</xsl:stylesheet>

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

@@ -0,0 +1,357 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:ogr="http://ogr.maptools.org/"
+    xmlns:Benford="https://pl.wikipedia.org/wiki/Rozkład_Benforda"
+    xmlns:default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    xmlns:default_db__x3A__BI_audit_VALIDATE="https://biuro.biall-net.pl/wfs/default_db/BI_audit_VALIDATE"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA="https://biuro.biall-net.pl/wfs/default_db/ENERGA_RUM_KONTRAHENCI_POWIAZANIA"
+    exclude-result-prefixes="xs "
+    version="2.0"><!-- system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot -->
+    
+    
+   
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:template name="system_cache__dita:sources">
+        <xsl:param name="resulset" required="yes"/>
+        <xsl:variable name="sources">
+            <sources>
+                <xsl:for-each-group select="$resulset/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = 1]/*[1]" group-adjacent="concat(source,'')">
+                    <source>
+                        <xsl:attribute name="source" select="source"/>
+                        <xsl:value-of select="source"/></source>
+                </xsl:for-each-group>
+            </sources>
+        </xsl:variable>
+        <xsl:variable name="sources">
+            <sources>
+                <xsl:for-each-group select="$sources//source" group-by="@source">
+                    <source>
+                        <xsl:copy-of select="@*"/>
+                        <xsl:value-of select="text()"/>
+                    </source>
+                </xsl:for-each-group>
+            </sources>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="number($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.sources.DISABLE) &gt; 0">
+                <sources>
+                    <source source=""></source>
+                </sources>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:copy-of select="$sources"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template name="system_cache__dita:interested_row">
+        <xsl:param name="KRS_own"/>
+        <xsl:param name="context" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes"/>
+        <interested_row>
+            <xsl:for-each select="$context/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row">
+                
+                <xsl:variable name="test">
+                    <test>
+                        <xsl:variable name="cur_krs" select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[ position() = last() ]/*[1]/(KRS|krs)"/>
+                        <xsl:if test="not($KRS_own//(KRS|krs)/text() = $cur_krs)"><OK/></xsl:if>
+                    </test>
+                </xsl:variable>
+                <xsl:choose>
+                    <xsl:when test="$test/test/OK">
+                        <xsl:message>#76 OKOK  trasa <xsl:value-of select="position()"/></xsl:message>
+                        <!--<xsl:copy-of select="."/>-->
+                        <xsl:element name="{name()}">
+                            <xsl:attribute name="pos" select="position()"/>
+                            <xsl:attribute name="generate-id" select="generate-id()"/>
+                            <xsl:copy-of select="@*" copy-namespaces="no"/>
+                            <xsl:attribute name="system_cache__dita:interested_row.path">
+                                <xsl:value-of select="descendant-or-self::*[position()=1]/@fid"/>
+                            </xsl:attribute>
+                            <xsl:attribute name="system_cache__dita:interested_row.path.generate-id">
+                                <xsl:value-of select="descendant-or-self::*[position()=1]/generate-id()"/>
+                            </xsl:attribute>
+                            <xsl:apply-templates mode="system_cache__dita:interested_row.id">
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes" select="$default_db__x3A__BI_audit_BENFORD:valueField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes" select="$default_db__x3A__BI_audit_BENFORD:groupField" />
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"  select="$default_db__x3A__BI_audit_BENFORD:timeField"/>
+                                <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:NameField" tunnel="yes"  select="$default_db__x3A__BI_audit_BENFORD:NameField"/>
+                            </xsl:apply-templates>
+                        </xsl:element>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:message>#76 unwanted trasa <xsl:value-of select="position()"/></xsl:message>
+                        <xsl:comment>#76 unwanted trasa <xsl:value-of select="position()"/></xsl:comment>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:for-each>
+        </interested_row>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__dita:interested_row.id" match="*">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"  required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes" required="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes" required="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes" required="yes" />
+        <xsl:copy>
+            <xsl:attribute name="generate-id" select="generate-id()"/>
+        <xsl:attribute name="system_cache__dita:interested_row.path">
+            <xsl:value-of select="descendant-or-self::*[position()=1]/@fid"/>
+        </xsl:attribute>
+        <xsl:attribute name="system_cache__dita:interested_row.path.generate-id">
+            <xsl:value-of select="descendant-or-self::*[position()=1]/generate-id()"/>
+        </xsl:attribute>
+        <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:generate.leadingNumber"/>
+            <xsl:apply-templates mode="#current"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__dita:interested_row.id" match="*[not(*)]">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes" />
+        <xsl:copy>
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:generate.leadingNumber" select="."/>
+            <xsl:apply-templates mode="#current"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    
+    <xsl:template mode="system_cache__dita:interested_row.id" match="BI_audit_ENERGA_RUM_KONTRAHENCI[not(BI_audit_ENERGA_RUM_UMOWY)]">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes" />
+                <xsl:copy>
+                    <xsl:copy-of select="@*"/>
+                    <xsl:attribute name="generate-id" select="generate-id()"/>
+                    <xsl:apply-templates mode="default_db__x3A__BI_audit_BENFORD:generate.leadingNumber" select="root()//BI_audit_ENERGA_RUM_KONTRAHENCI[ @fid=current()/@fid and BI_audit_ENERGA_RUM_UMOWY]/*"/>
+                    <xsl:apply-templates mode="#current"/>
+                    <xsl:apply-templates mode="system_cache__dita:interested_row.id" select="root()//BI_audit_ENERGA_RUM_KONTRAHENCI[ @fid=current()/@fid and BI_audit_ENERGA_RUM_UMOWY]/*[not(local-name()='ID')]"/>
+                </xsl:copy>
+    </xsl:template>
+    
+    
+    
+    <xsl:template mode="system_cache__dita:interested_row.id" match="text()|comment()">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed">
+        <!-- to generate variable current-group with params to once hit ROW_OBJECT or ROW -->
+        <xsl:param name="interested_row" required="yes"/>
+        <xsl:param name="sources"/>
+        <xsl:param name="element"/>
+        <xsl:param name="system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.path"/><!-- to group  paths -->
+        <xsl:param name="system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_UMOWY.path"/><!-- todo do analiz umow -->
+        <!--<xsl:param name="system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.begin"/>--><!-- to group starting paths -->
+        <!--<xsl:param name="system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object.end"/>--><!-- to group ending paths -->
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField" required="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField" required="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField" required="yes" />
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField" required="yes" />
+        <system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed>
+            <xsl:for-each select="$sources/sources/source">
+                <xsl:variable name="source" select="."/>
+                <xsl:choose>
+                    <xsl:when test="$system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_UMOWY.path">
+                        <xsl:message>#112 called $system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_UMOWY.path</xsl:message>
+                        <xsl:for-each select="$interested_row//BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position()=last() or position()=1]/*[1]" >
+                            <fixed debug="112">
+                                <xsl:attribute name="key" select="system_cache__dita:files.key.DETECT(@fid,'','','')"/> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'') XX11 -->
+                                <xsl:attribute name="fid" select="@fid"/>
+                                <xsl:attribute name="source" select="$source"/>
+                                <xsl:attribute name="name" select="name()"/>
+                                <xsl:attribute name="generate-id" select="@generate-id"/>
+                                <!--<xsl:copy-of select="@system_cache__dita:interested_row.path"/>
+                                <xsl:copy-of select="@system_cache__dita:interested_row.path.generate-id"/>-->
+                                <xsl:attribute name="system_cache__dita:interested_row.path">
+                                    <xsl:value-of select="descendant-or-self::*[position()=1]/@fid"/>
+                                </xsl:attribute>
+                                <xsl:attribute name="system_cache__dita:interested_row.path.generate-id">
+                                    <xsl:value-of select="descendant-or-self::*[position()=1]/@generate-id"/>
+                                </xsl:attribute>
+                                <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.begin.attrs">
+                                    <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                                    <xsl:with-param name="context" select="."/>
+                                </xsl:call-template>
+                                <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.end.attrs">
+                                    <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                                    <xsl:with-param name="context" select="."/>
+                                </xsl:call-template>
+                                <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.row.attrs">
+                                    <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                                    <xsl:with-param name="context" select="."/>
+                                </xsl:call-template>
+                                
+                                <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.childs.attrs">
+                                    <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                                    <xsl:with-param name="context" select="."/>
+                                </xsl:call-template>
+                                
+                                <xsl:call-template name="default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA:context.path.related.childs.attrs">
+                                    <xsl:with-param name="system_cache__dita:interested_row" select="$interested_row"/>
+                                    <xsl:with-param name="context" select="."/>
+                                </xsl:call-template>
+                                
+                                <!--<xsl:call-template name="default_db__x3A__BI_audit_BENFORD:generate">
+                                    <xsl:with-param name="system_cache__dita:interested_row" select="."/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:valueField" select="$default_db__x3A__BI_audit_BENFORD:valueField" tunnel="yes"/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:groupField" select="$default_db__x3A__BI_audit_BENFORD:groupField" tunnel="yes"/>
+                                    <xsl:with-param name="default_db__x3A__BI_audit_BENFORD:timeField" select="$default_db__x3A__BI_audit_BENFORD:timeField" tunnel="yes"/>
+                                </xsl:call-template>-->
+                            </fixed>
+                        </xsl:for-each>
+                    </xsl:when>
+                    <xsl:when test="$system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.path">
+                        <xsl:message>#112 called $system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.path</xsl:message>
+                        <xsl:choose>
+                            <xsl:when test="$element = '*' and 1=2"/>
+                            <xsl:otherwise>
+                                <xsl:for-each select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" >
+                                    <fixed debug="97">
+                                        <xsl:attribute name="key" select="system_cache__dita:files.key.DETECT(@fid,'','','')"/> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'') XX11 -->
+                                        <xsl:attribute name="fid" select="@fid"/>
+                                        <xsl:attribute name="source" select="$source"/>
+                                        <xsl:attribute name="name" select="name()"/>
+                                        <xsl:attribute name="generate-id" select="@generate-id"/>
+                                        <xsl:attribute name="system_cache__dita:interested_row.path">
+                                            <xsl:value-of select="descendant-or-self::*[position()=1]/@fid"/>
+                                        </xsl:attribute>
+                                        <xsl:attribute name="system_cache__dita:interested_row.path.generate-id">
+                                            <xsl:value-of select="descendant-or-self::*[position()=1]/@generate-id"/>
+                                        </xsl:attribute>
+                                    </fixed>
+                                </xsl:for-each>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:when test="$element = '*'">
+                        <xsl:for-each select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*/source= current() or not(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*/source)]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1]" >
+                            <fixed debug="112">
+                                <xsl:attribute name="key" select="system_cache__dita:files.key.DETECT(@fid,'','','')"/> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'') XX11 -->
+                                <xsl:attribute name="fid" select="@fid"/>
+                                <xsl:attribute name="source" select="$source"/>
+                                <xsl:attribute name="name" select="name()"/>
+                                <xsl:attribute name="generate-id" select="@generate-id"/>
+                                <xsl:attribute name="system_cache__dita:interested_row.path">
+                                    <xsl:value-of select="descendant-or-self::*[position()=1]/@fid"/>
+                                </xsl:attribute>
+                                <xsl:attribute name="system_cache__dita:interested_row.path.generate-id">
+                                    <xsl:value-of select="descendant-or-self::*[position()=1]/@generate-id"/>
+                                </xsl:attribute>
+                            </fixed>
+                        </xsl:for-each>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:for-each select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*/source= current() or not(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*/source)]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[local-name()=$element]" >
+                            <fixed debug="125">
+                                <xsl:attribute name="key" select="system_cache__dita:files.key.DETECT(@fid,'','','')"/> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'') XX11 -->
+                                <xsl:attribute name="fid" select="@fid"/>
+                                <xsl:attribute name="source" select="$source"/>
+                                <xsl:attribute name="name" select="name()"/>
+                                <xsl:attribute name="generate-id" select="@generate-id"/>
+                                <xsl:attribute name="system_cache__dita:interested_row.path">
+                                    <xsl:value-of select="descendant-or-self::*[position()=1]/@fid"/>
+                                </xsl:attribute>
+                                <xsl:attribute name="system_cache__dita:interested_row.path.generate-id">
+                                    <xsl:value-of select="descendant-or-self::*[position()=1]/@generate-id"/>
+                                </xsl:attribute>
+                            </fixed>
+                        </xsl:for-each>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
+            </xsl:for-each>
+        </system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed>
+    </xsl:template>
+    
+   
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed">
+        <xsl:param name="interested_row"/>
+        <xsl:param name="sources"/>
+        <xsl:param name="element"/>
+        <system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed>
+            <xsl:for-each select="$sources/sources/source">
+                <xsl:variable name="source" select="."/>
+                <xsl:choose>
+                    <xsl:when test="$element = '*'">
+                        <xsl:for-each select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*/source= current() or not(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*/source)]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[1]" >
+                            <fixed debug="154">
+                                <xsl:attribute name="key" select="system_cache__dita:files.key.DETECT(@fid,'','','')"/> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'') XX11 -->
+                                <xsl:attribute name="fid" select="@fid"/>
+                                <xsl:attribute name="source" select="$source"/>
+                                <xsl:attribute name="name" select="name()"/>
+                                <xsl:attribute name="generate-id" select="@generate-id"/>
+                                <xsl:copy-of select="@system_cache__dita:interested_row.path"/>
+                                <xsl:copy-of select="@system_cache__dita:interested_row.path.generate-id"/>
+                            </fixed>
+                        </xsl:for-each>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:for-each select="$interested_row/interested_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row[BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*/source= current() or not(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[position() = 1]/*/source)]/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object/*[local-name()=$element]" >
+                            <fixed debug="167">
+                                <xsl:attribute name="key" select="system_cache__dita:files.key.DETECT(@fid,'','','')"/> <!-- system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.BI_audit_KRS_person.key(nazwisko,imiona,pesel,'') XX11 -->
+                                <xsl:attribute name="fid" select="@fid"/>
+                                <xsl:attribute name="source" select="$source"/>
+                                <xsl:attribute name="name" select="name()"/>
+                                <xsl:attribute name="generate-id" select="@generate-id"/>
+                                <xsl:copy-of select="@system_cache__dita:interested_row.path"/>
+                                <xsl:copy-of select="@system_cache__dita:interested_row.path.generate-id"/>
+                            </fixed>
+                        </xsl:for-each>
+                    </xsl:otherwise>
+                </xsl:choose>
+                
+            </xsl:for-each>
+        </system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed>
+    </xsl:function>
+    
+    
+    <xsl:function name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq">
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed"/>
+        <xsl:param name="sources"/>
+        
+        <system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq>
+            <xsl:for-each select="$sources/sources/source">
+                <xsl:variable name="source" select="."/>
+                <xsl:for-each-group select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed//fixed[@source=$source]" group-by="@key">
+                    <uniq>
+                        <xsl:attribute name="key" select="@key"/>
+                        <xsl:attribute name="fid" select="@fid"/>
+                        <xsl:attribute name="source" select="$source"/>
+                        <xsl:attribute name="generate-id" select="@generate-id"/>
+                        <xsl:copy-of select="@name"/>
+                        <xsl:copy-of select="@system_cache__dita:interested_row.path"/>
+                        <xsl:copy-of select="@system_cache__dita:interested_row.path.generate-id"/>
+                        <xsl:copy-of select="@*"/>
+                    </uniq>
+                </xsl:for-each-group>
+            </xsl:for-each>
+        </system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq>
+    </xsl:function>
+    
+    
+    <xsl:template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq.to_nodes">
+        <!-- to get nodeset like real from map to apply it ordinary -->
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 64 - 17
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.stats_all.xsl

@@ -9,6 +9,7 @@
     xmlns:p5="https://biuro.biall-net.pl/wfs"
     xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
     xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
     exclude-result-prefixes="xs system_cache__appinfo system_cache__dita ogr Benford default_db get_wfs p5 p5gnuplot"
     version="2.0">
     
@@ -18,7 +19,14 @@
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     
+    
+    <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit" select="45"/>
+    
     <xsl:template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
         <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[not(position()=1) and not(position()=last())]/*[1]" group-by="local-name()">
             <topicref href="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.{local-name()}.dita" props="name__BaERKP.stats_all">
                 <xsl:result-document href="{$temp}/{$uuid}/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.{local-name()}.dita">
@@ -31,61 +39,100 @@
     
     
     <xsl:template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all__x3A__preprocess">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
         <xsl:for-each-group select="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object[not(position()=1) and not(position()=last())]/*[1]" group-by="local-name()">
                     <xsl:apply-templates select="." mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.local-name"/>
         </xsl:for-each-group>
     </xsl:template>
     
     <xsl:template mode="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.local-name" match="*">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
         <topic id="{$uuid}BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.{local-name()}.dita" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:topic.xsd">
             <title>Statystyka powiązań dla obiektu <xsl:value-of select="local-name()"/>
+                <xsl:if test="number($system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit) &gt;0"><sub>limit <xsl:value-of select="$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit"/></sub></xsl:if>
                 
             </title>
             <xsl:comment>#972-38 </xsl:comment>
             <body>
                 
-                
-                
                 <xsl:variable name="simpletable"> 
-                    <simpletable frame="all" id="{$uuid}BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.{local-name()}.dita" props="print__no">
-                        <strow>
-                            
-                            <xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID]" group-by="@fid">
-                                <stentry>
-                                    <xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat('[',ID,'] ',imiona,' ',nazwisko,' ', nazwa, Pelna_nazwa_kontrahenta,' ',TERYT_names/miejscowosc,' ',TERYT_names/ulica_cecha,' ',TERYT_names/ulica_nazwa_1,' ',TERYT_names/ulica_nazwa_2,A_kod,' ', A_miejscowosc,' ',A_ulica ))"/>
+                    <simpletable frame="all" id="{$uuid}BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.{local-name()}.dita" props="print__no  graph.style.histogram graph.ylabel.nazwa graph.lingstring.break.size.25">
+                        <strow props="graph.headers">
+                            <xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID][position() &lt;$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit]" group-by="@fid">
+                                <stentry props="graph.xtic" current-grouping-key="{current-grouping-key()}">
+                                    <!--<xsl:text>wartosc</xsl:text>-->
+                                    <!--<xsl:text>nazwa</xsl:text>-->
+                                    <!--<xsl:text>wartość</xsl:text>-->
+                                    <xsl:value-of select="concat('[',ID,'] ',imiona,' ',nazwisko,' ', nazwa, Pelna_nazwa_kontrahenta,' ',TERYT_names/miejscowosc,' ',TERYT_names/ulica_cecha,' ',TERYT_names/ulica_nazwa_1,' ',TERYT_names/ulica_nazwa_2,A_kod,' ', A_miejscowosc,' ',A_ulica )"/><!-- p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names( -->
                                 </stentry>
                             </xsl:for-each-group>
                         </strow>
-                        <strow>
-                            
-                            <xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID]" group-by="@fid">
-                                <stentry>
+                        <strow props="graph.data">
+                            <xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID][position() &lt;$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit]" group-by="@fid">
+                                <stentry current-grouping-key="{current-grouping-key()}">
                                     <xsl:value-of select="count(current-group())"/>
                                 </stentry>
                             </xsl:for-each-group>
                         </strow>
+                        <strow props="graph.title">
+                            <xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID][position() &lt;$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit]" group-by="@fid">
+                                <stentry props="graph.xtic" audience="wartosc" current-grouping-key="{current-grouping-key()}" group="{system_cache__dita:graph.title.group('','wartosc','')}">
+                                    <xsl:text>wartość</xsl:text>
+                                    <!--<xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(concat('[',ID,'] ',imiona,' ',nazwisko,' ', nazwa, Pelna_nazwa_kontrahenta,' ',TERYT_names/miejscowosc,' ',TERYT_names/ulica_cecha,' ',TERYT_names/ulica_nazwa_1,' ',TERYT_names/ulica_nazwa_2,A_kod,' ', A_miejscowosc,' ',A_ulica ))"/>-->
+                                </stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                        <strow props="graph.color.name">
+                            <xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID][position() &lt;$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit]" group-by="@fid">
+                                <stentry/>
+                            </xsl:for-each-group>
+                        </strow>
+                        <strow props="graph.color.variable">
+                            <xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID][position() &lt;$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit]" group-by="@fid">
+                                <stentry current-grouping-key="{current-grouping-key()}"><xsl:value-of select="position()"/></stentry>
+                            </xsl:for-each-group>
+                        </strow>
+                        <strow props="graph.fill.style">
+                            <xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID][position() &lt;$system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.stats_all.size__x3A__limit]" group-by="@fid">
+                                <stentry/>
+                            </xsl:for-each-group>
+                        </strow>
+                        <strow props="graph.newhistogram">
+                            <!--<xsl:for-each-group select="current-group()[nazwisko|nazwa|Pelna_nazwa_kontrahenta|ID]" group-by="@fid">-->
+                                <stentry audience="wartosc"> analiza </stentry>
+                            <!--</xsl:for-each-group>-->
+                        </strow>
                     </simpletable>
                 </xsl:variable>
+                <xsl:variable name="simpletable">
+                    <xsl:call-template name="system_cache__dita:graph.all.data.fit.fix__x3A__numerate.simpletable">
+                        <xsl:with-param name="simpletable" select="$simpletable"/>
+                    </xsl:call-template>
+                </xsl:variable>
                 <xsl:choose>
                     <xsl:when test="$simpletable//stentry">
-                        <p> Ilości powiązań  obiektu <xsl:value-of select="name()"/></p>
+                        <!--<p> Ilości powiązań  obiektu <xsl:value-of select="name()"/></p>-->
                         <p>
                             <foreign>
                                 <xsl:copy-of select="$simpletable" copy-namespaces="no"/>
                             </foreign>
                             <xsl:apply-templates mode="system_cache__dita:graph__read" select="$simpletable">
                                 <xsl:with-param name="fileindex" select="$simpletable/simpletable/@id"/>
-                                <xsl:with-param name="width" select="600"/>
+                                <xsl:with-param name="width" select="500"/>
+                                <xsl:with-param name="title">Ilości powiązań  obiektu <xsl:value-of select="name()"/></xsl:with-param>
                             </xsl:apply-templates>
                         </p>
                     </xsl:when>
                     
                 </xsl:choose>
                 
-                
-                
-                                
                 <xsl:comment>#1016-103 </xsl:comment>
                 
                 

文件差异内容过多而无法显示
+ 247 - 530
SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl


+ 51 - 0
SE/schema/default_db_xml_cache.public/default_db/dateTime.xsl

@@ -38,6 +38,57 @@
         
     </xsl:function>
     
+    <xsl:function name="system_cache__dita:year-month">
+        <xsl:param name="date"/>
+        <xsl:choose>
+            
+            <xsl:when test="string($date) castable as xs:dateTime">
+                <!--<xsl:message>#20 passed as dateTime</xsl:message>-->
+                <xsl:value-of select="format-date(xs:date(xs:dateTime($date)),'[Y-m]')"/>
+            </xsl:when>
+            <xsl:when test="string($date) castable as xs:date">
+                <!--<xsl:message>#20 passed as date</xsl:message>-->
+                <xsl:value-of select="format-date(xs:date($date),'[Y-m]')"/>
+            </xsl:when>
+            <xsl:when test="tokenize(string($date),'\.')[3]">
+                <!--<xsl:message>#20 date passed as tokenize</xsl:message>-->
+                <xsl:value-of select="tokenize($date,'\.')[3]"/><xsl:text>-</xsl:text>
+                <xsl:value-of select="tokenize($date,'\.')[2]"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="no">#28-B ERROR ERROR in date format for value "<xsl:value-of select="$date"/>"! </xsl:message>
+            </xsl:otherwise>
+            
+        </xsl:choose>
+        
+        
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:year-quarter">
+        <xsl:param name="date"/>
+        <xsl:choose>
+            
+            <xsl:when test="string($date) castable as xs:dateTime">
+                <!--<xsl:message>#20 passed as dateTime</xsl:message>-->
+                <xsl:value-of select="format-date(xs:date(xs:dateTime($date)),'[Y]')"/>|<xsl:value-of select="round(number(format-date(xs:date(xs:dateTime($date)),'[m]')) div 3)"/>
+            </xsl:when>
+            <xsl:when test="string($date) castable as xs:date">
+                <!--<xsl:message>#20 passed as date</xsl:message>-->
+                <xsl:value-of select="format-date(xs:date($date),'[Y]')"/>|<xsl:value-of select="round(number(format-date(xs:date($date),'[m]')) div 3)"/>
+            </xsl:when>
+            <xsl:when test="tokenize(string($date),'\.')[3]">
+                <!--<xsl:message>#20 date passed as tokenize</xsl:message>-->
+                <xsl:value-of select="tokenize($date,'\.')[3]"/><xsl:text>|</xsl:text>
+                <xsl:value-of select="round(number(tokenize($date,'\.')[2]) div 3)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="no">#28-C ERROR ERROR in date format for value "<xsl:value-of select="$date"/>"! </xsl:message>
+            </xsl:otherwise>
+            
+        </xsl:choose>
+        
+        
+    </xsl:function>
     
     
     <xsl:template name="debug.dateTime">

文件差异内容过多而无法显示
+ 906 - 27
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplot.xsl


+ 53 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics.header.xsl

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:template name="system_cache__dita:graph.ytics.header">
+        <xsl:param name="ytics" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:choose>
+            <xsl:when test="system_cache__dita:graph.ytics.header($ytics,$col)">
+                <xsl:attribute name="graph.headers" select="system_cache__dita:graph.ytics.header($ytics,$col)"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="yes">#25 incorrect - not found  $graph.headers//stentry[@current-grouping-key=$current-grouping-key]/text() - <xsl:value-of select="$col"/></xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:function name="system_cache__dita:graph.ytics.header">
+        <xsl:param name="ytics" />
+        <xsl:param name="col" />
+        <xsl:value-of select="$ytics//stentry[@col=$col]/text()"/>
+    </xsl:function>
+    
+    <!--<xsl:function name="system_cache__dita:graph.xtics.header">
+        <xsl:param name="ytics" />
+        <xsl:param name="current-grouping-key" />
+        <xsl:param name="col" />
+        <xsl:choose>
+            <xsl:when test="$ytics//stentry[@current-grouping-key=$current-grouping-key and @col=$col]/text()">
+                <xsl:value-of select="$ytics//stentry[@current-grouping-key=$current-grouping-key and @col=$col]/text()"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="yes">#25-45 error [$graph.headers//stentry[@current-grouping-key=$current-grouping-key and @col=$col]/text()] - [ $current-grouping-key=<xsl:value-of select="$current-grouping-key"/> ] ; [ $col = <xsl:value-of select="$col"/> ]</xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+        
+    </xsl:function>-->
+    
+    
+</xsl:stylesheet>

+ 488 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics.xsl

@@ -0,0 +1,488 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:include href="graph_gnuplotdat.row__x3A__from__xtics__x3A__plot.xsl"/>
+    <xsl:include href="graph_gnuplotdat.row__x3A__from__xtics__x3A__set.xsl"/>
+    <xsl:include href="graph_gnuplotdat.row__x3A__from__xtics__x3A__detect.xsl"/>
+    
+    
+    
+    
+    <xsl:template name="system_cache__dita:graph.title">
+        <xsl:param name="graph.title" required="yes"/>
+        <graph.title>
+            <xsl:for-each select="$graph.title//strow" >
+                <xsl:copy>
+                    <xsl:copy-of select="@*"/>
+                    <xsl:attribute name="strow.pos" select="position()"/>
+                    <xsl:variable name="strow.pos" select="position()"/>
+                    <xsl:for-each select="stentry">
+                        <xsl:copy>
+                            <xsl:copy-of select="@*"/>
+                            <xsl:attribute name="stentry.pow" select="position()"/>
+                            <xsl:attribute name="count.stentry.pow.all" select="position() + $strow.pos"/>
+                            <xsl:copy-of select="text()"/>
+                        </xsl:copy>
+                    </xsl:for-each>
+                </xsl:copy>
+            </xsl:for-each>
+        </graph.title>
+    </xsl:template>
+    
+    <xsl:template name="system_cache__dita:graph.xtics">
+        <xsl:param name="system_cache__dita:graph.title" required="yes"/>
+        <xsl:param name="graph.newhistogram" required="yes"/>
+        <xsl:param name="fileindex"  required="yes" />
+        <xsl:param name="graph.fill.style" required="yes"/>
+        <xsl:param name="graph.color.name" required="yes"/>
+        <xsl:param name="graph.color.variable" required="yes"/>
+        <xsl:param name="graph.yaxis" required="yes"/>
+        <xsl:param name="p5gnuplot:font__x3A__size" required="yes"/>
+        <xsl:param name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size" required="yes"/>
+        <xsl:param name="system_cache__dita:graph.lingstring__x3A__break.size" required="yes"/>
+        <xsl:param name="graph.data" required="yes"/>
+        <xsl:param name="graph.headers" required="yes"/>
+        <xsl:param name="graph.title" required="yes"/>
+        <xsl:param name="ytics" required="yes"/>
+        <xtics fileindex="{$fileindex}">
+            <xsl:variable name="xtics">
+                <xtics>
+                    <xsl:for-each-group select="$graph.headers//stentry" group-by="text()">
+                        <text pos="{position()}" count="{count(current-group())}" >
+                            <xsl:copy-of select="@stentry.pow"/>
+                            <xsl:copy-of select="@audience"/>
+                            <xsl:copy-of select="@col"/>
+                            <xsl:copy-of select="@current-grouping-key"/>
+                            
+                            <xsl:attribute name="group" select="@group"/>
+                            <xsl:attribute name="current-grouping-key.list" select="current-group()/@current-grouping-key"/>
+                            <xsl:copy-of select="parent::strow/@strow.pos"/>
+                                <xsl:for-each select="current-group()/@current-grouping-key">
+                                    <current-grouping-key pos="{position()}" col="{../@col}">
+                                        <xsl:value-of select="."/>
+                                    </current-grouping-key>
+                                </xsl:for-each>
+                            <xsl:for-each select="tokenize(@audience,' ')">
+                                <audience><xsl:value-of select="."/></audience>
+                            </xsl:for-each>
+                            <xsl:for-each select="current-group()/@current-grouping-key">
+                                <xsl:for-each select="$graph.color.variable//stentry[@current-grouping-key=current()]">
+                                            <graph.color.variable>
+                                                <xsl:copy-of select="@*"/>
+                                                <xsl:copy-of select="text()"/>
+                                            </graph.color.variable>
+                                        </xsl:for-each>
+                            </xsl:for-each>
+                            <xsl:value-of select="text()"/>
+                        </text>
+                    </xsl:for-each-group>
+                </xtics>
+            </xsl:variable>
+            <xsl:copy-of select="$xtics/xtics/*"/>
+            <xsl:variable name="p5gnuplot:graph.newhistogram__x3A__to_analyze">
+                <p5gnuplot:graph.newhistogram__x3A__to_analyze>
+                    <xsl:for-each-group select="$graph.newhistogram//stentry" group-by="text()">
+                        <xsl:variable name="graph.newhistogram.text" select="current-grouping-key()"/>
+                        <xsl:variable name="graph.newhistogram.position" select="position()"/>
+                        
+                        <graph.newhistogram pos="{position()}" graph.newhistogram.text="{$graph.newhistogram.text}" >
+                            <xsl:choose>
+                                <xsl:when test="$xtics//text[@pos = $graph.newhistogram.position]">
+                                    <xsl:attribute name="xtics.col__x3A__aviable">ok53 for pos= <xsl:value-of select="position()"/></xsl:attribute>
+                                </xsl:when>
+                                <!--<xsl:when test="system_cache__dita:graph.yaxis__x3A_validate($ytics,$graph.newhistogram.position)">
+                                    <xsl:attribute name="xtics.col__x3A__aviable">ok53 for pos= <xsl:value-of select="position()"/></xsl:attribute>
+                                </xsl:when>-->
+                                <xsl:otherwise>
+                                    <xsl:message>#53 xtics.col__x3A__not_aviable for <xsl:value-of select="$graph.newhistogram.text"/></xsl:message>
+                                    <xsl:attribute name="xtics.col__x3A__not_aviable">error</xsl:attribute>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                            
+                            <xsl:for-each-group select="current-group()"  group-by="@audience">
+                                <audience audience="{current-grouping-key()}" >
+                                    <xsl:for-each select="$xtics//text[@audience = current()/@audience]" >
+                                        <!--<xsl:attribute name="xtics.current-group.count" select="last()"/>-->
+                                        <!--<xsl:attribute name="xtics.current-group.count.debug" select="@current-grouping-key"/>-->
+                                        <!--<xsl:attribute name="xtics.audience.count.debug" select="@audience"/>-->
+                                        <xsl:copy-of select="@current-grouping-key.list"/>
+                                        <xsl:variable name="current-grouping-key.test" select="@current-grouping-key"/>
+                                        <xsl:attribute name="current-grouping-key.foreign" select="false()"/>
+                                        <xsl:for-each select="tokenize(@current-grouping-key.list,' ')">
+                                            <xsl:choose>
+                                                <xsl:when test="current() = $current-grouping-key.test"/>
+                                                <xsl:otherwise>
+                                                    <xsl:attribute name="current-grouping-key.foreign" select="true()"/>
+                                                </xsl:otherwise>
+                                            </xsl:choose>
+                                        </xsl:for-each>
+                                    </xsl:for-each>
+                                    <xsl:for-each select="tokenize(current-grouping-key(),' ')">
+                                        <!--<xsl:text>[[[</xsl:text><xsl:value-of select="."/><xsl:text>]]]</xsl:text>-->
+                                        <xsl:for-each-group select="$system_cache__dita:graph.title//stentry[contains(@audience,current())]" group-by="text()">
+                                            <current-grouping-key col="{@col}" audience="{@audience}" current-grouping-key="{@current-grouping-key}">
+                                                <xsl:attribute name="xtics.pos__x3A__old_debug_to_off" select="$xtics//text[@col = current()/@col]/@pos"/>
+                                                <xsl:attribute name="xtics.pos" select="system_cache__dita:graph.yaxis.pos($graph.title,$ytics,@current-grouping-key,@col)"/>
+                                                <xsl:choose>
+                                                    <!--<xsl:when test="$xtics//text[@col = current()/@col]"/>-->
+                                                    
+                                                    <xsl:when test="system_cache__dita:graph.yaxis.header.row__x3A_validate($ytics,@col)">
+                                                        <xsl:attribute name="xtics.col__x3A__not_aviable.debug">#163-A validate by  system_cache__dita:graph.yaxis.header.row__x3A_validate [@col =__<xsl:value-of select="@col"/>__ ]; </xsl:attribute>
+                                                    </xsl:when>
+                                                    <!--<xsl:when test="system_cache__dita:graph.yaxis__x3A_validate__group($xtics,@current-grouping-key,@col)">
+                                                        <xsl:attribute name="xtics.col__x3A__not_aviable.debug">#163-B validate by  system_cache__dita:graph.yaxis__x3A_validate__group [@col =__<xsl:value-of select="@col"/>__ ]; </xsl:attribute>
+                                                    </xsl:when>-->
+                                                    <xsl:otherwise>
+                                                        <xsl:attribute name="xtics.col__x3A__not_aviable">error</xsl:attribute>
+                                                        <xsl:attribute name="xtics.col__x3A__not_aviable.debug">#163-Bnot aviable for $xtics//text[@col =__<xsl:value-of select="@col"/>__ ]; </xsl:attribute>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                                <xsl:call-template name="system_cache__dita:graph.ytics.color">
+                                                    <xsl:with-param name="graph.color.variable" select="$graph.color.variable"/>
+                                                    <xsl:with-param name="col" select="current()/@col"/>
+                                                </xsl:call-template>
+                                                <xsl:value-of select="@current-grouping-key"/></current-grouping-key>
+                                        </xsl:for-each-group>
+                                    </xsl:for-each>
+                                </audience>
+                            </xsl:for-each-group>
+                            <xsl:copy-of select="text()"/>
+                        </graph.newhistogram>
+                    </xsl:for-each-group>
+                </p5gnuplot:graph.newhistogram__x3A__to_analyze>
+            </xsl:variable>
+            <xsl:copy-of select="$p5gnuplot:graph.newhistogram__x3A__to_analyze//graph.newhistogram"/><!-- //graph.newhistogram -->
+            <xsl:apply-templates mode="p5gnuplot:graph.newhistogram" select="$p5gnuplot:graph.newhistogram__x3A__to_analyze">
+                <xsl:with-param name="fileindex"  tunnel="yes" select="$fileindex"/>
+                <xsl:with-param name="graph.fill.style" tunnel="yes"  select="$graph.fill.style" />
+                <xsl:with-param name="graph.color.name" select="$graph.color.name" tunnel="yes"/>
+                <xsl:with-param name="xtics" select="$xtics" tunnel="yes"/>
+                <xsl:with-param name="graph.color.variable" select="$graph.color.variable" tunnel="yes"/>
+                <xsl:with-param name="graph.yaxis" select="$graph.yaxis" tunnel="yes"/>
+                <xsl:with-param name="p5gnuplot:font__x3A__size" select="$p5gnuplot:font__x3A__size" tunnel="yes"/>
+                <xsl:with-param name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size" select="$p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size" tunnel="yes"/>
+                <xsl:with-param name="system_cache__dita:graph.lingstring__x3A__break.size" select="$system_cache__dita:graph.lingstring__x3A__break.size" tunnel="yes"/>
+                <xsl:with-param name="graph.data" select="$graph.data" tunnel="yes"/>
+                <xsl:with-param name="ytics" select="$ytics" tunnel="yes"/>
+                <xsl:with-param name="graph.newhistogram" select="$graph.newhistogram" tunnel="yes"/>
+            </xsl:apply-templates>
+                
+        </xtics>
+    </xsl:template>
+    
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram" match="text()|comment()|*"/>
+    
+    
+    
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram" match="p5gnuplot:graph.newhistogram__x3A__to_analyze">
+        <xsl:param name="fileindex" tunnel="yes" />
+        <xsl:param name="graph.fill.style"  tunnel="yes"/>
+        <xsl:param name="graph.color.name" required="yes" tunnel="yes"/>
+        <xsl:param name="xtics" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.variable" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.yaxis" required="yes" tunnel="yes"/>
+        <xsl:param name="p5gnuplot:font__x3A__size" required="yes" tunnel="yes"/>
+        <xsl:param name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size" required="yes" tunnel="yes"/>
+        <xsl:param name="system_cache__dita:graph.lingstring__x3A__break.size" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.data" required="yes" tunnel="yes"/>
+        <xsl:param name="ytics" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.newhistogram" required="yes" tunnel="yes"/>
+        <p5gnuplot:graph.newhistogram>
+            <xsl:call-template name="p5gnuplot:set.xtics.rotate"/>
+            <xsl:call-template name="p5gnuplot:set.key"/>
+            <xsl:call-template name="p5gnuplot:set.bmargin"/>
+            <xsl:call-template name="p5gnuplot:set.yrange"/>
+            <p5gnuplot:graph.newhistogram.child>
+                <xsl:attribute name="p5gnuplot:text.join"><xsl:text>
+</xsl:text></xsl:attribute>
+                <xsl:attribute name="p5gnuplot:text">plot</xsl:attribute>
+                <xsl:apply-templates mode="#current"/>
+            </p5gnuplot:graph.newhistogram.child>
+        </p5gnuplot:graph.newhistogram>
+    </xsl:template>
+        
+    <xsl:template mode="p5gnuplot:graph.newhistogram" match="graph.newhistogram[@xtics.col__x3A__not_aviable]|current-grouping-key[@xtics.col__x3A__not_aviable]">
+        <xsl:comment>
+            #105 not avilable n/"<xsl:value-of select="name()"/>" @xtics.col__x3A__not_aviable <xsl:copy-of select="@*"/>
+        </xsl:comment>
+    </xsl:template>   
+        
+    <xsl:template mode="p5gnuplot:graph.newhistogram" match="graph.newhistogram">
+        <xsl:param name="fileindex" tunnel="yes" />
+        <xsl:param name="graph.fill.style"  tunnel="yes"/>
+        <xsl:param name="graph.color.name"  tunnel="yes"/>
+        <xsl:param name="graph.color.variable" tunnel="yes"/>
+        <xsl:param name="xtics"  tunnel="yes"/>
+        <xsl:param name="graph.yaxis" required="yes" tunnel="yes"/>
+        <xsl:param name="p5gnuplot:font__x3A__size" required="yes" tunnel="yes"/>
+        <xsl:param name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size" required="yes" tunnel="yes"/>
+        <xsl:param name="system_cache__dita:graph.lingstring__x3A__break.size" required="yes" tunnel="yes"/> 
+        <xsl:param name="graph.data" required="yes" tunnel="yes"/>
+        <xsl:param name="ytics" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.newhistogram" required="yes" tunnel="yes"/>
+        <xsl:comment>#72 @pos=<xsl:value-of select="@pos"/></xsl:comment>
+        <p5gnuplot:plot p5gnuplot:text.join=" ">
+            <xsl:choose>
+                <xsl:when test="1=1 and audience[@current-grouping-key.foreign='false'] and @pos='1'">
+                    <xsl:variable name="newhistogram.text"><xsl:value-of select="@graph.newhistogram.text"/><xsl:text> </xsl:text><xsl:for-each select="following-sibling::graph.newhistogram"> oraz: <xsl:value-of select="@graph.newhistogram.text"/></xsl:for-each></xsl:variable>
+                    <!--<xsl:attribute name="p5gnuplot:text"> newhistogram "<xsl:value-of select="@graph.newhistogram.text"/> <xsl:for-each select="following-sibling::graph.newhistogram"> oraz: <xsl:value-of select="@graph.newhistogram.text"/></xsl:for-each>" </xsl:attribute>-->
+                    <xsl:attribute name="p5gnuplot:text"> newhistogram <xsl:value-of select="system_cache__dita:graph.lingstring__x3A__break(p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names($newhistogram.text,45),$system_cache__dita:graph.lingstring__x3A__break.size)"/> </xsl:attribute>
+                </xsl:when>
+                <xsl:when test="1=1 and audience[@current-grouping-key.foreign='false']">
+                    <xsl:comment>#146 bypassed  histograms</xsl:comment>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:choose>
+                        <xsl:when test="preceding::graph.newhistogram">
+                            <xsl:attribute name="p5gnuplot:text.line.join"> , </xsl:attribute>
+                        </xsl:when>
+                    </xsl:choose>
+                    <xsl:attribute name="p5gnuplot:text"> newhistogram <xsl:value-of select="system_cache__dita:graph.lingstring__x3A__break(p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(@graph.newhistogram.text,40),$system_cache__dita:graph.lingstring__x3A__break.size)"/> </xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+            <xsl:apply-templates mode="#current"/>
+        </p5gnuplot:plot>
+        
+    </xsl:template>
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram" match="audience">
+        <xsl:param name="fileindex" tunnel="yes" required="yes" />
+        <xsl:param name="graph.fill.style" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.name" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.variable" required="yes" tunnel="yes"/>
+        <xsl:param name="xtics"  tunnel="yes"/>
+        <xsl:param name="graph.yaxis"  tunnel="yes"/>
+        <xsl:param name="p5gnuplot:font__x3A__size" required="yes" tunnel="yes"/>
+        <xsl:param name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size" required="yes" tunnel="yes"/>
+        <xsl:param name="system_cache__dita:graph.lingstring__x3A__break.size" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.data" required="yes" tunnel="yes"/>
+        <xsl:param name="ytics" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.newhistogram" required="yes" tunnel="yes"/>
+        <xsl:param name="xtics.data.column__x3A__offset" select="p5gnuplot:xtics.data.column__x3A__offset()" tunnel="yes" />
+        <p5gnuplot:newhistogram  p5gnuplot:text.join=" " debug="#281 matched: {name()}">
+            <!--<xsl:choose>
+                <xsl:when test="preceding::audience">-->
+                    <!--<xsl:attribute name="p5gnuplot:text">"<xsl:value-of select="system_cache__dita:audience__x3A__unescape(@audience)"/>"</xsl:attribute>-->
+                <!--</xsl:when>
+            </xsl:choose>-->
+            <xsl:apply-templates mode="#current"/>
+        </p5gnuplot:newhistogram>
+    </xsl:template>
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram" match="current-grouping-key">
+        <xsl:param name="fileindex" tunnel="yes" required="yes"/>
+        <xsl:param name="graph.fill.style" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.name" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.variable" required="yes" tunnel="yes"/>
+        <xsl:param name="xtics"  tunnel="yes"/>
+        <xsl:param name="graph.yaxis"  tunnel="yes"/>
+        <xsl:param name="p5gnuplot:graph.gnuplot.dat__x3A__suffix">.gnuplot.dat</xsl:param>
+        <xsl:param name="xtics.data.column__x3A__offset" select="p5gnuplot:xtics.data.column__x3A__offset()" tunnel="yes" />
+        <xsl:param name="p5gnuplot:font__x3A__size" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.data" required="yes" tunnel="yes"/>
+        <xsl:param name="ytics" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.newhistogram" required="yes" tunnel="yes"/>
+        <p5gnuplot:plot_arg p5gnuplot:text.join=" " debug="#303 matched: {name()}">
+            <!--<xsl:if test="preceding::current-grouping-key">
+            <xsl:attribute name="p5gnuplot:text.join"> , </xsl:attribute>
+            </xsl:if>-->
+            
+            <p5gnuplot:file p5gnuplot:text.join=" , " p5gnuplot:text="&quot;{$fileindex}{$p5gnuplot:graph.gnuplot.dat__x3A__suffix}&quot;" debug="file is used; input @col={@col}; @xtics.pos={@xtics.pos}; "/>
+            
+            
+            <p5gnuplot:file.row.y.using p5gnuplot:text.join=" " p5gnuplot:text="using " debug="which row is used for data"/>
+            
+            <xsl:call-template name="p5gnuplot:detect.histogram"/>
+            <xsl:call-template name="p5gnuplot:file.row.x.cluster.offset"/>
+            <xsl:choose>
+                <!--<xsl:when test="number(@graph.color.variable) &gt;0 and not(@audience) &gt;0">
+                    <p5gnuplot:file.row.y.color.column   debug="disabling when both set - TODO to verify when to use zero">
+                        <xsl:attribute name="p5gnuplot:unless" select="'p5gnuplot:file.row.color/text()'"/>
+                    </p5gnuplot:file.row.y.color.column>
+                </xsl:when>-->
+                <xsl:when test="number(@graph.color.variable) &gt;0">
+                    <p5gnuplot:file.row.y.color.column  p5gnuplot:text="0:" debug="when declared color columnt - this must be set as x t:{following::p5gnuplot:file.row.y.color.column/@p5gnuplot:text} col={@col}">
+                        <xsl:attribute name="p5gnuplot:unless" select="'p5gnuplot:file.row.color/text()'"/>
+                    </p5gnuplot:file.row.y.color.column>
+                </xsl:when>
+            </xsl:choose>
+            
+            <p5gnuplot:file.row.y  p5gnuplot:text="{number(@xtics.pos)}" debug="cond color columns"/><!-- $xtics.data.column__x3A__offset -->
+            <xsl:choose>
+                <xsl:when test="number(@graph.color.variable) &gt;0">
+                    <p5gnuplot:file.row.y.color.column  p5gnuplot:text=":(column(-{system_cache__dita:graph.xtics.color.column($xtics)}))" debug="which row is used for color and unless todo graph.fill.style/text()  col={@col}">
+                        <xsl:attribute name="p5gnuplot:unless" select="'p5gnuplot:file.row.color/text()'"/>
+                    </p5gnuplot:file.row.y.color.column>
+                </xsl:when>
+            </xsl:choose>
+            <xsl:choose>
+                <xsl:when test="preceding-sibling::current-grouping-key"/>
+                <xsl:otherwise>
+                    <p5gnuplot:file.row.x p5gnuplot:text.join=":" p5gnuplot:text="xtic(1)" p5gnuplot:value="1" />
+                </xsl:otherwise>
+            </xsl:choose>
+            
+            <xsl:call-template name="p5gnuplot:file.row.title">
+                <xsl:with-param name="col" select="@col"/><!-- @xtics.pos -->
+            </xsl:call-template>
+            <!--<p5gnuplot:fill.boxes p5gnuplot:text.join=" with boxes " />-->  
+            <xsl:call-template name="p5gnuplot:file.row.style">
+                <xsl:with-param name="col" select="@col"/>
+                <xsl:with-param name="xtics.pos" select="number(@xtics.pos)"/>
+                <xsl:with-param name="xtics" select="$xtics"/>
+                <!--<xsl:with-param name="xtics.data.column__x3A__offset" select="$xtics.data.column__x3A__offset"/>-->
+            </xsl:call-template>
+            <xsl:call-template name="p5gnuplot:file.row.color">
+                <xsl:with-param name="col" select="@col"/><!-- @xtics.pos -->
+                <xsl:with-param name="graph.color.variable" select="$graph.color.variable"/>
+            </xsl:call-template>
+            <xsl:call-template name="p5gnuplot:file.row.yaxis">
+                <xsl:with-param name="col" select="@col"/><!-- @xtics.pos -->
+                <xsl:with-param name="system_cache__dita:graph.col__x3A__if_not_empty" select="system_cache__dita:graph.col__x3A__if_not_empty($graph.data,$ytics,@xtics.pos)"/>
+            </xsl:call-template>
+            
+            
+        </p5gnuplot:plot_arg>
+    </xsl:template>
+    
+    <xsl:template name="p5gnuplot:file.row.yaxis">
+        <xsl:param name="graph.yaxis" tunnel="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:param name="system_cache__dita:graph.col__x3A__if_not_empty" required="yes"/>
+        <xsl:choose>
+            <xsl:when test="$system_cache__dita:graph.col__x3A__if_not_empty">
+                <p5gnuplot:file.row.yaxis p5gnuplot:value="{system_cache__dita:graph.yaxis($graph.yaxis,$col)}" debug="#329-A - avilable data $system_cache__dita:graph.col__x3A__if_not_empty={$system_cache__dita:graph.col__x3A__if_not_empty}">
+                    <xsl:attribute name="p5gnuplot:text.join" select="' axes '"/>
+                    <xsl:attribute name="p5gnuplot:text" select="system_cache__dita:graph.yaxis($graph.yaxis,$col)"/>
+                    <xsl:call-template name="system_cache__dita:graph.yaxis">
+                        <xsl:with-param name="graph.yaxis" select="$graph.yaxis"/>
+                        <xsl:with-param name="col" select="$col"/>
+                    </xsl:call-template>
+                </p5gnuplot:file.row.yaxis>
+            </xsl:when>
+            <xsl:otherwise>
+                <p5gnuplot:file.row.yaxis debug="#329 - unavialble data $system_cache__dita:graph.col__x3A__if_not_empty={$system_cache__dita:graph.col__x3A__if_not_empty}" p5gnuplot:value="{system_cache__dita:graph.yaxis($graph.yaxis,$col)}">
+                </p5gnuplot:file.row.yaxis>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:template>
+    
+    <xsl:template name="p5gnuplot:file.row.title">
+        <xsl:param name="graph.fill.style" required="yes" tunnel="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <p5gnuplot:file.row.title >
+            <xsl:choose>
+                <xsl:when test="$graph.fill.style//stentry[ @col = $col]/contains(@props,'graph.notitle')">
+                    <xsl:attribute name="p5gnuplot:text.join" select="' '"/>
+                    <xsl:attribute name="p5gnuplot:text">noti col</xsl:attribute>
+                    <xsl:attribute name="p5gnuplot:value">no</xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="p5gnuplot:text.join" select="' '"/> 
+                    <xsl:attribute name="p5gnuplot:text">ti col</xsl:attribute>
+                    <xsl:attribute name="p5gnuplot:value">yes</xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+        </p5gnuplot:file.row.title>
+    </xsl:template>
+    
+    <xsl:template name="p5gnuplot:file.row.color">
+        <xsl:param name="graph.color.name" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.fill.style" required="yes" tunnel="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:param name="graph.color.variable" required="yes" tunnel="yes"/>
+        <p5gnuplot:file.row.color>
+            <xsl:choose>
+                <!--<xsl:when test="$graph.fill.style//stentry[ @col = $col]">
+                    <xsl:attribute name="debug">#177 ignoring color name due to set style for $col:<xsl:value-of select="$col"/></xsl:attribute>
+                    <xsl:message>#177 ignoring color name due to set style for $col:<xsl:value-of select="$col"/></xsl:message>
+                </xsl:when>-->
+                <xsl:when test="$graph.color.name//stentry[ @col = $col]/text()">
+                    <xsl:attribute name="p5gnuplot:text.join" select="' '"/>
+                    <xsl:attribute name="p5gnuplot:text">lc "<xsl:value-of select="$graph.color.name//stentry[ @col = $col]/text()"/>" </xsl:attribute>
+                    <xsl:attribute name="p5gnuplot:value" select="$graph.color.name//stentry[ @col = $col]/text()"/>
+                </xsl:when>
+                <xsl:when test="system_cache__dita:graph.ytics.color($graph.color.variable,$col) &gt;0">
+                    <xsl:attribute name="p5gnuplot:text.join" select="' '"/>
+                    <xsl:attribute name="p5gnuplot:text">lc variable </xsl:attribute>
+                    <xsl:attribute name="p5gnuplot:value" select="system_cache__dita:graph.ytics.color($graph.color.variable,$col)"/>
+                    <xsl:attribute name="p5gnuplot:depends" select="'contains(p5gnuplot:file.row.style/text(),with)'"/>
+                    <xsl:attribute name="debug">#177-293 set to variable color </xsl:attribute>
+                    <xsl:choose>
+                        <xsl:when test="$graph.fill.style//stentry[ @col = $col and contains(.,'with')]"/>
+                        <xsl:otherwise>
+                            <!--<p5gnuplot:file.row.style.override p5gnuplot:text.join=" " p5gnuplot:text=" with boxes " debug="#356 variable col"/>-->
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="debug"> not found declaration of color in $graph.color.name//stentry[ position() = $xtics.pos]/text()</xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+        </p5gnuplot:file.row.color>
+    </xsl:template>
+    
+    <xsl:template name="p5gnuplot:file.row.style">
+        <xsl:param name="graph.fill.style" required="yes" tunnel="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:param name="xtics.pos" required="yes"/>
+        <!--<xsl:param name="xtics.data.column__x3A__offset" tunnel="yes"/>-->
+        <xsl:param name="graph.color.variable"  tunnel="yes"/>
+        <xsl:param name="xtics"/>
+        <xsl:choose>
+            <xsl:when test="number(@graph.color.variable) &gt;0 and system_cache__dita:graph.xtics.color.column($xtics)=3 and not($graph.fill.style//stentry[matches( text(),'with')])">
+                <p5gnuplot:file.row.style.override p5gnuplot:text.join=" " p5gnuplot:text=" with boxes " debug="event #376-A"/>
+            </xsl:when>
+            <xsl:when test="number(@graph.color.variable) &gt;0  and not($graph.fill.style//stentry[matches( text(),'with')])">
+                <p5gnuplot:file.row.style.override p5gnuplot:text.join=" " p5gnuplot:text=" with boxes " debug="event #376-B"/>
+            </xsl:when>
+        </xsl:choose>
+        <p5gnuplot:file.row.style debug="$col={$col}; $xtics.pos={$xtics.pos} ">
+            <xsl:choose>
+                <xsl:when test="$graph.fill.style//stentry[ @col = $col]/text()">
+                    <xsl:attribute name="p5gnuplot:text.join" select="' '"/>
+                    <xsl:attribute name="p5gnuplot:text" select="replace($graph.fill.style//stentry[ @col = $col],'\$\{column\}',string($xtics.pos))"/><!-- +number($xtics.data.column__x3A__offset) -->
+                </xsl:when>
+                <!--<xsl:when test="system_cache__dita:graph.ytics.color($graph.color.variable,$col) &gt;0">
+                    <xsl:attribute name="p5gnuplot:text.join" select="' '"/>
+                    <xsl:attribute name="p5gnuplot:text" select="' with boxes '"/>
+                    <xsl:attribute name="debug">default boxes when system_cache__dita:graph.ytics.color($graph.color.variable,$col) &gt;0 </xsl:attribute>
+                </xsl:when>-->
+                <xsl:otherwise>
+                    <xsl:message terminate="no">#174 UNSET select="(strow|sthead)[ contains(@props,'graph.fill.style')]" </xsl:message>
+                </xsl:otherwise>
+            </xsl:choose>
+        </p5gnuplot:file.row.style>
+    </xsl:template>
+    
+    <xsl:function name="p5gnuplot:xtics.data.column__x3A__offset">
+        <xsl:value-of select="1"/>
+    </xsl:function>
+    
+    <xsl:function name="p5gnuplot:xtics.data.column__x3A__offset">
+        <xsl:param name="position"/>
+        <xsl:value-of select="$position+p5gnuplot:xtics.data.column__x3A__offset()"/>
+    </xsl:function>
+    
+    
+    <xsl:function name="p5gnuplot:xtics.count">
+        <xsl:param name="xtics"/>
+        <xsl:value-of select="max($xtics/xtics/text/number(@count))"/>
+    </xsl:function>
+    
+</xsl:stylesheet>

+ 111 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics__x3A__detect.xsl

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:function name="p5gnuplot:detect.histogram.groups__x3A__count">
+        <xsl:param name="graph.newhistogram"/>
+        <xsl:for-each-group select="$graph.newhistogram//stentry" group-by="text()">
+            <xsl:if test="position() = 1" >
+                <xsl:value-of select="last()"/> 
+            </xsl:if>
+        </xsl:for-each-group>
+        
+    </xsl:function>
+    
+    
+    <xsl:template name="p5gnuplot:detect.histogram">
+        <xsl:param name="fileindex" tunnel="yes" required="yes"/>
+        <xsl:param name="graph.fill.style" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.name" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.variable" required="yes" tunnel="yes"/>
+        <xsl:param name="xtics"  tunnel="yes"/>
+        <xsl:param name="graph.yaxis"  tunnel="yes"/>
+        <xsl:param name="p5gnuplot:graph.gnuplot.dat__x3A__suffix">.gnuplot.dat</xsl:param>
+        <xsl:param name="xtics.data.column__x3A__offset" select="1" />
+        <xsl:param name="p5gnuplot:font__x3A__size" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.data" required="yes" tunnel="yes"/>
+        <xsl:param name="ytics" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.newhistogram" required="yes" tunnel="yes"/>
+        <p5gnuplot:detect.histogram>
+            <xsl:attribute name="debug">
+                <xsl:text> @current-grouping-key.foreign[false]=[</xsl:text><xsl:for-each select="preceding::*[@current-grouping-key.foreign='false']">(</xsl:for-each><xsl:for-each select="following::*[@current-grouping-key.foreign='false']">)</xsl:for-each><xsl:text>]</xsl:text>
+                <xsl:text> @xtics.col__x3A__aviable=[</xsl:text><xsl:for-each select="preceding::*[@xtics.col__x3A__aviable]">(</xsl:for-each><xsl:for-each select="following::*[@xtics.col__x3A__aviable]">)</xsl:for-each><xsl:text>]</xsl:text>
+                <xsl:text> anchestors:[</xsl:text><xsl:for-each select="ancestor-or-self::*"> <xsl:value-of select="name()"/><xsl:text> </xsl:text></xsl:for-each><xsl:text>]</xsl:text>
+                <xsl:text> @p5gnuplot:detect.histogram.groups__x3A__count:[</xsl:text><xsl:value-of select="p5gnuplot:detect.histogram.groups__x3A__count($graph.newhistogram)"/><xsl:text>]</xsl:text>
+            </xsl:attribute>
+            <!-- graph.newhistogram[@xtics.col__x3A__not_aviable]|current-grouping-key[@xtics.col__x3A__not_aviable] -->
+        </p5gnuplot:detect.histogram>
+    </xsl:template>
+
+    <xsl:function name="system_cache__dita:graph.yaxis__x3A_validate__group">
+        <xsl:param name="xtics" required="yes"/>
+        <xsl:param name="current-grouping-key" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:choose>
+            <xsl:when test="$xtics/xtics/text[@current-grouping-key=$current-grouping-key]/current-grouping-key[@col=$col]">
+                <xsl:value-of select="true()"/>
+            </xsl:when>
+            <!--<xsl:otherwise>
+                error not found $current-grouping-key=<xsl:value-of select="$current-grouping-key"/> with $col=<xsl:value-of select="$col"/>
+            </xsl:otherwise>-->
+        </xsl:choose>
+    </xsl:function>
+    
+    
+    <xsl:function name="system_cache__dita:graph.yaxis.header.row__x3A_validate">
+        <xsl:param name="ytics" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <!--<xsl:param name="xtics.pos" required="yes"/>-->
+        <xsl:choose>
+            <xsl:when test="$ytics/ytics/ytics.row[@pos='1']/stentry[@col=$col ]">
+                <xsl:value-of select="true()"/>
+            </xsl:when>
+            
+        </xsl:choose>
+    </xsl:function>
+    
+    
+    
+    <xsl:function name="system_cache__dita:graph.col__x3A__if_not_empty">
+        <xsl:param name="graph.data"/>
+        <xsl:param name="ytics"/>
+        <xsl:param name="xtics.pos"/>
+        <!--<xsl:variable name="current-grouping-key" select="$ytics/ytics/ytics.row/stentry[@xtics.pos=$xtics.pos]/@current-grouping-key"/>-->
+        <!--<xsl:variable name="audience" select="$xtics/xtics/text[@pos=$xtics.pos]/@audience"/>-->
+        <!--<xsl:for-each select="$graph.data//stentry[@current-grouping-key=$current-grouping-key and @audience=$audience and not(text()='0')]"><xsl:value-of select="1"/></xsl:for-each>-->
+        <xsl:choose>
+            <xsl:when test="$ytics/ytics/ytics.row/stentry[@xtics.pos=$xtics.pos and number(@system_cache__dita:graph.data.col__x3A__value) &gt;0 ]">
+                <xsl:value-of select="1"/>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:function>
+    
+    <xsl:template name="system_cache__dita:graph.axis__x3A__validate">
+        <xsl:param name="graph.headers"/>
+        <xsl:param name="graph.title"/>
+        <xsl:choose>
+            <xsl:when test="count($graph.headers//stentry) = count($graph.title//stentry)">
+                <xsl:message>#33 [ V A L I D A T E ]  [ C O U N T ]  - [ OK ] (system_cache__dita:graph.axis__x3A__validate count($graph.headers//stentry) = count($graph.title//stentry))</xsl:message></xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="yes">#33 [ V A L I D A T E ]  [ C O U N T ]  - [ FAIL ] (system_cache__dita:graph.axis__x3A__validate count($graph.headers//stentry) = count($graph.title//stentry))
+                    @id = <xsl:value-of select="@id"/>
+                    c/$graph.headers = <xsl:value-of select="count($graph.headers//stentry)"/>
+                    c/$graph.title = <xsl:value-of select="count($graph.title//stentry)"/>
+                </xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 67 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics__x3A__plot.xsl

@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="text()|comment()"/>
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="p5gnuplot:graph.newhistogram">
+        <xsl:text>#20 mode="p5gnuplot:graph.newhistogram__x3A__plot" match </xsl:text><xsl:value-of select="name()"/><xsl:text>
+            
+</xsl:text>
+        <xsl:apply-templates mode="#current" select="@*"/>
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>
+    
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="p5gnuplot:plot">
+        <!--<xsl:text>#25 mode="p5gnuplot:graph.newhistogram__x3A__plot" match </xsl:text><xsl:value-of select="name()"/><xsl:text></xsl:text>-->
+        <!--<xsl:apply-templates mode="#current" select="@*"/>-->
+        <!--<xsl:apply-templates mode="#current"/>-->
+    </xsl:template>
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="p5gnuplot:plot[descendant::p5gnuplot:file]">
+        <!--<xsl:text>#25 mode="p5gnuplot:graph.newhistogram__x3A__plot" match </xsl:text><xsl:value-of select="name()"/><xsl:text></xsl:text>-->
+        <xsl:apply-templates mode="#current" select="@*"/>
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>
+    
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="p5gnuplot:set.xtics.rotate">
+        <xsl:apply-templates mode="#current" select="@*"/>
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="p5gnuplot:newhistogram">
+        <!--<xsl:text>#25 mode="p5gnuplot:graph.newhistogram__x3A__plot" match </xsl:text><xsl:value-of select="name()"/>-->
+        <xsl:apply-templates mode="#current" select="@*"/>
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="*">
+        <xsl:apply-templates mode="#current" select="@*"/>
+        <xsl:apply-templates mode="#current"/>
+    </xsl:template>
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="@*"/>
+    
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="@p5gnuplot:text|@p5gnuplot:text.join">
+        <xsl:value-of select="."/>
+    </xsl:template>
+    <xsl:template mode="p5gnuplot:graph.newhistogram__x3A__plot" match="@p5gnuplot:text.line.join">
+        <xsl:value-of select="."/>\<xsl:text>
+</xsl:text>
+        
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 112 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics__x3A__set.xsl

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    
+
+    
+    
+<xsl:template name="p5gnuplot:set.xtics.rotate">
+<xsl:param name="xtics" tunnel="yes"/>
+<p5gnuplot:set.xtics.rotate>
+    <xsl:choose>
+        <xsl:when test="system_cache__dita:graph.xtics.color.column($xtics)=3 or count(descendant::audience)=1 or count(descendant::p5gnuplot:plot[@p5gnuplot:text]) &lt;= 1">
+            <xsl:attribute name="p5gnuplot:text.join"><xsl:text>
+</xsl:text></xsl:attribute>
+            <xsl:attribute name="p5gnuplot:text">set xtics rotate</xsl:attribute>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:attribute name="debug"> not set set xtics rotate due to not system_cache__dita:graph.xtics.color.column($xtics)=3</xsl:attribute>
+        </xsl:otherwise>
+    </xsl:choose>
+</p5gnuplot:set.xtics.rotate>
+</xsl:template> 
+    
+    <xsl:template name="p5gnuplot:set.key">
+        <xsl:param name="xtics" tunnel="yes"/>
+        <p5gnuplot:set.key>
+            <xsl:choose>
+                <xsl:when test="system_cache__dita:graph.xtics.color.column($xtics)=3 and p5gnuplot:xtics.count($xtics) &lt;3">
+                    <xsl:attribute name="p5gnuplot:text.join"><xsl:text>
+</xsl:text></xsl:attribute>
+                    <xsl:attribute name="p5gnuplot:text">set key spacing 2 bottom left inside</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="p5gnuplot:xtics.count($xtics) &gt;=2"><!-- system_cache__dita:graph.xtics.color.column($xtics)=3 and  -->
+                    <xsl:attribute name="p5gnuplot:text.join"><xsl:text>
+</xsl:text></xsl:attribute>
+                    <xsl:attribute name="p5gnuplot:text">set key spacing 2 bottom left outside font ",10"  height -4 </xsl:attribute>
+                </xsl:when>
+                <xsl:when test=" count(descendant::audience)&gt;1"><!-- system_cache__dita:graph.xtics.color.column($xtics)=3 or -->
+                    <xsl:attribute name="p5gnuplot:text.join"><xsl:text>
+</xsl:text></xsl:attribute>
+                    <xsl:attribute name="p5gnuplot:text">set key spacing 2 bottom left outside font ",10"  height -4 </xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="debug"> #42 used todo improve cond p5gnuplot:xtics.count($xtics)=<xsl:value-of select="p5gnuplot:xtics.count($xtics)"/>; system_cache__dita:graph.xtics.color.column($xtics)=<xsl:value-of select="system_cache__dita:graph.xtics.color.column($xtics)"/>; count(descendant::current-grouping-key[@p5gnuplot:text])=<xsl:value-of select="count(descendant::current-grouping-key)"/>;</xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+        </p5gnuplot:set.key>
+    </xsl:template>
+    
+    <xsl:function name="p5gnuplot:set.bmargin">
+        <xsl:param name="p5gnuplot:font__x3A__size"/>
+        <xsl:param name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size"/>
+        <xsl:param name="system_cache__dita:graph.lingstring__x3A__break.size"/>
+        <xsl:choose>
+            <xsl:when test="number($p5gnuplot:font__x3A__size) and number($p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size) and number($system_cache__dita:graph.lingstring__x3A__break.size)">
+                <xsl:value-of select="round((number($p5gnuplot:font__x3A__size) + (number($system_cache__dita:graph.lingstring__x3A__break.size))*1.4) div 2)"/>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:function>   
+    
+<xsl:template name="p5gnuplot:set.bmargin">
+<xsl:param name="p5gnuplot:font__x3A__size" tunnel="yes"/>
+<xsl:param name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size" tunnel="yes"/>
+<xsl:param name="system_cache__dita:graph.lingstring__x3A__break.size"  tunnel="yes"/>
+<p5gnuplot:set.bmargin>
+    <xsl:choose>
+        <xsl:when test="p5gnuplot:set.bmargin($p5gnuplot:font__x3A__size,$p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size,$system_cache__dita:graph.lingstring__x3A__break.size)&gt;0">
+            <xsl:attribute name="p5gnuplot:text.join"><xsl:text>
+</xsl:text></xsl:attribute>
+            <xsl:attribute name="p5gnuplot:text">set bmargin <xsl:value-of select="p5gnuplot:set.bmargin($p5gnuplot:font__x3A__size,$p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size,$system_cache__dita:graph.lingstring__x3A__break.size)"/></xsl:attribute>
+            <xsl:attribute name="p5gnuplot:value" select="p5gnuplot:set.bmargin($p5gnuplot:font__x3A__size,$p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size,$system_cache__dita:graph.lingstring__x3A__break.size)"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:attribute name="debug"> set todo testing var == $p5gnuplot:font__x3A__size + $system_cache__dita:graph.lingstring__x3A__break.size div 2</xsl:attribute>
+        </xsl:otherwise>
+    </xsl:choose>
+</p5gnuplot:set.bmargin>
+</xsl:template>
+    
+    <xsl:template name="p5gnuplot:set.yrange">
+        <xsl:param name="ytics"  tunnel="yes" required="yes"/>
+        <p5gnuplot:set.yrange>
+            
+            <xsl:choose>
+                <xsl:when test="$ytics//stentry[ @system_cache__dita:graph.yaxis.value='1' ]/@system_cache__dita:graph.data.col__x3A__value">
+                    <xsl:attribute name="p5gnuplot:text.join"><xsl:text>
+</xsl:text></xsl:attribute>
+                    <xsl:attribute name="p5gnuplot:text">set yrange [0:<xsl:value-of select="max($ytics//stentry[ @system_cache__dita:graph.yaxis.value='1' ]/number(@system_cache__dita:graph.data.col__x3A__value))"/>] </xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="debug">#106 </xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+        </p5gnuplot:set.yrange>
+    </xsl:template>
+    
+    
+    
+</xsl:stylesheet>

+ 56 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.color.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:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:template name="system_cache__dita:graph.ytics.color">
+        <xsl:param name="graph.color.variable" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:choose>
+            <xsl:when test="$graph.color.variable//stentry[@col=$col]/text()">
+                <xsl:attribute name="graph.color.variable" select="$graph.color.variable//stentry[@col=$col]/text()"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="graph.color.variable" select="0"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:function name="system_cache__dita:graph.ytics.color">
+        <xsl:param name="graph.color.variable" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:variable name="out">
+            <out>
+                <xsl:call-template name="system_cache__dita:graph.ytics.color">
+                    <xsl:with-param name="graph.color.variable" select="$graph.color.variable"/>
+                    <xsl:with-param name="col" select="$col"/>
+                </xsl:call-template>
+            </out>
+        </xsl:variable>
+        <xsl:value-of select="$out//out/@graph.color.variable"/>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:graph.xtics.color.column">
+        <xsl:param name="xtics"/>
+        <xsl:choose >
+            <xsl:when test="$xtics//text/@pos">
+                <xsl:value-of select="max($xtics//text/number(@pos))+2"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="yes">#37 incorrect format of $xtics//text/number(@pos)) </xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:function>
+    
+</xsl:stylesheet>

+ 53 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.xaxis.xsl

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    
+    
+    <xsl:function name="system_cache__dita:graph.xaxis">
+        <xsl:param name="graph.headers" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:choose>
+            <xsl:when test="$graph.headers//stentry[@col=$col]/text()">
+                <xsl:value-of select="$graph.headers//stentry[@col=$col]/text()"/>
+            </xsl:when>
+            <xsl:otherwise><!-- TODO     -->
+                <xsl:message terminate="no">#27 error no $graph.headers//stentry[@col=$col]/text() = $col=<xsl:value-of select="$col"/> </xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:function>
+    
+    
+    
+    <xsl:template name="p5gnuplot:file.row.x.cluster.offset">
+        <xsl:param name="fileindex" tunnel="yes" required="yes"/>
+        <xsl:param name="graph.fill.style" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.name" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.color.variable" required="yes" tunnel="yes"/>
+        <xsl:param name="xtics"  tunnel="yes"/>
+        <xsl:param name="graph.yaxis"  tunnel="yes"/>
+        <xsl:param name="p5gnuplot:graph.gnuplot.dat__x3A__suffix">.gnuplot.dat</xsl:param>
+        <xsl:param name="xtics.data.column__x3A__offset" select="1" />
+        <xsl:param name="p5gnuplot:font__x3A__size" required="yes" tunnel="yes"/>
+        <xsl:param name="graph.data" required="yes" tunnel="yes"/>
+        <xsl:param name="ytics" required="yes" tunnel="yes"/>
+        <p5gnuplot:file.row.x.cluster.offset debug="to offset (1-0.4) etc when in clusters ">
+            
+        </p5gnuplot:file.row.x.cluster.offset>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 373 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.xsl

@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:include href="graph_gnuplotdat.row__x3A__from__ytics.color.xsl"/>
+    <xsl:include href="graph_gnuplotdat.row__x3A__from__ytics.yaxis.xsl"/>
+    <xsl:include href="graph_gnuplotdat.row__x3A__from__ytics.xaxis.xsl"/>
+    <xsl:include href="graph_gnuplotdat.row__x3A__from__xtics.header.xsl"/>
+    
+    <xsl:template name="system_cache__dita:graph.ytics">
+        <xsl:param name="system_cache__dita:graph.title" required="yes"/>
+        <xsl:param name="graph.color.variable" required="yes" />
+        <xsl:param name="graph.yaxis" required="yes"/>
+        <xsl:param name="graph.data" required="yes"/>
+        <!--<xsl:param name="xtics" required="yes"/>-->
+        <ytics>
+            <xsl:choose>
+                <xsl:when test="$system_cache__dita:graph.title//stentry/@current-grouping-key">
+                    <xsl:for-each-group select="$system_cache__dita:graph.title//stentry" group-by="@current-grouping-key">
+                        <ytics.row current-grouping-key="{@current-grouping-key}" pos="{position()}" count="{count(current-group())}">
+                            <xsl:for-each select="current-group()">
+                                <xsl:copy>
+                                    <xsl:copy-of select="@group"/>
+                                    <xsl:copy-of select="@col"/>
+                                    <xsl:copy-of select="@audience"/>
+                                    <xsl:attribute name="xtics.pos" select="p5gnuplot:xtics.data.column__x3A__offset(position())"/>
+                                    <xsl:attribute name="system_cache__dita:graph.yaxis.value" select="system_cache__dita:graph.yaxis.value($graph.yaxis,@col)"/>
+                                    <xsl:attribute name="system_cache__dita:graph.data.col__x3A__value" select="$graph.data//stentry[@col=current()/@col]/text()"/>
+                                    <xsl:call-template name="system_cache__dita:graph.ytics.color">
+                                        <xsl:with-param name="graph.color.variable" select="$graph.color.variable"/>
+                                        <xsl:with-param name="col" select="@col"/>
+                                    </xsl:call-template>
+                                    <xsl:copy-of select="text()"/>
+                                </xsl:copy>
+                            </xsl:for-each>
+                        </ytics.row>
+                    </xsl:for-each-group>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:message>#34 WARNING NOT SET $graph.title//stentry/@current-grouping-key - using 3 columns ideas</xsl:message>
+                    <xsl:for-each-group select="$system_cache__dita:graph.title//stentry" group-by="text()">
+                        <ytics.row current-grouping-key="{current-grouping-key()}" pos="{position()}" count="{count(current-group())}">
+                            <xsl:for-each select="current-group()">
+                                <xsl:copy>
+                                    <xsl:copy-of select="@group"/>
+                                    <xsl:copy-of select="@col"/>
+                                    <xsl:attribute name="xtics.pos" select="p5gnuplot:xtics.data.column__x3A__offset(position())"/>
+                                    <xsl:attribute name="system_cache__dita:graph.yaxis.value" select="system_cache__dita:graph.yaxis.value($graph.yaxis,@col)"/>
+                                    <xsl:call-template name="system_cache__dita:graph.ytics.color">
+                                        <xsl:with-param name="graph.color.variable" select="$graph.color.variable"/>
+                                        <xsl:with-param name="col" select="@col"/>
+                                    </xsl:call-template>
+                                    <xsl:copy-of select="text()"/>
+                                </xsl:copy>
+                            </xsl:for-each>
+                        </ytics.row>
+                    </xsl:for-each-group>
+                </xsl:otherwise>
+            </xsl:choose>
+        </ytics>
+    </xsl:template>
+    
+    <xsl:template name="system_cache__dita:graph.stats">
+        <xsl:param name="ytics" required="yes"/>
+        <stats>
+            <xsl:for-each-group select="$ytics/ytics[1]/ytics.row/stentry" group-by="text()">
+                <xsl:variable name="curr.pos" select="position()"/>
+                <xsl:for-each select="current-group()">
+                    <xsl:copy >
+                        <xsl:attribute name="pos" select="$curr.pos"/>
+                        <xsl:copy-of select="@col"/>
+                        <xsl:copy-of select="current-group()/parent::ytics.row/@current-grouping-key"/>
+                        <xsl:copy-of select="text()"/>
+                    </xsl:copy>
+                </xsl:for-each>
+            </xsl:for-each-group>
+        </stats>
+    </xsl:template>
+    
+    
+    
+    
+    
+    
+    
+    <xsl:template name="system_cache__dita:graph.dat.row__x3A__from__ytics">
+        <xsl:param name="ytics" required="yes"/>
+        <xsl:param name="ylabel" required="yes"/>
+        <xsl:param name="graph.headers" required="yes"/>
+        <xsl:param name="graph.data" required="yes"/>
+        <xsl:param name="graph.color.variable" required="yes"/>
+        <xsl:param name="graph.title" required="yes"/>
+        <xsl:param name="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size" required="yes"/>
+        <xsl:param name="system_cache__dita:graph.lingstring__x3A__break.size" required="yes"/>
+            <xsl:value-of select="$ylabel"/><xsl:text>&#09;</xsl:text>
+        <xsl:variable name="graph.data.rows" select="max($graph.data//stentry/number(@col))"/>
+        <!--<xsl:comment>#22 graph.data.rows=<xsl:value-of select="$graph.data.rows"/>;</xsl:comment>-->
+        <xsl:for-each-group select="$ytics/ytics[1]/ytics.row/stentry" group-by="text()">
+            <!--<xsl:sort select="stentry/number(@col)" order="ascending" data-type="number"/>-->
+            <xsl:choose>
+                <xsl:when test="position()=1 or 1=1">
+                    <!--<xsl:text>ROW</xsl:text>-->
+                    <!--<xsl:for-each select="stentry">-->
+                    <!--<xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(system_cache__dita:graph.ytics.header($ytics,@col))"/>-->
+                    <xsl:value-of select="system_cache__dita:graph.lingstring__x3A__break(p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(system_cache__dita:graph.yaxis.name($graph.title,@col)),$system_cache__dita:graph.lingstring__x3A__break.size)"/><xsl:text>&#09;</xsl:text>
+                    <!--<xsl:choose>
+                        <xsl:when test="contains(text(),'&quot;')"><xsl:value-of select="text()"/><xsl:text>&#09;</xsl:text></xsl:when>
+                        <xsl:otherwise><xsl:text>"</xsl:text><xsl:value-of select="text()"/><xsl:text>"&#09;</xsl:text></xsl:otherwise>
+                    </xsl:choose>-->
+                    <!--</xsl:for-each>-->
+                </xsl:when>
+            </xsl:choose>
+            <xsl:if test="position() = last() and $graph.color.variable/*"><xsl:text>"color"&#09;</xsl:text></xsl:if>
+        </xsl:for-each-group>
+        
+        <xsl:for-each-group select="$ytics/ytics[1]/ytics.row" group-by="@current-grouping-key">
+            <xsl:text>&#10;</xsl:text>
+            <!--<xsl:sort select="stentry/number(@col)" order="ascending" data-type="number"/>-->
+            <xsl:for-each select="stentry">
+                <xsl:if test="not(@col)"><xsl:message terminate="no">#111 ERORR no @col attrs aviable for <xsl:value-of select="."/>; @id:<xsl:value-of select="ancestor::simpletable/@id"/>;</xsl:message></xsl:if>
+                <xsl:if test="position() = 1">
+                    <!--<xsl:value-of select="p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(current-grouping-key())"/><xsl:text>&#09;</xsl:text>-->
+                    <xsl:value-of select="system_cache__dita:graph.lingstring__x3A__break(p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names(system_cache__dita:graph.xaxis($graph.headers,@col),$p5gnuplot:system_cache__dita__x3A__fix__x3A__axis__x3A__names.size),$system_cache__dita:graph.lingstring__x3A__break.size)"/><xsl:text>&#09;</xsl:text>
+                </xsl:if>
+            </xsl:for-each>
+            <xsl:variable name="ytics.path.row">
+                <ytics.path.row current-grouping-key="{current-grouping-key()}">
+                    <xsl:for-each select="current-group()//stentry">
+                        <xsl:copy>
+                            <xsl:copy-of select="@col"/>
+                            <xsl:copy-of select="text()"/>
+                        </xsl:copy>
+                    </xsl:for-each>
+                </ytics.path.row>
+            </xsl:variable>
+            <!--<xsl:text></xsl:text><xsl:value-of select="position()"/>-->
+            <!--<xsl:copy-of select="$ytics.path.row"></xsl:copy-of>-->
+            <xsl:call-template name="system_cache__dita:graph.dat.row__x3A__from__ytics.path.row">
+                <xsl:with-param name="graph.data" select="$graph.data"/>
+                <xsl:with-param name="ytics.path.row" select="$ytics.path.row"/>
+                <xsl:with-param name="current-grouping-key" select="current-grouping-key()"/>
+                <xsl:with-param name="ytics" select="$ytics"/>
+                <xsl:with-param name="graph.color.variable" select="$graph.color.variable"/>
+                <xsl:with-param name="ytics.row.position" select="position()"/>
+                <xsl:with-param name="system_cache__dita:graph.lingstring__x3A__break.size" select="$system_cache__dita:graph.lingstring__x3A__break.size"/>
+            </xsl:call-template>
+        </xsl:for-each-group>
+        <!--<xsl:text>&#10;EOL</xsl:text>-->
+        <!--<xsl:text>EOF system_cache__dita:graph.dat.row__x3A__from__ytics </xsl:text><xsl:value-of select="position()"/><xsl:text>.</xsl:text>-->
+    </xsl:template>
+    
+    
+    <xsl:template name="system_cache__dita:graph.newhistogram">
+        <xsl:param name="graph.newhistogram" required="yes"/>
+        <newhistogram>
+            <xsl:for-each-group select="$graph.newhistogram//stentry" group-by="text()">
+                <text count="{count(current-group())}">
+                    <xsl:copy-of select="@*"/>
+                    <xsl:value-of select="text()"/>
+                </text>
+            </xsl:for-each-group>
+        </newhistogram>
+    </xsl:template>
+    
+    <xsl:template name="system_cache__dita:graph.dat.row__x3A__from__ytics.path.row">
+        <xsl:param name="ytics.path.row" required="yes"/>
+        <xsl:param name="graph.data" required="yes"/>
+        <xsl:param name="ytics" required="yes"/>
+        <xsl:param name="current-grouping-key" required="yes"/>
+        <xsl:param name="graph.color.variable" required="yes"/>
+        <xsl:param name="ytics.row.position" required="yes"/>
+        <xsl:param name="system_cache__dita:graph.lingstring__x3A__break.size" required="yes"/>
+        <!--<xsl:for-each select="$ytics.path.row//stentry">
+            <!-\-<xsl:variable name="row.pos" select="position()"/>-\->
+            <!-\-<xsl:variable name="row.current" select="."/>-\->
+        </xsl:for-each>-->
+        <!--<xsl:variable name="current-grouping-key" select="$ytics.path.row/parent::*/@current-grouping-key"/>-->
+        <xsl:variable name="test_offset">
+            <test_offset>
+                <xsl:for-each-group select="$ytics/ytics[1]/ytics.row/stentry" group-by="text()">
+                    <xsl:for-each select="current-group()">
+                        <xsl:copy >
+                            <xsl:attribute name="pos" select="position()"/>
+                            <xsl:copy-of select="@col"/>
+                            <xsl:call-template name="system_cache__dita:graph.ytics.color">
+                                <xsl:with-param name="graph.color.variable" select="$graph.color.variable"/>
+                                <xsl:with-param name="col" select="$ytics.row.position"/>
+                            </xsl:call-template>
+                            <!--<xsl:copy-of select="@graph.color.variable"/>-->
+                            <xsl:copy-of select="text()"/>
+                        </xsl:copy>
+                    </xsl:for-each>
+                </xsl:for-each-group>
+            </test_offset>
+        </xsl:variable>
+        <xsl:variable name="test_offset">
+            <test_offset debug="matryca_all">
+                <xsl:for-each-group select="$test_offset//stentry" group-by="text()">
+                    <xsl:copy>
+                        <xsl:copy-of select="@*"/>
+                        <xsl:attribute name="row.placed" select="position()"/>
+                        <xsl:copy-of select="text()"/>
+                    </xsl:copy>
+                </xsl:for-each-group>
+            </test_offset>
+        </xsl:variable>
+        <xsl:variable name="ytics.path.row.current">
+            <ytics.path.row.current debug="sorted to fix">
+                <xsl:for-each select="$ytics.path.row//stentry">
+                    <xsl:copy>
+                        <xsl:copy-of select="@*"/>
+                        <xsl:attribute name="row.placed" select="position()"/>
+                        <xsl:copy-of select="text()"/>
+                    </xsl:copy>
+                </xsl:for-each>
+            </ytics.path.row.current>
+        </xsl:variable>
+        <!--<xsl:if test="$row.pos=1">-->
+            <!--<xsl:copy-of select="$ytics.path.row"/>-->
+            <!--<xsl:copy-of select="$test_offset"/>-->
+            <!--<xsl:copy-of select="$ytics.path.row.current"/>-->
+        <!--</xsl:if>-->
+        <!--<MERGING cnt_src="{count($test_offset//stentry)}" cnt_dst="{count($ytics.path.row.current//stentry)}">-->
+            <xsl:for-each select="$test_offset//stentry">
+                <xsl:variable name="test_y" select="text()"/>
+                <!--<xsl:if test="position() = 1"><xsl:text>&#09;</xsl:text>
+                    <xsl:text></xsl:text><xsl:value-of select="$current-grouping-key"/><xsl:text>&#09;</xsl:text>
+                </xsl:if>-->
+                <xsl:choose>
+                    <xsl:when test="$ytics.path.row.current//stentry[ text() = $test_y][2]">
+                        <xsl:message terminate="yes">#222-234 incorrect - not unique graph.title vals - found cnt(<xsl:value-of select="count($ytics.path.row.current//stentry[ text() = $test_y])"/>) [[<xsl:value-of select="$ytics.path.row.current//stentry[ text() = $test_y]"/>]] </xsl:message>
+                    </xsl:when>
+                    <xsl:when test="$ytics.path.row.current//stentry[ text() = $test_y]/text()">
+                        <xsl:variable name="target.value.column"  select="$ytics//stentry[ text() = $test_y and @current-grouping-key = $current-grouping-key]/@col"/>
+                        <xsl:variable name="target.value.column.rev"  select="$ytics.path.row//stentry[ text() = $test_y]/@col"/>
+                        <xsl:choose>
+                            <xsl:when test="string-length($current-grouping-key)=0 and string-length($target.value.column.rev) &gt;0">
+                                <xsl:message>#222-210 not used $current-grouping-key; $target.value.column=<xsl:value-of select="$target.value.column"/>; $target.value.column.rev=<xsl:value-of select="$target.value.column.rev"/>; resolved=[<xsl:value-of select="$graph.data//stentry[@col=$target.value.column.rev ]/text()"/>]</xsl:message>
+                                <xsl:text></xsl:text><xsl:value-of select="$graph.data//stentry[@col=$target.value.column.rev ]/text()"/><xsl:text>&#09;</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="$graph.data//stentry[@col=$target.value.column]/text()">
+                                <xsl:text></xsl:text><xsl:value-of select="$graph.data//stentry[@col=$target.value.column and @current-grouping-key=$current-grouping-key]/text()"/><xsl:text>&#09;</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="$graph.data//stentry[@col=$target.value.column.rev]/text()">
+                                <xsl:message>#222-215 (pos(<xsl:value-of select="position()"/>)) resolved $target.value.column.rev = <xsl:value-of select="$target.value.column.rev"/>; ($target.value.column = <xsl:value-of select="$target.value.column"/>; ) dla $test_y=<xsl:value-of select="$test_y"/>; - resolving target=[<xsl:value-of select="$graph.data//stentry[@col=$target.value.column.rev and @current-grouping-key=$current-grouping-key]/text()"/>] ; @current-grouping-key=[<xsl:value-of select="$current-grouping-key"/>]</xsl:message>
+                                <xsl:text></xsl:text><xsl:value-of select="$graph.data//stentry[@col=$target.value.column.rev and @current-grouping-key=$current-grouping-key]/text()"/><xsl:text>&#09;</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="string-length($target.value.column)=0">
+                                <xsl:message terminate="no">#222-208 error resolving target.value.column for text="<xsl:value-of select="$test_y"/>" ; $target.value.column.rev=<xsl:value-of select="$target.value.column.rev"/></xsl:message>
+                                <xsl:text></xsl:text><xsl:value-of select="$graph.data//stentry[@current-grouping-key=$current-grouping-key]/text()"/><xsl:text>&#09;</xsl:text>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:message>#222-otherwise error</xsl:message>
+                            </xsl:otherwise>
+                            <!-- TODO COLUMNS -->
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:text>0</xsl:text><xsl:text>&#09;</xsl:text>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <xsl:if test="position() = last() and $graph.color.variable/*"><xsl:value-of select="@graph.color.variable"/><xsl:text>&#09;</xsl:text></xsl:if>
+            </xsl:for-each>
+        <!--</MERGING>-->
+    </xsl:template>
+    
+    
+    <xsl:template name="system_cache__dita:graph.gnuplot__x3A__from_ytics">
+        <xsl:param name="ytics" required="yes"/>
+        <xsl:param name="ylabel" required="yes"/>
+        <xsl:param name="graph.headers" required="yes"/>
+        <xsl:param name="graph.data" required="yes"/>
+        <xsl:param name="fileindex" required="yes"/>
+        <xsl:param name="xtics" required="yes"/>
+        <xsl:param name="graph.fill.style" required="yes"/>
+        <xsl:param name="newhistogram" required="yes"/>
+        <xsl:param name="graph.newhistogram" required="yes"/>
+        <xsl:param name="graph.color.name" required="yes"/>
+        
+        <!--<xsl:param name="xtics.cols" required="yes"/>-->
+        <!--<system_cache__dita:graph.gnuplot__x3A__from_ytics>-->
+        <xsl:choose>
+            <xsl:when test="$xtics//p5gnuplot:graph.newhistogram">
+                <xsl:message>#273 parsing graph via template p5gnuplot:graph.newhistogram</xsl:message>
+                <xsl:apply-templates mode="p5gnuplot:graph.newhistogram__x3A__plot" select="$xtics//p5gnuplot:graph.newhistogram"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:for-each select="1 to xs:integer(count($xtics//text))">
+                    <xsl:variable name="xtics.pos" select="xs:integer(.)"/>
+                    <!--<xsl:variable name="xtics.pos.current" select="$xtics.cols//pos[number(@xtics.pos)=$xtics.pos]" />--><!-- select="$xtics.cols//pos[number(@xtics.pos)=$xtics.pos]" -->
+                    <!--<xsl:variable name="graph.title.position.calc" select="$xtics.cols//pos[number(@xtics.pos) = $xtics.pos ][1]/number(@graph.title.position)" />--><!-- $xtics.cols//pos[number(@xtics.pos) = $xtics.pos ][1]/number(@graph.title.position) -->
+                    <!--<xsl:variable name="newhistogram.count" >
+                    <newhistogram.count>
+                        <xsl:for-each select="$newhistogram//text">
+                            <xsl:variable name="cur.pos" select="position()"/>
+                            <xsl:choose>
+                                <xsl:when test="sum($newhistogram//text[position() &lt;= $cur.pos]/number(@count)) &gt;=$xtics.pos">
+                                    <pos pos="{$cur.pos}"><xsl:value-of select="sum($newhistogram//text[position() &lt;= $cur.pos]/number(@count))"/></pos>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:for-each>
+                    </newhistogram.count>
+                </xsl:variable>-->
+                    
+                    <!--<xsl:variable name="newhistogram.count.pos" select="$newhistogram.count//pos[1]/@pos"/>-->
+                    <!--<xsl:variable name="newhistogram.count" select="min($newhistogram.count//pos)"/>-->
+                    <xsl:choose>
+                        <xsl:when test="$graph.newhistogram//stentry and $xtics.pos=1">
+                            <xsl:text>
+plot newhistogram "</xsl:text><xsl:value-of select="$xtics//text[number(@pos)=$xtics.pos]/@audience"/><xsl:text>" , \</xsl:text><!-- $newhistogram//text[position() = ceiling(count($newhistogram//text) div $xtics.pos)]/text()" -->
+                            <xsl:text>
+"</xsl:text><xsl:value-of select="$fileindex"/><xsl:text>.gnuplot.dat"</xsl:text> 
+                        </xsl:when>
+                        <xsl:when test="$graph.newhistogram//stentry and ( not($xtics//text[number(@pos)=$xtics.pos]/@audience = $xtics//text[number(@pos)=($xtics.pos - 1)]/@audience ) )"><!--  $xtics.pos = $newhistogram.count  mod $newhistogram.countcount($newhistogram//text) -->
+                            <xsl:text>, \
+newhistogram "</xsl:text><xsl:value-of select="$xtics//text[number(@pos)=$xtics.pos]/@audience"/><xsl:text>"  \<!-- <xsl:value-of select="$newhistogram//text[position() = $newhistogram.count.pos ]/text()"/> --><!-- ceiling(count($newhistogram//text) div $xtics.pos -->
+</xsl:text>                            
+                        </xsl:when>
+                        <xsl:when test="$xtics.pos = 1">
+                            <xsl:text>
+plot "</xsl:text><xsl:value-of select="$fileindex"/><xsl:text>.gnuplot.dat"</xsl:text> 
+                        </xsl:when>
+                        <xsl:otherwise/>
+                    </xsl:choose>
+                    <xsl:choose>
+                        <xsl:when test="position()=1"/>
+                        <xsl:otherwise><xsl:text> , "" </xsl:text></xsl:otherwise>
+                    </xsl:choose>
+                    <!-- <xsl:text>test </xsl:text><xsl:text>? \
+                            
+                        </xsl:text><xsl:value-of select="$xtics.pos mod $newhistogram.count "/> # <xsl:value-of select="$xtics.pos"/>-\-nc<xsl:value-of select="$newhistogram.count"/><xsl:text>? </xsl:text>-->
+                    <xsl:text> using </xsl:text><xsl:value-of select="$xtics.pos+1"/><xsl:text>:xtic(1) </xsl:text>
+                    <xsl:choose>
+                        <xsl:when test="$graph.fill.style//stentry[ position() = $xtics.pos]/contains(@props,'graph.notitle')"><xsl:text>noti</xsl:text></xsl:when>
+                        <xsl:otherwise><xsl:text>ti</xsl:text></xsl:otherwise>
+                    </xsl:choose>
+                    <xsl:text> col </xsl:text>
+                    <xsl:choose>
+                        <xsl:when test="$graph.color.name//stentry[ position() = $xtics.pos]/text()">
+                            <xsl:text>lc "</xsl:text><xsl:value-of select="$graph.color.name//stentry[ position() = $xtics.pos]/text()"/><xsl:text>" </xsl:text>
+                        </xsl:when>
+                    </xsl:choose>
+                    <xsl:choose>
+                        <xsl:when test="$graph.fill.style//stentry[ position() = $xtics.pos]">
+                            <xsl:value-of select="replace($graph.fill.style//stentry[ position() = $xtics.pos],'\$\{column\}',string($xtics.pos+1))"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:message terminate="yes">#174 UNSET select="(strow|sthead)[ contains(@props,'graph.fill.style')]" </xsl:message>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                    <xsl:text>&#09;</xsl:text>
+                </xsl:for-each> 
+            </xsl:otherwise>
+        </xsl:choose>
+        
+        <!--</system_cache__dita:graph.gnuplot__x3A__from_ytics>-->
+        
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 105 - 0
SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.yaxis.xsl

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:p5gnuplot="http://biuro.biall-net.pl/WPS_Functions/graph_gnuplot"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_UMOWY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_UMOWY"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:template name="system_cache__dita:graph.yaxis">
+        <xsl:param name="graph.yaxis" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:choose>
+            <xsl:when test="$graph.yaxis//stentry[@col=$col]/text()">
+                <xsl:attribute name="graph.yaxis" select="concat('x1y',$graph.yaxis//stentry[@col=$col]/text())"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="graph.yaxis" select="'x1y1'"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:function name="system_cache__dita:graph.yaxis.value">
+        <xsl:param name="graph.yaxis"/>
+        <xsl:param name="col"/>
+        <xsl:choose>
+            <xsl:when test="$graph.yaxis//stentry[@col=$col]/text()">
+                <xsl:value-of select="$graph.yaxis//stentry[@col=$col]/text()"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="'1'"/>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:graph.yaxis">
+        <xsl:param name="graph.yaxis" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:variable name="out">
+            <out>
+                <xsl:call-template name="system_cache__dita:graph.yaxis">
+                    <xsl:with-param name="graph.yaxis" select="$graph.yaxis"/>
+                    <xsl:with-param name="col" select="$col"/>
+                </xsl:call-template>
+            </out>
+        </xsl:variable>
+        <xsl:value-of select="$out//out/@graph.yaxis"/>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:graph.yaxis.name">
+        <xsl:param name="graph.title" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        <xsl:choose>
+            <xsl:when test="$graph.title//stentry[@col=$col]/@group">
+                <xsl:value-of select="$graph.title//stentry[@col=$col]/@group"/>
+            </xsl:when>
+            <xsl:when test="$graph.title//stentry[@col=$col]/text()">
+                <xsl:value-of select="$graph.title//stentry[@col=$col]/text()"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="yes">#51 error no $graph.title//stentry[@col=$col]/text() = [ $col <xsl:value-of select="$col"/> ] </xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:graph.yaxis.pos">
+        <xsl:param name="graph.title" required="yes"/>
+        <xsl:param name="ytics" required="yes"/>
+        <xsl:param name="current-grouping-key" required="yes"/>
+        <xsl:param name="col" required="yes"/>
+        
+        <!--<xsl:variable name="col__x3A__local__x3A__position">
+            <xsl:for-each select="$graph.title//stentry[@current-grouping-key=$current-grouping-key]">
+                <xsl:choose>
+                    <xsl:when test="@col=$col"><xsl:value-of select="position()"/></xsl:when>
+                </xsl:choose>
+            </xsl:for-each>
+        </xsl:variable>-->
+        
+        <xsl:choose>
+            <!--<xsl:when test="$ytics/ytics/ytics.row[@current-grouping-key=$current-grouping-key]/stentry[position()=$col__x3A__local__x3A__position]/@col">
+                <xsl:value-of select="$ytics/ytics/ytics.row[@current-grouping-key=$current-grouping-key]/stentry[position()=$col__x3A__local__x3A__position]/@col"/>
+            </xsl:when>-->
+            <xsl:when test="$ytics/ytics/ytics.row[@current-grouping-key=$current-grouping-key]/stentry[ @col=$col]/@xtics.pos">
+                <xsl:value-of select="$ytics/ytics/ytics.row[@current-grouping-key=$current-grouping-key]/stentry[ @col=$col]/@xtics.pos"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message terminate="yes">#51-77 not found associated yaxis for  [ $col <xsl:value-of select="$col"/> ]  and [ $current-grouping-key=<xsl:value-of select="$current-grouping-key"/> ] ; </xsl:message>
+            </xsl:otherwise>
+        </xsl:choose>
+        
+    </xsl:function>
+    
+    
+    
+</xsl:stylesheet>

+ 6 - 3
SE/schema/default_db_xml_cache.public/default_db/system_cache__dita.map.title__x3A__to_merge/tree_to_dita__x3A__map.title.default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.xsl

@@ -15,15 +15,18 @@
     </xsl:template>
     
     <xsl:template mode="system_cache__dita:map.title" match="default_db__x3A__BI_audit_BENFORD:L_APPOITMENT_INFO" >
-         <xsl:text>opis raportu: </xsl:text><xsl:value-of select="."/><xsl:text> 
- </xsl:text>
+         <xsl:text>
+opis raportu: </xsl:text><xsl:value-of select="."/><xsl:text>
+
+</xsl:text>
     </xsl:template>
         
     
     <xsl:template mode="system_cache__dita:map.title" match="@fid[parent::default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD]">
         <xsl:text> numer: </xsl:text><xsl:value-of select="get_wfs:id_from_fid(.)"/> <xsl:text> </xsl:text>
         systemowy plik wejściowy <xsl:value-of select="@p5:primaryKey"/>
-        prefix obiektu API <xsl:value-of select="replace(parent::default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD/name(),':',': ')"/>
+        prefix obiektu API <xsl:value-of select="replace(parent::default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD/name(),':',': ')"/><xsl:text>
+</xsl:text>
     </xsl:template>
     
     <!--<xsl:template mode="system_cache__dita:map.title" match="@p5:primaryKey[parent::default_db__x3A__BI_audit_BENFORD:BI_audit_BENFORD]">

+ 11 - 3
SE/schema/default_db_xml_cache.public/default_db/system_cache__dita.map.title__x3A__to_merge/tree_to_dita__x3A__map.title.xsl

@@ -6,11 +6,16 @@
     xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:default_db__x3A__BI_audit_BENFORD="https://biuro.biall-net.pl/wfs/default_db/BI_audit_BENFORD"
     version="2.0">
     
     <xsl:include href="tree_to_dita__x3A__map.title.default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.xsl"/>
     
     <xsl:template name="system_cache__dita:map.title">
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:valueField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:groupField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:timeField"  tunnel="yes"/>
+        <xsl:param name="default_db__x3A__BI_audit_BENFORD:NameField"  tunnel="yes"/>
         <title>raport  <xsl:text>
             
         </xsl:text>
@@ -22,9 +27,12 @@
             
           <xsl:text>
               
-          </xsl:text>  
-            przetwarzanie powiązań BOCIAN 
-            rev B2018-09-31.A.2 (procesy5/rip)
+          </xsl:text>
+            <xsl:text>
+             przetwarzanie powiązań BOCIAN 
+            rev B2018-09-31.A.3 (procesy5/rip)
+            </xsl:text>
+            
         </title>
     </xsl:template>
     

+ 28 - 0
SE/schema/default_db_xml_cache.public/default_db/system_cache__dita__x3A__to_merge/tree_to_dita__x3A__audience.xsl

@@ -0,0 +1,28 @@
+<?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"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    version="2.0">
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    
+    <xsl:function name="system_cache__dita:audience__x3A__escape">
+        <xsl:param name="text"/>
+        <xsl:value-of select="replace($text,' ','_x32_')"/>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:audience__x3A__unescape">
+        <xsl:param name="text"/>
+        <xsl:value-of select="replace($text,'_x32_',' ')"/>
+    </xsl:function>
+    
+    
+</xsl:stylesheet>

+ 86 - 0
SE/schema/default_db_xml_cache.public/default_db/system_cache__dita__x3A__to_merge/tree_to_dita__x3A__indexterm.xsl

@@ -0,0 +1,86 @@
+<?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:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    exclude-result-prefixes="xs get_wfs system_cache__dita p5"
+    version="2.0">
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:function name="system_cache__dita:indexterm">
+        <xsl:param name="indexterm"/>
+        <xsl:param name="system_cache__dita:localname" />
+        <indexterm><xsl:value-of select="$indexterm"/><xsl:if test="string-length($system_cache__dita:localname)&gt;0"><xsl:text> </xsl:text><xsl:value-of select="normalize-space($system_cache__dita:localname)"/></xsl:if></indexterm>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:indexterm.index-see-also">
+        <xsl:param name="indexterm"/>
+        <xsl:param name="system_cache__dita:localname" />
+        <xsl:call-template name="system_cache__dita:indexterm.index-see-also">
+            <xsl:with-param name="indexterm" select="$indexterm"/>
+            <xsl:with-param name="system_cache__dita:localname" select="$system_cache__dita:localname"/>
+        </xsl:call-template>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__dita:indexterm.index-see">
+        <xsl:param name="indexterm"/>
+        <xsl:param name="system_cache__dita:localname" />
+        <xsl:call-template name="system_cache__dita:indexterm.index-see">
+            <xsl:with-param name="indexterm" select="$indexterm"/>
+            <xsl:with-param name="system_cache__dita:localname" select="$system_cache__dita:localname"/>
+        </xsl:call-template>
+    </xsl:function>
+    
+    <xsl:template name="system_cache__dita:indexterm">
+        <xsl:param name="indexterm"/>
+        <xsl:param name="system_cache__dita:audience"/>
+        <xsl:param name="system_cache__dita:props"/>
+        <xsl:param name="system_cache__dita:element" select="'ph'"/>
+        <xsl:param name="text" select="$indexterm"/>
+        <xsl:param name="system_cache__dita:localname" />
+        <xsl:param name="system_cache__dita:indexterm.index-see-also"/>
+        <xsl:param name="system_cache__dita:indexterm.index-see"/>
+        <xsl:param name="system_cache__dita:indexterm"/><!-- recurse indexterm -->
+        <xsl:choose>
+            <xsl:when test="string-length($indexterm)&gt;0">
+                <xsl:choose>
+                    <xsl:when test="string-length($system_cache__dita:element)=0">
+                        <indexterm><xsl:value-of select="$indexterm"/><xsl:if test="$system_cache__dita:localname"><xsl:text> </xsl:text><xsl:value-of select="normalize-space($system_cache__dita:localname)"/></xsl:if><xsl:copy-of select="$system_cache__dita:indexterm" copy-namespaces="no"/><xsl:copy-of select="$system_cache__dita:indexterm.index-see-also" copy-namespaces="no"/><xsl:copy-of select="$system_cache__dita:indexterm.index-see" copy-namespaces="no"/></indexterm>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:element name="{$system_cache__dita:element}" inherit-namespaces="no">
+                            <indexterm><xsl:value-of select="$indexterm"/><xsl:if test="$system_cache__dita:localname"><xsl:text> </xsl:text><xsl:value-of select="normalize-space($system_cache__dita:localname)"/></xsl:if><xsl:copy-of select="$system_cache__dita:indexterm" copy-namespaces="no"/><xsl:copy-of select="$system_cache__dita:indexterm.index-see-also" copy-namespaces="no"/><xsl:copy-of select="$system_cache__dita:indexterm.index-see" copy-namespaces="no"/></indexterm><xsl:value-of select="$text"/>
+                        </xsl:element>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+    
+    <xsl:template name="system_cache__dita:indexterm.index-see">
+        <xsl:param name="indexterm"/>
+        <xsl:param name="system_cache__dita:localname" />
+        <xsl:choose>
+            <xsl:when test="string-length($indexterm)&gt;0">
+                <index-see><xsl:value-of select="$indexterm"/><xsl:if test="$system_cache__dita:localname"><xsl:text> </xsl:text><xsl:value-of select="normalize-space($system_cache__dita:localname)"/></xsl:if></index-see>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="system_cache__dita:indexterm.index-see-also">
+        <xsl:param name="indexterm"/>
+        <xsl:param name="system_cache__dita:localname" />
+        <xsl:choose>
+            <xsl:when test="string-length($indexterm)&gt;0">
+                <index-see-also><xsl:value-of select="$indexterm"/><xsl:if test="$system_cache__dita:localname"><xsl:text> </xsl:text><xsl:value-of select="normalize-space($system_cache__dita:localname)"/></xsl:if></index-see-also>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    
+</xsl:stylesheet>

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

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    xmlns:get_wfs="http://biuro.biall-net.pl/WPS_Functions/get_wfs/get_wfs.xsd"
+    xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:p5="https://biuro.biall-net.pl/wfs"
+    version="2.0">
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <!--<xsl:template name="system_cache__dita:transform_by_values_map">
+        <xsl:param name="interested_row" required="yes"/>
+        <xsl:param name="sources" required="yes"/>
+        <xsl:param name="navtitle" required="yes" />
+        <xsl:param name="element" required="yes"/>
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed"  />
+        <xsl:param name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.uniq"  />
+        <xsl:param name="resulset" required="yes"/>
+        <xsl:param name="mode" select="'system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal'"/><!-\- np BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person -\->
+        <xsl:param name="processing-role"/>
+        <xsl:param name="keys"/>
+        <xsl:param name="title"/>
+        <xsl:param name="toc"/>
+        <xsl:variable name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.values.fixed">
+            <xsl:call-template name="system_cache__dita:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.groupset">
+                <xsl:with-param name="interested_row" select="$interested_row"/>
+                <xsl:with-param name="sources" select="$sources"/>
+                <xsl:with-param name="system_cache__dita:groupset.mode.BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.path" select="true()"/>
+            </xsl:call-template>
+        </xsl:variable>
+        
+        <topichead navtitle="test tr by map"/>
+    </xsl:template>-->
+    
+    
+</xsl:stylesheet>

+ 3 - 0
SE/schema/default_db_xml_cache.public/default_db/tree_to_dita__x3A__to_merge.xsl

@@ -22,7 +22,10 @@
     
     <xsl:include href="system_cache__dita.map.title__x3A__to_merge/tree_to_dita__x3A__map.title.xsl"/>
     <xsl:include href="system_cache__dita__x3A__to_merge/tree_to_dita__x3A__parts.xsl"/>
+    <xsl:include href="system_cache__dita__x3A__to_merge/tree_to_dita__x3A__audience.xsl"/>
     <xsl:include href="BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.stats_all.xsl"/>
+    <xsl:include href="system_cache__dita__x3A__to_merge/tree_to_dita__x3A__indexterm.xsl"/>
+    <xsl:include href="system_cache__dita__x3A__to_merge/tree_to_dita__x3A__transform_by_values_map.xsl"/>
     <!--<xsl:include href="../../WPS_Functions/render-vis-js-in-electron-\-v0.0.1/p5.nodeCoords__x3A__tree_to_dita.xsl"/>-->
     
     

+ 20 - 1
se.oxygen.xpr

@@ -11,7 +11,7 @@
                     </entry>
                     <entry>
                         <String>keys.context</String>
-                        <String>file:/opt/local/pl.procesy5/p5build_SE/temp/WPS_Functions/default_db/CRM_PROCES_tree/BI_audit_BENFORD_24/BI_audit_BENFORD_24.ditamap</String>
+                        <String>file:/opt/local/pl.procesy5/p5build_SE/temp/WPS_Functions/default_db/CRM_PROCES_tree/relations-136_000006/relations-136_000006.ditamap</String>
                     </entry>
                     <entry>
                         <String>scenario.associations</String>
@@ -194,9 +194,16 @@
             <file name="SE/schema/WPS_Functions/bocian-graph-to-html/bcgtht.tree_to_dita.working.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/Benford.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors/BI_audit_ENERGA_RUM_KONTRAHENCI_and_BI_audit_ENERGA_RUM_UMOWY_errors_tree_to_dita.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.dita.xsd"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA.universal.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_ENERGA_RUM_UMOWY.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_person.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA.ends.desc.table.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_LISTA.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_statystyka_pracownik.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.func.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.sources.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.stats_all.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/big_values_format.xsl"/>
@@ -260,6 +267,14 @@
             <file name="SE/schema/default_db_xml_cache.public/get_wfs_recurse_xsl.xsl"/>
             <file name="SE/schema/WPS_Functions/get_wfs_recurse_xsl/get_wfs_recurse_xsl.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplot.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics.header.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics__x3A__plot.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics__x3A__set.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.color.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.xaxis.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__ytics.yaxis.xsl"/>
             <file name="SE/schema/WPS_Functions/graph_tree_TODO_PROJ6806/graph_tree_yed.xsl"/>
             <file name="SE/schema/WPS_Functions/dita-ot/dita-ot-2.3.3/plugins/org.dita.pdf2/xsl/fo/i18n-postprocess.xsl"/>
             <file name="SE/schema/WPS_Functions/dita-ot/dita-ot-2.3.3/plugins/org.dita.pdf2/xsl/fo/i18n-postprocess_template.xsl"/>
@@ -345,6 +360,8 @@
             <file name="SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.files.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.localname.translate.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/tree_to_dita.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/system_cache__dita__x3A__to_merge/tree_to_dita__x3A__audience.xsl"/>
+            <file name="SE/schema/default_db_xml_cache.public/default_db/system_cache__dita__x3A__to_merge/tree_to_dita__x3A__indexterm.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/system_cache__dita.map.title__x3A__to_merge/tree_to_dita__x3A__map.title.default_db__x3A__BI_audit_BENFORD.BI_audit_BENFORD.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/system_cache__dita.map.title__x3A__to_merge/tree_to_dita__x3A__map.title.xsl"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/system_cache__dita__x3A__to_merge/tree_to_dita__x3A__parts.xsl"/>
@@ -368,9 +385,11 @@
             <folder path="../../procesy5-dita-templates-druki/xmlschema_procesy5/src-xmlschema/public_html/"/>
             <file name="SE/schema/default_db_xml_cache.public/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_tree_to_dita.xsl"/>
         </folder>
+        <folder path="../../../../opt/local/pl.procesy5/p5build_SE/temp/"/>
         <folder path="."/>
         <folder path="SE/schema/ant-object/default_db.BI_audit_KW_requested_person/"/>
         <folder path="../../procesy5-dita-templates-druki/"/>
         <folder path="../../procesy5-dita-templates-druki/xmlschema_procesy5/src-xmlschema/public_html/"/>
+        <file name="SE/schema/default_db_xml_cache.public/default_db/graph_gnuplot/graph_gnuplotdat.row__x3A__from__xtics.xsl"/>
     </projectTree>
 </project>

部分文件因为文件数量过多而无法显示