ways_as_Text_z_ID_xml.xsl 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. <xsl:output indent="yes"/>
  16. <xsl:strip-space elements="*"/>
  17. <xsl:template match="ways_asText">
  18. <ways_asText_z_ID_xml>
  19. <xsl:apply-templates/>
  20. </ways_asText_z_ID_xml>
  21. </xsl:template>
  22. <xsl:template match="item">
  23. <item>
  24. <xsl:copy-of select="@*"/>
  25. <xsl:attribute name="pos" select="position()"/>
  26. <xsl:attribute name="ID_Way" select="$ways2drogi/ways2drogi/item[@id= current()/@id]/text()"/>
  27. <xsl:attribute name="len" select="$waysLengths/waysLengths/item[@id= current()/@id]/ round(text())"/>
  28. <xsl:apply-templates/>
  29. </item>
  30. </xsl:template>
  31. <xsl:template match="text()">
  32. <xsl:variable name="asText">
  33. <asText>
  34. <xsl:copy-of select="."/>
  35. </asText>
  36. </xsl:variable>
  37. <xsl:apply-templates select="$asText"/>
  38. </xsl:template>
  39. </xsl:stylesheet>