| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?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"
- exclude-result-prefixes="xs"
- version="2.0">
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
-
- <xsl:include href="asText.xsl"/>
-
- <xsl:variable name="PE_candidates_dump" select="doc('edge_paths_with_PE.xml')"/>
- <xsl:variable name="joins_asText" select="doc('joins_asText.xml')"/>
- <xsl:variable name="edge_joins_filled_paths" select="doc('edge_joins_filled_paths.xml') "/>
- <!-- <joins_asText>
- <item id="0">POINT (18.7909 51.701067999083)</item>-->
- <xsl:template match="joins2ways_z_ID_Way">
- <cables_from_joins_to_PE>
- <xsl:variable name="joins_asText_Path_Point">
- <xsl:apply-templates select="$joins_asText" mode="joins_asText"/>
- </xsl:variable>
- <joins_asText_Path_Point>
- <xsl:copy-of select="$joins_asText_Path_Point"/>
- </joins_asText_Path_Point>
- <xsl:variable name="edge_joins_filled_paths">
- <xsl:apply-templates select="$edge_joins_filled_paths" mode="edge_joins_filled_paths"/>
- </xsl:variable>
-
- <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
- lub probujemy rysowac zawsze od konca drogi-->
- <xsl:for-each select="item">
- <xsl:choose>
- <xsl:when test="$PE_candidates_dump/PE_candidates_dump/LINESTRING[@ID_Way=current()/@ID_Way]">
- <cable_to_PE_to_be_calculated>
- <xsl:attribute name="Joins" select="@id"/>
- <xsl:attribute name="ID_Way" select="@ID_Way"/>
- <xsl:variable name="ID_Way" select="@ID_Way"/>
- <xsl:variable name="Joins" select="@ID_Way"/>
-
- <!-- idziemy po drodze, -->
- <xsl:variable name="Join_X" select="$joins_asText_Path_Point/joins_asText/item[@id=$Joins]/As_POINT_to_xml/@X"/>
- <xsl:variable name="Join_Y" select="$joins_asText_Path_Point/joins_asText/item[@id=$Joins]/As_POINT_to_xml/@Y"/>
- <xsl:attribute name="Join_X" select="$Join_X"/><xsl:attribute name="Join_Y" select="$Join_Y"/>
- <xsl:for-each select="$edge_joins_filled_paths/edge_joins_filled_paths[@id=$ID_Way]/item/bp:Path_Point">
- <xsl:choose>
- <xsl:when test="@X=$Join_Y and @Y=$Join_Y">
- <found_in_path_in_edge_joins_filled_path>
- <xsl:copy-of select="."/>
- </found_in_path_in_edge_joins_filled_path>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </cable_to_PE_to_be_calculated>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </cables_from_joins_to_PE>
- </xsl:template>
-
-
- <xsl:template match="edge_joins_filled_paths" mode="edge_joins_filled_paths">
- <edge_joins_filled_paths>
- <xsl:apply-templates mode="edge_joins_filled_paths"/>
- </edge_joins_filled_paths>
- </xsl:template>
-
- <xsl:template match="item" mode="edge_joins_filled_paths">
- <item>
- <xsl:copy-of select="@*"/>
- <xsl:copy-of select="tried"/>
- <xsl:apply-templates/>
- </item>
- </xsl:template>
-
- <xsl:template match="joins_asText" mode="joins_asText">
- <joins_asText>
- <xsl:apply-templates mode="joins_asText"/>
- </joins_asText>
- </xsl:template>
-
- <xsl:template match="item" mode="joins_asText">
- <item>
- <xsl:copy-of select="@*"/>
- <xsl:call-template name="As_POINT_to_xml">
- <xsl:with-param name="As_POINT" select="text()"/>
- </xsl:call-template>
- </item>
- </xsl:template>
-
- <!-- todo do wypchniecia do funkcji ogolnych -->
- <xsl:template name="As_POINT_to_xml">
- <xsl:param name="As_POINT"/>
- <xsl:variable name="As_POINT_tok" select=" substring-before( substring-after(normalize-space(.),'POINT (') , ')') "/>
- <!--<test1><xsl:copy-of select="$LINESTRING"/></test1>-->
- <xsl:variable name="As_POINT_pos">
- <xsl:for-each select="tokenize($As_POINT_tok,' ')">
- <pos>
- <xsl:attribute name="pos" select="position()"/>
- <xsl:value-of select="."/>
- </pos>
- </xsl:for-each>
- </xsl:variable>
- <As_POINT_to_xml>
- <xsl:attribute name="X" select="$As_POINT_pos/pos[@pos=1]"/>
- <xsl:attribute name="Y" select="$As_POINT_pos/pos[@pos=2]"/>
- </As_POINT_to_xml>
- </xsl:template>
-
-
- </xsl:stylesheet>
|