test_key_prec.xsl 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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:bcgtht="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/bocian-graph-to-html/bcgtht.xsd"
  5. exclude-result-prefixes="xs"
  6. version="2.0">
  7. <xsl:output indent="yes"/>
  8. <xsl:strip-space elements="*"/>
  9. <xsl:key name="preceding-sibling" match="rec" use="preceding-sibling::rec/generate-id()"/>
  10. <xsl:key name="preceding-sibling.kid" match="rec/kid" use="parent::rec/preceding-sibling::rec/kid[ text() = current()/text()]/generate-id()"/>
  11. <!-- bcgtht:clousure.analys.merge/ -->
  12. <xsl:key name="bcgtht:preceding-sibling.clousure.node.unique.descriptor" match="bcgtht:clousure.node.unique.descriptor/pesel" use="parent::*[ following-sibling::bcgtht:clousure.node.unique.descriptor[pesel[text() = '48031702784']]]/following-sibling::bcgtht:clousure.node.unique.descriptor/pesel/generate-id()"/><!-- *[local-name() = current()/local-name()] -->
  13. <xsl:template match="bcgtht:clousure.analys.merge">
  14. <xsl:copy>
  15. <xsl:apply-templates/>
  16. </xsl:copy>
  17. </xsl:template>
  18. <xsl:template match="bcgtht:clousure.node.unique.descriptor">
  19. <xsl:copy>
  20. <xsl:apply-templates mode="pes"/>
  21. </xsl:copy>
  22. </xsl:template>
  23. <xsl:template match="pesel" mode="pes">
  24. <xsl:copy>
  25. <xsl:copy-of select="@*"/>
  26. <CURR_PESEL><xsl:copy-of select="text()"/></CURR_PESEL>
  27. <bcgtht:TEEST_preceding-sibling.clousure.node.unique.descriptor>
  28. <xsl:copy-of select="key('bcgtht:preceding-sibling.clousure.node.unique.descriptor',generate-id(.))"/>
  29. </bcgtht:TEEST_preceding-sibling.clousure.node.unique.descriptor>
  30. <xsl:apply-templates/>
  31. </xsl:copy>
  32. </xsl:template>
  33. <xsl:template match="*" mode="#all"/>
  34. <xsl:template match="text()|comment()">
  35. <!--<xsl:copy-of select="."/>-->
  36. </xsl:template>
  37. <xsl:template match="xml">
  38. <xsl:copy>
  39. <xsl:apply-templates/>
  40. </xsl:copy>
  41. </xsl:template>
  42. <xsl:template match="rec">
  43. <xsl:copy>
  44. <xsl:copy-of select="@*"/>
  45. <preceding-sibling>
  46. <xsl:copy-of select="key('preceding-sibling',generate-id())"/>
  47. </preceding-sibling>
  48. <xsl:apply-templates/>
  49. </xsl:copy>
  50. </xsl:template>
  51. <xsl:template match="kid">
  52. <xsl:copy>
  53. <xsl:copy-of select="@*"/>
  54. <preceding-sibling.kid>
  55. <xsl:copy-of select="key('preceding-sibling.kid',generate-id())"/>
  56. </preceding-sibling.kid>
  57. </xsl:copy>
  58. </xsl:template>
  59. </xsl:stylesheet>