edge_joins_filled_paths.xsl 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:bp="https://procesy5.pl/biale_plamy-schema.xsd"
  5. exclude-result-prefixes="xs"
  6. version="2.0">
  7. <xsl:output indent="yes"/>
  8. <xsl:strip-space elements="*"/>
  9. <xsl:variable name="test"/>
  10. <!--//match edge_joins_filled_paths-->
  11. <xsl:template match="edge_joins_filled_paths">
  12. <xsl:variable name="PE_track">
  13. <xsl:apply-templates/>
  14. </xsl:variable>
  15. <xsl:variable name="PE_track">
  16. <xsl:for-each select="$PE_track/LINESTRING">
  17. <LINESTRING>
  18. <xsl:attribute name="Count" select="count(*)"/>
  19. <xsl:copy-of select="@*"/>
  20. <xsl:copy-of select="test1"/>
  21. <xsl:for-each select="bp:Path_Point">
  22. <bp:Path_Point>
  23. <xsl:copy-of select="@*"/>
  24. <xsl:attribute name="Pos" select="position()"/>
  25. <xsl:copy-of select="."/>
  26. </bp:Path_Point>
  27. </xsl:for-each>
  28. </LINESTRING>
  29. </xsl:for-each>
  30. </xsl:variable>
  31. <edge_paths_with_PE>
  32. <!--<PE_track>
  33. <xsl:copy-of select="$PE_track"/>
  34. </PE_track>-->
  35. <xsl:copy-of select="$PE_track"/>
  36. </edge_paths_with_PE>
  37. </xsl:template>
  38. <xsl:template match="item">
  39. <xsl:choose>
  40. <xsl:when test="asText">
  41. <LINESTRING>
  42. <xsl:attribute name="ID_Way" select="@id"/>
  43. <xsl:attribute name="distance" select="distance/text()"/>
  44. <xsl:apply-templates/>
  45. </LINESTRING>
  46. </xsl:when>
  47. <xsl:otherwise>
  48. <bp:Path_Not_Found>
  49. <xsl:attribute name="ID_Way" select="@id"/>
  50. </bp:Path_Not_Found>
  51. </xsl:otherwise>
  52. </xsl:choose>
  53. </xsl:template>
  54. <!--<asText>LINESTRING (18.636657356658 51.253416226324, 18.6366871 51.253538999079, 18.6367062
  55. 51.253605499079, 18.6368933 51.25441199908, 18.6369493 51.254670399079, 18.6370223
  56. 51.254905799079, 18.6370965 51.255053899079, 18.6371814 51.255153699079, 18.637252
  57. 51.255236599079, 18.63765 51.255476599079, 18.6386978 51.255913099079, 18.6414059
  58. 51.257032799079, 18.6449346 51.25849289908, 18.6467805 51.25926169908, 18.64743915153
  59. 51.259545049387)</asText>-->
  60. <xsl:template match="asText">
  61. <xsl:variable name="LINESTRING" select=" substring-before( substring-after(.,'LINESTRING (') , ')') "/>
  62. <test1><xsl:copy-of select="$LINESTRING"/></test1>
  63. <xsl:for-each select="tokenize($LINESTRING,', ')">
  64. <bp:Path_Point>
  65. <test2><xsl:copy-of select="."/></test2>
  66. <xsl:for-each select="tokenize(.,' ')">
  67. <pos>
  68. <xsl:attribute name="pos" select="position()"/>
  69. <xsl:value-of select="."/>
  70. </pos>
  71. </xsl:for-each>
  72. </bp:Path_Point>
  73. </xsl:for-each>
  74. </xsl:template>
  75. </xsl:stylesheet>