joins2ways_z_ID_Way.xsl 3.6 KB

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