瀏覽代碼

dodanie obslugi fixings dla kabli

a.binder 9 年之前
父節點
當前提交
b866089296
共有 3 個文件被更改,包括 156 次插入130 次删除
  1. 26 4
      SE/dev/php-cli/build.xml
  2. 79 126
      SE/dev/php-cli/cables_from_joins_to_PE.xsl
  3. 51 0
      SE/dev/php-cli/edge_paths_with_PE_fixed.xsl

+ 26 - 4
SE/dev/php-cli/build.xml

@@ -111,13 +111,17 @@
     <property name="edge_paths_with_PE.xml" value="edge_paths_with_PE${plamy_prefix}.xml"/><!--     biale_plamy_from_paths_php_to_place_PE-->
     <property name="edge_paths_with_PE.xml" value="edge_paths_with_PE${plamy_prefix}.xml"/><!--     biale_plamy_from_paths_php_to_place_PE-->
          
          
             <property name="biale_put_PE_to_mysql.php" value="biale_put_PE_to_mysql.php"/>
             <property name="biale_put_PE_to_mysql.php" value="biale_put_PE_to_mysql.php"/>
-            
+         
+        <property name="PE_fixings.xml" value="PE_fixings${plamy_prefix}.xml"/>
+        <property name="edge_paths_with_PE_fixed.xsl" value="edge_paths_with_PE_fixed.xsl"/>
+        <property name="edge_paths_with_PE_fixed.xml" value="edge_paths_with_PE_fixed${plamy_prefix}.xml"/>
+    
             <property name="cables_from_joins_to_PE.xsl" value="cables_from_joins_to_PE.xsl"/>
             <property name="cables_from_joins_to_PE.xsl" value="cables_from_joins_to_PE.xsl"/>
     <property name="cables_from_joins_to_PE.xml" value="cables_from_joins_to_PE${plamy_prefix}.xml"/><!-- xml do wygenerowania  -->
     <property name="cables_from_joins_to_PE.xml" value="cables_from_joins_to_PE${plamy_prefix}.xml"/><!-- xml do wygenerowania  -->
         
         
             <property name="biale_put_Cables_to_PE.php" value="biale_put_Cables_to_PE.php"/>
             <property name="biale_put_Cables_to_PE.php" value="biale_put_Cables_to_PE.php"/>
     
     
-    <property name="PE_fixings.xml" value="PE_fixings${plamy_prefix}.xml"/>
+    
     
     
     <!--<include file="${build_edge_paths_with_PE_controll_loop.xml}" optional=""/>-->
     <!--<include file="${build_edge_paths_with_PE_controll_loop.xml}" optional=""/>-->
     
     
@@ -535,7 +539,7 @@
     </target>
     </target>
     
     
     <!-- przeliczenie dla kazdego PE z trasy punktu przeciecia i wybranie najkrotszej i wygenerowania kabla -->
     <!-- przeliczenie dla kazdego PE z trasy punktu przeciecia i wybranie najkrotszej i wygenerowania kabla -->
-    <target name="cables_from_joins_to_PE.xml" depends="get_PE_fixings_from_db">
+    <target name="cables_from_joins_to_PE.xml" depends="edge_paths_with_PE_fixed.xml">
         <delete file="${cables_from_joins_to_PE.xml}"/>
         <delete file="${cables_from_joins_to_PE.xml}"/>
         <xslt basedir="./" style="${cables_from_joins_to_PE.xsl}" in="${joins2ways_z_ID_Way.xml}"  destdir="./" out="${cables_from_joins_to_PE.xml}" >
         <xslt basedir="./" style="${cables_from_joins_to_PE.xsl}" in="${joins2ways_z_ID_Way.xml}"  destdir="./" out="${cables_from_joins_to_PE.xml}" >
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
@@ -544,7 +548,7 @@
                 <!--<attribute name="http://saxon.sf.net/feature/initialTemplate" value="asd"/>-->
                 <!--<attribute name="http://saxon.sf.net/feature/initialTemplate" value="asd"/>-->
             </factory>
             </factory>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
-            <param name="edge_paths_with_PE.xml" expression="${edge_paths_with_PE.xml}"/>
+            <param name="edge_paths_with_PE_fixed.xml" expression="${edge_paths_with_PE_fixed.xml}"/>
             <param name="joins_asText_xml.xml" expression="${joins_asText_xml.xml}"/>
             <param name="joins_asText_xml.xml" expression="${joins_asText_xml.xml}"/>
             <param name="edge_joins_filled_paths.xml" expression="${edge_joins_filled_paths.xml}"/>
             <param name="edge_joins_filled_paths.xml" expression="${edge_joins_filled_paths.xml}"/>
             <param name="points2joins.xml" expression="${points2joins.xml}"/>
             <param name="points2joins.xml" expression="${points2joins.xml}"/>
@@ -616,6 +620,24 @@
         </get>
         </get>
     </target>
     </target>
    
    
+   
+    <target name="edge_paths_with_PE_fixed.xml" depends="get_PE_fixings_from_db" description="przerobienie edge_paths_with_PE.xml na fixed (${edge_paths_with_PE_fixed.xml}) do wygenerowania kabli aby je tam uzyc ">
+        
+        <delete  file="${edge_paths_with_PE_fixed.xml}"/>
+        <xslt basedir="./" style="${edge_paths_with_PE_fixed.xsl}" in="${edge_paths_with_PE.xml}"  destdir="./" out="${edge_paths_with_PE_fixed.xml}" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <!--<attribute name="http://saxon.sf.net/feature/initialMode" value="DITA_PARSE_templ"/>-->
+                <!--<attribute name="http://saxon.sf.net/feature/initialTemplate" value="asd"/>-->
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="edge_paths_with_PE.xml" expression="${edge_paths_with_PE.xml}"/>
+            <param name="PE_fixings.xml"  expression="${PE_fixings.xml}"/>
+            <!--<param name="dita_task_template_file_param" expression="main.dita"/>-->
+        </xslt>
+        
+    </target>
+   
     <!--<target name="1_install_mysql_functions">
     <!--<target name="1_install_mysql_functions">
         <property name="php_script_header"><?php
         <property name="php_script_header"><?php
             $_SERVER['SERVER_NAME'] = 'biuro.biall-net.pl';
             $_SERVER['SERVER_NAME'] = 'biuro.biall-net.pl';

+ 79 - 126
SE/dev/php-cli/cables_from_joins_to_PE.xsl

@@ -2,21 +2,25 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
     xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
+    xmlns:wfs="http://www.opengis.net/wfs" 
+    xmlns="http://www.opengis.net/wfs"
+   
     exclude-result-prefixes="xs"
     exclude-result-prefixes="xs"
     version="2.0">
     version="2.0">
     <xsl:output indent="yes"/>
     <xsl:output indent="yes"/>
     <xsl:strip-space elements="*"/>
     <xsl:strip-space elements="*"/>
     
     
     <xsl:include href="asText.xsl"/>
     <xsl:include href="asText.xsl"/>
-    <xsl:param name="plamy_prefix" select="'test2'"/>
+    <xsl:param name="plamy_prefix" /> <!-- select="'test2'" -->
     
     
-    <xsl:param name="edge_paths_with_PE.xml" select="concat('edge_paths_with_PE',$plamy_prefix,'.xml')"/>
+    <xsl:param name="edge_paths_with_PE_fixed.xml" select="concat('edge_paths_with_PE_fixed',$plamy_prefix,'.xml')"/>
     <xsl:param name="joins_asText_xml.xml" select="concat('joins_asText_xml',$plamy_prefix,'.xml')"/>
     <xsl:param name="joins_asText_xml.xml" select="concat('joins_asText_xml',$plamy_prefix,'.xml')"/>
     <!--<xsl:param name="edge_joins_filled_paths.xml" select="'edge_joins_filled_paths.xml'"/>-->
     <!--<xsl:param name="edge_joins_filled_paths.xml" select="'edge_joins_filled_paths.xml'"/>-->
     <xsl:param name="points2joins.xml" select="concat('points2joins',$plamy_prefix,'.xml')"/>
     <xsl:param name="points2joins.xml" select="concat('points2joins',$plamy_prefix,'.xml')"/>
-    <xsl:param name="edge_joins_filled_paths" select="'edge_joins_filled_paths'"/>
+    <xsl:param name="edge_joins_filled_paths" select="concat('edge_joins_filled_paths',$plamy_prefix)"/>
+  
     
     
-    <xsl:variable name="PE_candidates_dump" select="doc($edge_paths_with_PE.xml)"/>
+    <xsl:variable name="PE_candidates_dump" select="doc($edge_paths_with_PE_fixed.xml)"/>
     <xsl:variable name="joins_asText_Path_Point" select="doc($joins_asText_xml.xml)"/>
     <xsl:variable name="joins_asText_Path_Point" select="doc($joins_asText_xml.xml)"/>
     <!--<xsl:variable name="edge_joins_filled_paths" select="doc($edge_joins_filled_paths.xml) "/>-->
     <!--<xsl:variable name="edge_joins_filled_paths" select="doc($edge_joins_filled_paths.xml) "/>-->
     <xsl:variable name="points2joins" select="doc($points2joins.xml)"/>
     <xsl:variable name="points2joins" select="doc($points2joins.xml)"/>
@@ -33,125 +37,74 @@
                 <!--<xsl:copy-of select="$edge_joins_filled_paths"/>-->
                 <!--<xsl:copy-of select="$edge_joins_filled_paths"/>-->
         <!-- jedziemy po joins2ways_z_ID_Way, sprawdzamy czy jest dla niego PE_candidates_dump , jak tak, to szukamy jego PE i liczymy sciezke 
         <!-- jedziemy po joins2ways_z_ID_Way, sprawdzamy czy jest dla niego PE_candidates_dump , jak tak, to szukamy jego PE i liczymy sciezke 
                lub probujemy rysowac zawsze od konca drogi-->
                lub probujemy rysowac zawsze od konca drogi-->
-          <xsl:for-each select="item">
-            <xsl:variable name="ID_Way" select="@ID_Way"/>
-            <xsl:variable name="ID_Join" select="@id"/>
-            <!--<xsl:variable name="pos" select=" position()"/>--> <!-- tozsamosc ulozenia z waysow -->
-            <xsl:variable name="ID_Point_count"/>  
-            <xsl:for-each select="Points">
-                <xsl:message>#41 Calculating Cable for point:<xsl:value-of select=" text()"/>; ID_Join:<xsl:value-of select="$ID_Join"/></xsl:message>
-                    <xsl:variable name="ID_Point" select=" text()"/>
-                    <xsl:variable name="edge_joins_filled_paths_xml" select="doc(concat($edge_joins_filled_paths,'/edge_joins_filled_paths.',$ID_Way,'.xml'))"/>
-                        <!-- do ustalenia gdize sa najblizsze bp:Path_Point_Cable ID_Join="45" -> Target_ID_Join  --> 
-                        <xsl:variable name="edge_paths_with_PE_controll" select="doc(concat('edge_paths_with_PE_controll_paths_temp/edge_paths_with_PE_controll.xsl.',$ID_Way,'.xml'))"/>
-                         <!-- nie tzeba - jest w foreach dla Points !- trzeba sprawdzic czy join jest klientem - czy tylko PE! -->
-                        <xsl:choose>
-                        <!--<xsl:when test="not(@ID_Point)">
-                              <not_candidate><xsl:attribute name="descr" select="'this is probably join from way'"/>
-                                  <xsl:attribute name="Joins" select="@id"/></not_candidate>
-                          </xsl:when>-->
-                            <xsl:when test="$PE_candidates_dump/PE_candidates_dump/LINESTRING/bp:Path_Point[@ID_Join=$ID_Join]">
-                                <not_candidate_is_pe><xsl:attribute name="descr" select="'this is PE '"/>
-                                    <xsl:attribute name="Joins" select="$ID_Join"/>
-                                    <xsl:copy-of select="$PE_candidates_dump/PE_candidates_dump/LINESTRING/bp:Path_Point[@ID_Join=$ID_Join]"/>
-                                </not_candidate_is_pe>
-                            </xsl:when>
-                        <xsl:otherwise>
-                            <cable_to_PE_to_be_calculated>
-                                <xsl:attribute name="ID_Way" select="$ID_Way"/>
-                                <xsl:attribute name="Joins" select="$ID_Join"/>
-                                <xsl:attribute name="ID_Point" select="$ID_Point"/>
-                                 <!-- idziemy po drodze,  -->
-                                <xsl:variable name="Join_X" select="$joins_asText_Path_Point/joins_asText_xml/item[@id=$ID_Join]/bp:Path_Point/@X"/>
-                                <xsl:variable name="Join_Y" select="$joins_asText_Path_Point/joins_asText_xml/item[@id=$ID_Join]/bp:Path_Point/@Y"/>
-                                
-                                <xsl:attribute name="Join_X" select="$Join_X"/><xsl:attribute name="Join_Y" select="$Join_Y"/>
-                                            <!--<xsl:variable name="found_in_path_in_edge_joins_filled_path">
-                                                <xsl:for-each select="$edge_joins_filled_paths_xml/edge_joins_filled_paths_xml/asText_XMl[@id=$ID_Way]/LineString">
-                                                    <xsl:variable name="diff_X" select=" number($Join_X)- number(@X)"/><xsl:variable name="diff_Y" select=" number($Join_Y)- number(@Y)"/>
-                                                    <xsl:variable name="bp:Path_Point" select="."/>
-                                                        <xsl:choose>
-                                                            <xsl:when test="(abs($diff_X)&lt;0.0001 and abs($diff_X)&lt;0.0001) or ( @X=$Join_X and @Y=$Join_Y )">
-                                                                <found_in_path_in_edge_joins_filled_path>
-                                                                    <xsl:variable name="Join_Y" select="$joins_asText_Path_Point/joins_asText_xml/item[@id=$Joins]/bp:Path_Point/@Y"/>
-                                                                    <xsl:attribute name="diff_X" select="$diff_X"/><xsl:attribute name="diff_Y" select="$diff_Y"/>
-                                                                    <xsl:attribute name="position" select="position()"/>
-                                                                    <!-\-<bp:Path_Point_var><xsl:copy-of select="$bp:Path_Point"/></bp:Path_Point_var>-\->
-                                                                    <xsl:copy-of select="."/>
-                                                                    <xsl:call-template name="detect_next_PE">
-                                                                        <xsl:with-param name="bp:Path_Point" select="$bp:Path_Point"/>
-                                                                        <xsl:with-param name="ID_Way" select="$ID_Way"/>
-                                                                        <xsl:with-param name="Pos_found" select="position()"/>
-                                                                        <xsl:with-param name="edge_joins_filled_paths" select="$edge_joins_filled_paths_xml"/>
-                                                                        <xsl:with-param name="ID_Point" select="$ID_Point"/>
-                                                                    </xsl:call-template>
-                                                                </found_in_path_in_edge_joins_filled_path>
-                                                            </xsl:when>
-                                                            <xsl:otherwise>
-                                                                <not_found>
-                                                                    <xsl:attribute name="Pos" select="position()"/>
-                                                                    <xsl:attribute name="X" select="@X"/><xsl:attribute name="Y" select="@Y"/>
-                                                                    <xsl:attribute name="srch_X" select="$Join_X"/><xsl:attribute name="srch_Y" select="$Join_Y"/>
-                                                                    <xsl:attribute name="diff_X" select="$diff_X"/><xsl:attribute name="diff_Y" select="$diff_Y"/>
-                                                                </not_found>
-                                                            </xsl:otherwise>
-                                                        </xsl:choose>
-                                                </xsl:for-each>
-                                            </xsl:variable>-->
-                                            <!--<xsl:choose>
-                                    <xsl:when test="$found_in_path_in_edge_joins_filled_path/found_in_path_in_edge_joins_filled_path">
-                                        <xsl:for-each select="$found_in_path_in_edge_joins_filled_path/found_in_path_in_edge_joins_filled_path[1]">
-                                            <xsl:sort select="count(detect_next_PE/bp:Path_Point)" order="descending"/>
-                                            <debug>
-                                                <xsl:attribute name="debug_pos" select="position()"/>
-                                                <xsl:attribute name="Path_Point_count" select="count(detect_next_PE/bp:Path_Point)"/>
-                                            </debug>
-                                            <!-\-<found_in_path_in_edge_joins_filled_path>
-                                                <xsl:attribute name="debug_pos" select="position()"/>
-                                                <xsl:copy-of select="@*"/>
-                                                <xsl:call-template name="detect_next_PE">
-                                                    <xsl:with-param name="bp:Path_Point" select="bp:Path_Point_var"/>
-                                                    <xsl:with-param name="ID_Way" select="$ID_Way"/>
-                                                    <xsl:with-param name="Pos_found" select="@position"/>
-                                                    <xsl:with-param name="edge_joins_filled_paths" select="$edge_joins_filled_paths"/>
-                                                    <xsl:with-param name="ID_Point" select="$ID_Point"/>
-                                                </xsl:call-template>
-                                            </found_in_path_in_edge_joins_filled_path>-\->
-                                            <xsl:copy-of select="."/>
-                                        </xsl:for-each>
-                                        <xsl:copy-of select="$found_in_path_in_edge_joins_filled_path/not_found"/>
-                                    </xsl:when>
-                                    <xsl:otherwise>
-                                        <xsl:copy-of select="$found_in_path_in_edge_joins_filled_path"/>
-                                    </xsl:otherwise>
-                                </xsl:choose>-->
-                                <xsl:variable name="id_path" select="$edge_joins_filled_paths_xml/edge_joins_filled_paths_xml/asText_XMl/LineString[@ID_Join=$ID_Join and @Y=$Join_Y and @Y=$Join_Y]/@id_path" />
-                                <xsl:choose>
-                                    <xsl:when test="$id_path">
-                                        <found_in_path_in_edge_joins_filled_path>
-                                            <xsl:for-each select="$edge_joins_filled_paths_xml/edge_joins_filled_paths_xml/asText_XMl/LineString[@ID_Join=$ID_Join and @Y=$Join_Y and @Y=$Join_Y]">
-                                                <xsl:call-template name="detect_next_PE_adv">
-                                                    <xsl:with-param name="ID_Point" select="$ID_Point"/>
-                                                    <xsl:with-param name="id_path" select="@id_path"/>
-                                                    <xsl:with-param name="ID_Join" select="$ID_Join"/>
-                                                    <xsl:with-param name="ID_Way" select="$ID_Way"/>
-                                                    <xsl:with-param name="edge_joins_filled_paths_xml" select="$edge_joins_filled_paths_xml"/>
-                                                </xsl:call-template>
-                                            </xsl:for-each>
-                                        </found_in_path_in_edge_joins_filled_path>
-                                    </xsl:when>
-                                    <xsl:otherwise>
-                                        <error>Not found $path
-                                            <xsl:message>Not found $path</xsl:message>
-                                        </error>
-                                    </xsl:otherwise>
-                                </xsl:choose>
-                                
-                            </cable_to_PE_to_be_calculated>
-                        </xsl:otherwise>
-                </xsl:choose>
-            </xsl:for-each>
-        </xsl:for-each>
+          <xsl:for-each-group select="item" group-by="@id">
+              <xsl:for-each select="current-group()">
+                  <xsl:variable name="ID_Way" select="@ID_Way"/>
+                  <xsl:variable name="ID_Join" select="@id"/>
+                  <!--<xsl:variable name="pos" select=" position()"/>--> <!-- tozsamosc ulozenia z waysow -->
+                  <xsl:variable name="ID_Point_count"/>  
+                  <xsl:for-each select="Points">
+                      <xsl:message>#41 Calculating Cable for point:<xsl:value-of select=" text()"/>; ID_Join:<xsl:value-of select="$ID_Join"/></xsl:message>
+                          <xsl:variable name="ID_Point" select=" text()"/>
+                           <xsl:message>#53 opening doc(<xsl:value-of select="concat($edge_joins_filled_paths,'/edge_joins_filled_paths.',$ID_Way,'.xml')"/>)</xsl:message>
+                          <xsl:variable name="edge_joins_filled_paths_xml" select="doc(concat($edge_joins_filled_paths,'/edge_joins_filled_paths.',$ID_Way,'.xml'))"/>
+                              <!-- do ustalenia gdize sa najblizsze bp:Path_Point_Cable ID_Join="45" -> Target_ID_Join  --> 
+                              <!--<debug56><xsl:copy-of select="$edge_joins_filled_paths_xml/edge_joins_filled_paths_xml/asText_XMl[1]"/></debug56>-->
+                              <xsl:variable name="edge_paths_with_PE_controll" select="doc(concat('edge_paths_with_PE_controll_paths_temp/edge_paths_with_PE_controll.xsl.',$ID_Way,'.xml'))"/>
+                               <!-- nie tzeba - jest w foreach dla Points !- trzeba sprawdzic czy join jest klientem - czy tylko PE! -->
+                              <xsl:choose>
+                              <!--<xsl:when test="not(@ID_Point)">
+                                    <not_candidate><xsl:attribute name="descr" select="'this is probably join from way'"/>
+                                        <xsl:attribute name="Joins" select="parent::node()/@id"/></not_candidate>
+                              </xsl:when>-->
+                                  <!-- uwzgledniam usuniete punkty PE w Fixings -->
+      
+                                  <xsl:when test="$PE_candidates_dump/PE_candidates_dump/LINESTRING/bp:Path_Point[@ID_Join=$ID_Join] ">
+                                      <not_candidate_is_pe><xsl:attribute name="descr" select="'this is PE '"/>
+                                      <xsl:attribute name="Joins" select="$ID_Join"/>
+                                      <xsl:copy-of select="$PE_candidates_dump/PE_candidates_dump/LINESTRING/bp:Path_Point[@ID_Join=$ID_Join]"/>
+                                  </not_candidate_is_pe>
+                              </xsl:when>
+                              <xsl:otherwise>
+                                  <cable_to_PE_to_be_calculated>
+                                      
+                                      <xsl:attribute name="ID_Way" select="$ID_Way"/>
+                                      <xsl:attribute name="Joins" select="$ID_Join"/>
+                                      <xsl:attribute name="ID_Point" select="$ID_Point"/>
+                                       <!-- idziemy po drodze,  -->
+                                      <xsl:variable name="Join_X" select="$joins_asText_Path_Point/joins_asText_xml/item[@id=$ID_Join]/bp:Path_Point/@X"/>
+                                      <xsl:variable name="Join_Y" select="$joins_asText_Path_Point/joins_asText_xml/item[@id=$ID_Join]/bp:Path_Point/@Y"/>
+                                      
+                                      <xsl:attribute name="Join_X" select="$Join_X"/><xsl:attribute name="Join_Y" select="$Join_Y"/>
+                                                  
+                                      <xsl:variable name="id_path" select="$edge_joins_filled_paths_xml/edge_joins_filled_paths_xml/asText_XMl/LineString[@ID_Join=$ID_Join and @Y=$Join_Y and @Y=$Join_Y]/@id_path" />
+                                      <xsl:choose>
+                                          <xsl:when test="$id_path">
+                                              <found_in_path_in_edge_joins_filled_path>
+                                                  <xsl:for-each select="$edge_joins_filled_paths_xml/edge_joins_filled_paths_xml/asText_XMl/LineString[@ID_Join=$ID_Join and @Y=$Join_Y and @Y=$Join_Y]">
+                                                      <xsl:call-template name="detect_next_PE_adv">
+                                                          <xsl:with-param name="ID_Point" select="$ID_Point"/>
+                                                          <xsl:with-param name="id_path" select="@id_path"/>
+                                                          <xsl:with-param name="ID_Join" select="$ID_Join"/>
+                                                          <xsl:with-param name="ID_Way" select="$ID_Way"/>
+                                                          <xsl:with-param name="edge_joins_filled_paths_xml" select="$edge_joins_filled_paths_xml"/>
+                                                      </xsl:call-template>
+                                                  </xsl:for-each>
+                                              </found_in_path_in_edge_joins_filled_path>
+                                          </xsl:when>
+                                          <xsl:otherwise>
+                                              <error>Not found $path
+                                                  <xsl:message>Not found $path</xsl:message>
+                                              </error>
+                                          </xsl:otherwise>
+                                      </xsl:choose>
+                                      
+                                  </cable_to_PE_to_be_calculated>
+                              </xsl:otherwise>
+                      </xsl:choose>
+                  </xsl:for-each>
+              </xsl:for-each>
+        </xsl:for-each-group>
         </cables_from_joins_to_PE>
         </cables_from_joins_to_PE>
     </xsl:template>
     </xsl:template>
     
     
@@ -164,8 +117,8 @@
         <xsl:param name="edge_joins_filled_paths_xml" required="yes"/>
         <xsl:param name="edge_joins_filled_paths_xml" required="yes"/>
         
         
         <detect_next_PE>
         <detect_next_PE>
-            <xsl:variable name="Next_PE_Pos" select="min($PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@id_path)&gt;number($id_path)]/number(@id_path))"/>
-            <xsl:variable name="Prev_PE_Pos" select="max($PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@id_path)&lt;=number($id_path)]/number(@id_path))"/>
+            <xsl:variable name="Next_PE_Pos" select="min($PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@id_path)&gt;number($id_path)]/number(@id_path) )"/>
+            <xsl:variable name="Prev_PE_Pos" select="max($PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@id_path)&lt;=number($id_path)]/number(@id_path)  )"/>
             <xsl:variable name="Same_PE_Pos" select="max($PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@id_path)=number($id_path)]/number(@id_path))"/>
             <xsl:variable name="Same_PE_Pos" select="max($PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=$ID_Way]/bp:Path_Point[number(@id_path)=number($id_path)]/number(@id_path))"/>
             <xsl:attribute name="id_path" select="$id_path"/>
             <xsl:attribute name="id_path" select="$id_path"/>
             <xsl:attribute name="Next_PE_Pos" select="$Next_PE_Pos"/>
             <xsl:attribute name="Next_PE_Pos" select="$Next_PE_Pos"/>
@@ -235,7 +188,7 @@
                     <ERORR>pewnie sasiedzkei sciezki Neighbour do obsluzenia i ich nie znaleziono 
                     <ERORR>pewnie sasiedzkei sciezki Neighbour do obsluzenia i ich nie znaleziono 
                         jest info w /edge_paths_with_PE_controll/Path[1]/PointMatrixGroupPE[1]/PointMatrixGroup[1]/odpalam_liczenie[1]/koniec_wariantow[1]/bp:Path_Point_Cable[3]
                         jest info w /edge_paths_with_PE_controll/Path[1]/PointMatrixGroupPE[1]/PointMatrixGroup[1]/odpalam_liczenie[1]/koniec_wariantow[1]/bp:Path_Point_Cable[3]
                     </ERORR>
                     </ERORR>
-                    <xsl:message>ERROR nie znaleziono sciezki - moze sasiedzkie ? TODO</xsl:message>
+                    <xsl:message>ERROR nie znaleziono sciezki - moze sasiedzkie ? TODO $ID_Way<xsl:value-of select="$ID_Way"/>;</xsl:message>
                     <!--<xsl:variable name=""/>-->
                     <!--<xsl:variable name=""/>-->
                 </xsl:otherwise>
                 </xsl:otherwise>
                 
                 

+ 51 - 0
SE/dev/php-cli/edge_paths_with_PE_fixed.xsl

@@ -0,0 +1,51 @@
+<?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:bp="https://procesy5.pl/biale_plamy-schema.xsd"
+    xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db" 
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="plamy_prefix" />
+    <xsl:param name="PE_fixings.xml" select="concat('PE_fixings',$plamy_prefix,'.xml')"/>
+    <xsl:param name="PE_fixings" select=" doc($PE_fixings.xml)"/>
+    
+    
+    
+    <xsl:template match="PE_candidates_dump">
+        <PE_candidates_dump>
+             <debug>
+                 <xsl:copy-of select="$PE_fixings"/>
+             </debug>
+            <xsl:apply-templates/>
+        </PE_candidates_dump>
+    </xsl:template>
+    
+    <xsl:template match="LINESTRING">
+        <LINESTRING>
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates/>
+        </LINESTRING>
+    </xsl:template>
+    
+    
+    <xsl:template match="bp:Path_Point">
+        <xsl:choose>
+            <xsl:when test="$PE_fixings/wfs:FeatureCollection//p5_default_db:ID_Join[ text()=current()/@ID_Join and not(parent::node()/p5_default_db:the_geom/gml:Point)]">
+                <edge_paths_with_PE_fixed>
+                    <xsl:message terminate="no">Found Join fixed @ID_Join=<xsl:value-of select="@ID_Join"/>;</xsl:message>
+                    <xsl:attribute name="debug" select="'point removed and detected in PE_fixings.xml'"/>
+                    <xsl:copy-of select="@*"/>
+                </edge_paths_with_PE_fixed>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:copy-of select="."/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+</xsl:stylesheet>