ways_as_Text_z_ID_xml.xsl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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:import href="asText.xsl"/>
  8. <xsl:param name="ways2drogi.xml" select="'ways2drogi.xml'"/>
  9. <xsl:variable name="ways2drogi" select="doc($ways2drogi.xml)"/>
  10. <xsl:param name="waysLengths.xml" select="'waysLengths.xml'"/>
  11. <xsl:variable name="waysLengths" select="doc($waysLengths.xml)"/>
  12. <!-- <xsl:param name="ways2joins.xml" select="'ways2joins.xml'"/>
  13. <xsl:variable name="ways2joins" select="doc($ways2joins.xml)"/>
  14. -->
  15. <!-- trzeba dorobic aby wskazac czy koniec drogi jest z tego samego WAYa /joinsa ,
  16. czyli biore droge sprawdzam do jakiego jest joina, biore joina i sprawdzam do jakiego jest waya
  17. , sprawdzam jakie inne waye sa z tym joinem , szukam
  18. -->
  19. <xsl:output indent="yes"/>
  20. <xsl:strip-space elements="*"/>
  21. <xsl:template match="ways_asText">
  22. <ways_asText_z_ID_xml>
  23. <xsl:apply-templates/>
  24. </ways_asText_z_ID_xml>
  25. </xsl:template>
  26. <xsl:template match="item">
  27. <item>
  28. <xsl:copy-of select="@*"/>
  29. <xsl:attribute name="pos" select="position()"/>
  30. <xsl:attribute name="ID_Way" select="$ways2drogi/ways2drogi/item[@id= current()/@id]/text()"/>
  31. <xsl:attribute name="len" select="$waysLengths/waysLengths/item[@id= current()/@id]/ round(text())"/>
  32. <xsl:apply-templates/>
  33. </item>
  34. </xsl:template>
  35. <xsl:template match="text()">
  36. <xsl:variable name="asText">
  37. <asText>
  38. <xsl:copy-of select="."/>
  39. </asText>
  40. </xsl:variable>
  41. <xsl:apply-templates select="$asText"/>
  42. </xsl:template>
  43. </xsl:stylesheet>