ways_as_Text_z_ID_xml.xsl 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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="pos" select="position()"/>
  21. <xsl:attribute name="ID_Way" select="$ways2drogi/ways2drogi/item[@id= current()/@id]/text()"/>
  22. <xsl:apply-templates/>
  23. </item>
  24. </xsl:template>
  25. <xsl:template match="text()">
  26. <xsl:variable name="asText">
  27. <asText>
  28. <xsl:copy-of select="."/>
  29. </asText>
  30. </xsl:variable>
  31. <xsl:apply-templates select="$asText"/>
  32. </xsl:template>
  33. </xsl:stylesheet>