Bläddra i källkod

poprawki path

a.binder 9 år sedan
förälder
incheckning
dd2b82f610

+ 95 - 11
SE/dev/php-cli/biale_plamy_joins2ways_do_paths.xsl

@@ -26,13 +26,82 @@
     -->
     
     <xsl:template match="joins2ways_z_ID_Way">
-        <xsl:variable name="EdgeWayJoinsPair_cand">
+        <!--<xsl:variable name="EdgeWayJoinsPair_cand">
             <xsl:apply-templates mode="joins"/>
-        </xsl:variable>
-        <xsl:variable name="joins2ways_z_ID_Way" select="."/>
+        </xsl:variable>-->
+        <!--<xsl:variable name="joins2ways_z_ID_Way" select="."/>-->
+        <!--<xsl:copy-of select="$EdgeWayJoinsPair_cand"></xsl:copy-of>-->
+        <!--<xsl:choose>
+            <xsl:when test="$EdgeWayJoinsPair_cand/EdgeWayJoinsPair_cand[@ID_Way=current()/@ID_Way]">
+                <JESTOK></JESTOK>
+            </xsl:when>
+            <xsl:otherwise>
+                
+            </xsl:otherwise>
+        </xsl:choose>-->
+        <!--<xsl:copy-of select="$EdgeWayJoinsPair_cand/no_EdgeWayJoinsPair"></xsl:copy-of>-->
         
         <EdgeWayJoins>
-            <xsl:for-each-group select="$EdgeWayJoinsPair_cand/EdgeWayJoinsPair_cand" group-by="@ID_Way">
+            <!--<xsl:for-each-group select="$EdgeWayJoinsPair_cand/no_EdgeWayJoinsPair" group-by="@ID_Way">
+                <EdgeWayJoinsPair>
+                    <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                    <xsl:variable name="ID_Way" select="@ID_Way"/>
+                    <xsl:variable name="Joins_miss">
+                        <xsl:for-each select="$joins2ways_z_ID_Way/item[@ID_Way=$ID_Way and count( child::node())&gt;1 ]">
+                            <!-\- szukamy joinsa ktory ma joina do innego waysa-\->
+                            <xsl:variable name="Join_ID" select="@id"/>
+                            <xsl:for-each select="item">
+                                <ways>
+                                    <xsl:attribute name="id_join" select="$Join_ID"/>
+                                    <xsl:attribute name="id_way" select="text()"/>
+                                </ways>
+                            </xsl:for-each>
+                        </xsl:for-each>
+                    </xsl:variable>
+                    <xsl:copy-of select="$Joins_miss"/>
+                    <xsl:variable name="Ways_miss">
+                        <xsl:for-each select="$Joins_miss/ways">
+                            <xsl:variable name="id_join" select="@id_join"/>
+                            <xsl:variable name="id_way_test" select="@id_way"/>
+                            <xsl:for-each select="$ways2joins/ways2joins/item[@id=$id_way_test]/item">
+                                <found_joins_in_ways>
+                                    <xsl:attribute name="id_join" select="$id_join"/>
+                                    <xsl:attribute name="id_join_found" select="text()"/>
+                                </found_joins_in_ways>
+                            </xsl:for-each>
+                        </xsl:for-each>
+                    </xsl:variable>
+                    <xsl:copy-of select="$Ways_miss"/>
+                    <xsl:for-each select="$Ways_miss/found_joins_in_ways"> <!-\- [not(@id_join_found=$EdgeJoinFound)]-\->
+                        <xsl:choose>
+                            <xsl:when test="not($Joins_miss/ways[@id_join=current()/@id_join_found])">
+                                <!-\-<missed>-\->
+                                <!-\-<xsl:attribute name="Joins" select="@id_join"/>-\->
+                                <bp:Joins>
+                                     <xsl:attribute name="Joins" select="current()/@id_join_found"/>
+                                </bp:Joins>
+                                <!-\-</missed>-\->
+                            </xsl:when>
+                        </xsl:choose>
+                    </xsl:for-each>
+                </EdgeWayJoinsPair>
+            </xsl:for-each-group>-->
+            <xsl:for-each-group select="item" group-by="@ID_Way">
+                <EdgeWayJoinsPair>
+                    <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                    <xsl:variable name="ID_Way" select="@ID_Way"/>
+                    <xsl:for-each select="current-group()">
+                            <xsl:choose>
+                                <xsl:when test=" position()=1 or position()=last()">
+                                    <bp:Joins>
+                                        <xsl:attribute name="Joins" select="@id"/>
+                                    </bp:Joins>
+                                </xsl:when>
+                            </xsl:choose>
+                    </xsl:for-each>
+                </EdgeWayJoinsPair>
+            </xsl:for-each-group>
+            <!--<xsl:for-each-group select="$EdgeWayJoinsPair_cand/EdgeWayJoinsPair_cand" group-by="@ID_Way">
                 <EdgeWayJoinsPair>
                     <xsl:attribute name="ID_Way" select="@ID_Way"/>
                     <xsl:variable name="ID_Way" select="@ID_Way"/>
@@ -46,7 +115,7 @@
                                 <bp:Joins>
                                     <xsl:variable name="Joins_miss">
                                         <xsl:for-each select="$joins2ways_z_ID_Way/item[@ID_Way=$ID_Way and count( child::node())=2 ]">
-                                            <!-- szukamy joinsa ktory ma joina do innego waysa-->
+                                            <!-\- szukamy joinsa ktory ma joina do innego waysa-\->
                                             <xsl:variable name="Join_ID" select="@id"/>
                                             <xsl:for-each select="item">
                                                 <ways>
@@ -56,7 +125,7 @@
                                             </xsl:for-each>
                                         </xsl:for-each>
                                     </xsl:variable>
-                                    <!--<xsl:copy-of select="$Joins_miss"></xsl:copy-of>-->
+                                    <!-\-<xsl:copy-of select="$Joins_miss"></xsl:copy-of>-\->
                                     <xsl:variable name="Ways_miss">
                                         <xsl:for-each select="$Joins_miss/ways">
                                             <xsl:variable name="id_join" select="@id_join"/>
@@ -69,14 +138,14 @@
                                             </xsl:for-each>
                                         </xsl:for-each>
                                     </xsl:variable>
-                                    <!--<xsl:copy-of select="$Ways_miss"/>-->
+                                    <!-\-<xsl:copy-of select="$Ways_miss"/>-\->
                                     <xsl:for-each select="$Ways_miss/found_joins_in_ways[not(@id_join_found=$EdgeJoinFound)]">
                                         <xsl:choose>
                                             <xsl:when test="not($Joins_miss/ways[@id_join=current()/@id_join_found])">
-                                                <!--<missed>-->
-                                                    <!--<xsl:attribute name="Joins" select="@id_join"/>-->
+                                                <!-\-<missed>-\->
+                                                    <!-\-<xsl:attribute name="Joins" select="@id_join"/>-\->
                                                     <xsl:attribute name="Joins" select="current()/@id_join_found"/>
-                                                <!--</missed>-->
+                                                <!-\-</missed>-\->
                                             </xsl:when>
                                         </xsl:choose>
                                     </xsl:for-each>
@@ -85,7 +154,7 @@
                         </xsl:choose>
                     </xsl:for-each>
                 </EdgeWayJoinsPair>
-            </xsl:for-each-group>
+            </xsl:for-each-group>-->
         </EdgeWayJoins>
     </xsl:template>
     
@@ -95,14 +164,29 @@
     </xsl:template>
     
     <xsl:template match="item" mode="joins">
+        <!--<xsl:param name="second_turn" />-->
         <xsl:choose>
+            <!--<xsl:when test="count(item[@ID_WAY=current()/@ID_Way])&gt;1">
+                <xsl:element name="EdgeWayJoinsPair_cand">
+                    <xsl:attribute name="joins" select="@id"/>
+                    <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                    <xsl:attribute name="ways" select="item/text()"/>
+                </xsl:element>
+            </xsl:when>-->
             <xsl:when test="count(item)=1">
                 <xsl:element name="EdgeWayJoinsPair_cand">
+                    <xsl:attribute name="pos" select="position()"/>
                     <xsl:attribute name="joins" select="@id"/>
                     <xsl:attribute name="ID_Way" select="@ID_Way"/>
                     <xsl:attribute name="ways" select="item/text()"/>
                 </xsl:element>
             </xsl:when>
+            <!--<xsl:when test="count(../item[@ID_Way=current()/@ID_Way]) and count( child::node()=1)">
+                <xsl:element name="no_EdgeWayJoinsPair">
+                    <xsl:attribute name="ID_Way" select="@ID_Way"/>
+                </xsl:element>
+
+            </xsl:when>-->
             <!--<xsl:when test="count(item)=2">
                 <xsl:element name="EdgeWayJoinsPair_cand">
                     <xsl:attribute name="joins" select="@id"/>

+ 9 - 1
SE/dev/php-cli/joins2ways_z_ID_Way.xsl

@@ -4,6 +4,8 @@
     xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
     exclude-result-prefixes="xs"
     version="2.0">
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
     <xsl:param name="ways_2ID_Way.xml"  select="'ways_2ID_Way.xml'"/>
     <xsl:variable name="ways_2ID_Way" select="doc($ways_2ID_Way.xml)"/>
     
@@ -18,7 +20,13 @@
             <xsl:if test="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()">
                 <xsl:attribute name="ID_Way" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()"/>
             </xsl:if>
-            <xsl:copy-of select="item"/>
+            
+            <xsl:for-each select="item">
+                <xsl:element name="item">
+                    <xsl:attribute name="id" select="@id"/>
+                    <xsl:attribute name="ID_WAY" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/text()]/text()"/>
+                </xsl:element>
+            </xsl:for-each>
         </item>
     </xsl:template>