joins2ways_z_ID_Way.xsl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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:param name="ways_2ID_Way.xml" select="'ways_2ID_Way.xml'"/>
  10. <xsl:variable name="ways_2ID_Way" select="doc($ways_2ID_Way.xml)"/>
  11. <xsl:variable name="points2joins" select="doc('points2joins.xml')"/>
  12. <xsl:template match="joins2ways">
  13. <joins2ways_z_ID_Way>
  14. <xsl:variable name="joins2ways">
  15. <xsl:apply-templates/>
  16. </xsl:variable>
  17. <xsl:for-each select="$joins2ways/item">
  18. <!--<xsl:sort select="number(@ID_Way)"/>-->
  19. <xsl:copy-of select="."/>
  20. </xsl:for-each>
  21. </joins2ways_z_ID_Way>
  22. </xsl:template>
  23. <xsl:template match="item">
  24. <xsl:variable name="item" select="."/>
  25. <xsl:variable name="ID_Point" select="$points2joins/points2joins/item[text()= current()/@id]/@id"/>
  26. <xsl:variable name="items">
  27. <xsl:for-each select="item">
  28. <item>
  29. <xsl:copy-of select="$item/@*"/>
  30. <xsl:attribute name="ID_Way" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/text()]/text()"/>
  31. <xsl:if test="$ID_Point">
  32. <xsl:attribute name="ID_Point" select="$ID_Point"/>
  33. </xsl:if>
  34. <xsl:attribute name="item_copied_pos" select="position()"/>
  35. <xsl:for-each select="$item/item">
  36. <xsl:element name="item">
  37. <xsl:attribute name="id" select="@id"/>
  38. <xsl:attribute name="ID_WAY" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/text()]/text()"/>
  39. <xsl:copy-of select="text()"/>
  40. </xsl:element>
  41. </xsl:for-each>
  42. </item>
  43. </xsl:for-each>
  44. </xsl:variable>
  45. <xsl:for-each-group select="$items/item" group-by="@ID_Way">
  46. <item>
  47. <xsl:copy-of select="@*"/>
  48. <!--<xsl:attribute name="ID_Way_count" select="$ID_Way_count"/>-->
  49. <xsl:copy-of select="item"/>
  50. </item>
  51. </xsl:for-each-group>
  52. <!--<item>
  53. <xsl:copy-of select="@*"/>
  54. <xsl:if test="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()">
  55. <xsl:attribute name="ID_Way" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()"/>
  56. </xsl:if>
  57. <xsl:if test="$points2joins/points2joins/item[text()= current()/@id]">
  58. <xsl:attribute name="ID_Point" select="$points2joins/points2joins/item[text()= current()/@id]/@id"/>
  59. </xsl:if>
  60. <xsl:for-each select="item">
  61. <xsl:element name="item">
  62. <xsl:attribute name="id" select="@id"/>
  63. <xsl:attribute name="ID_WAY" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/text()]/text()"/>
  64. <xsl:copy-of select="text()"/>
  65. </xsl:element>
  66. </xsl:for-each>
  67. </item>-->
  68. <!-- dorzucenie do joins sztucznie joinow jako ze pochodza z innych ID_Way -->
  69. </xsl:template>
  70. </xsl:stylesheet>