ways_as_Text_z_ID_xml.xsl 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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:output indent="yes"/>
  11. <xsl:strip-space elements="*"/>
  12. <xsl:template match="ways_asText">
  13. <ways_asText_z_ID_xml>
  14. <xsl:apply-templates/>
  15. </ways_asText_z_ID_xml>
  16. </xsl:template>
  17. <xsl:template match="item">
  18. <item>
  19. <xsl:copy-of select="@*"/>
  20. <xsl:attribute name="ID_Way" select="$ways2drogi/ways2drogi/item[@id= current()/@id]/text()"/>
  21. <xsl:apply-templates/>
  22. </item>
  23. </xsl:template>
  24. <xsl:template match="text()">
  25. <xsl:variable name="asText">
  26. <asText>
  27. <xsl:copy-of select="."/>
  28. </asText>
  29. </xsl:variable>
  30. <xsl:apply-templates select="$asText"/>
  31. </xsl:template>
  32. </xsl:stylesheet>