joins2ways_z_ID_Way.xsl 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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:template match="joins2ways">
  12. <joins2ways_z_ID_Way>
  13. <xsl:variable name="joins2ways">
  14. <xsl:apply-templates>
  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. <item>
  25. <xsl:copy-of select="@*"/>
  26. <xsl:if test="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()">
  27. <xsl:attribute name="ID_Way" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()"/>
  28. </xsl:if>
  29. <xsl:for-each select="item">
  30. <xsl:element name="item">
  31. <xsl:attribute name="id" select="@id"/>
  32. <xsl:attribute name="ID_WAY" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/text()]/text()"/>
  33. <xsl:copy-of select="text()"/>
  34. </xsl:element>
  35. </xsl:for-each>
  36. </item>
  37. </xsl:template>
  38. </xsl:stylesheet>