a.binder 9 سال پیش
والد
کامیت
d9096c3521
1فایلهای تغییر یافته به همراه59 افزوده شده و 0 حذف شده
  1. 59 0
      SE/dev/php-cli/biale_plamy_joins2ways_do_paths.xsl

+ 59 - 0
SE/dev/php-cli/biale_plamy_joins2ways_do_paths.xsl

@@ -6,6 +6,8 @@
     version="2.0">
    <!--<xsl:param name=""></xsl:param>-->
    
+    <xsl:variable name="ways2joins" select="doc('ways2joins.xml')"/>
+   
    <xsl:output indent="yes"/>
    <xsl:strip-space elements="*"/>
     <!--example input
@@ -27,14 +29,60 @@
         <xsl:variable name="EdgeWayJoinsPair_cand">
             <xsl:apply-templates mode="joins"/>
         </xsl:variable>
+        <xsl:variable name="joins2ways_z_ID_Way" select="."/>
+        
         <EdgeWayJoins>
             <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"/>
                     <xsl:for-each select="current-group()">
+                        <xsl:variable name="EdgeJoinFound" select="@joins"/>
                         <bp:Joins>
                             <xsl:attribute name="Joins" select="@joins"/>
                         </bp:Joins>
+                        <xsl:choose>
+                            <xsl:when test=" count( current-group())&lt;2">
+                                <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-->
+                                            <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:copy-of>-->
+                                    <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"/>-->
+                                                    <xsl:attribute name="Joins" select="current()/@id_join_found"/>
+                                                <!--</missed>-->
+                                            </xsl:when>
+                                        </xsl:choose>
+                                    </xsl:for-each>
+                                </bp:Joins>
+                            </xsl:when>
+                        </xsl:choose>
                     </xsl:for-each>
                 </EdgeWayJoinsPair>
             </xsl:for-each-group>
@@ -42,6 +90,10 @@
     </xsl:template>
     
     
+    <xsl:template match="item" mode="miss_join">
+        
+    </xsl:template>
+    
     <xsl:template match="item" mode="joins">
         <xsl:choose>
             <xsl:when test="count(item)=1">
@@ -51,6 +103,13 @@
                     <xsl:attribute name="ways" select="item/text()"/>
                 </xsl:element>
             </xsl:when>
+            <!--<xsl:when test="count(item)=2">
+                <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:choose>
     </xsl:template>