joins2ways_z_ID_Way.xsl 1.3 KB

123456789101112131415161718192021222324252627282930313233
  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:apply-templates/>
  14. </joins2ways_z_ID_Way>
  15. </xsl:template>
  16. <xsl:template match="item">
  17. <item>
  18. <xsl:copy-of select="@*"/>
  19. <xsl:if test="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()">
  20. <xsl:attribute name="ID_Way" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/item[1]/text()]/text()"/>
  21. </xsl:if>
  22. <xsl:for-each select="item">
  23. <xsl:element name="item">
  24. <xsl:attribute name="id" select="@id"/>
  25. <xsl:attribute name="ID_WAY" select="$ways_2ID_Way/ways_2ID_Way/item[@id=current()/text()]/text()"/>
  26. </xsl:element>
  27. </xsl:for-each>
  28. </item>
  29. </xsl:template>
  30. </xsl:stylesheet>