p5dkp.comment.xsl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:p5bws="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/WPS_Functions.xsd"
  5. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  6. xmlns:p5dkp.comment="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.comment.xsd"
  7. xmlns:p5dkp="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd"
  8. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. xmlns:p5suis="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/system_ui_info_speech/system_ui_info_speech.xsd"
  10. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  11. exclude-result-prefixes="xs"
  12. version="2.0">
  13. <xsl:output indent="yes"/>
  14. <xsl:param name="p5dkp.comment:xsd" required="yes"/>
  15. <xsl:strip-space elements="*"/>
  16. <!-- do statystyk suyis -->
  17. <xsl:template match="p5dkp:map.keys.xml" mode="p5dkp:comment.xml #default">
  18. <p5dkp.comment:comment.xml xsi:noNamespaceSchemaLocation="{$p5dkp.comment:xsd}">
  19. <xsl:variable name="elementy">
  20. <elementy>
  21. <xsl:apply-templates mode="p5dkp:comment.xml" select=".//*"/>
  22. </elementy>
  23. </xsl:variable>
  24. <!--<DEBUG>
  25. <xsl:copy-of select="$elementy"/>
  26. </DEBUG>-->
  27. <xsl:for-each-group select="$elementy/elementy/*" group-by="name()">
  28. <xsl:element name="{name()}">
  29. <xsl:attribute name="p5suis:group.name" select="name()"/>
  30. <xsl:attribute name="p5suis:group-desc" select="'child::local-name()'"/>
  31. <xsl:attribute name="p5suis:group.by" select="'child::local-name()'"/>
  32. <xsl:for-each select="current-group()/*">
  33. <xsl:element name="{name()}">
  34. <xsl:copy-of select=".//@*"/>
  35. </xsl:element>
  36. </xsl:for-each>
  37. </xsl:element>
  38. </xsl:for-each-group>
  39. </p5dkp.comment:comment.xml>
  40. </xsl:template>
  41. <xsl:template match="*" mode="p5dkp:comment.xml"/>
  42. <xsl:template mode="p5dkp:comment.xml" match="keydef">
  43. <!-- p5suis:group.name="worker" p5suis:group.by="child::local-name()" p5suis:group-desc="child::local-name()" -->
  44. <xsl:variable name="keys">
  45. <xsl:choose>
  46. <xsl:when test=" string-length(map.keys.eval/keys[last()]/@map.keys.eval) &gt; ( string-length(@keys) + 2 ) "> <!-- + 2 bo kropka -->
  47. <xsl:message>#28 @map.keys.eval
  48. keys = <xsl:value-of select="@keys"/>
  49. last = <xsl:value-of select="map.keys.eval/keys[ last()]/@map.keys.eval"/>
  50. second <xsl:value-of select="map.keys.eval/keys[ 2]/@map.keys.eval"/>
  51. </xsl:message>
  52. <xsl:value-of select="map.keys.eval/keys[last()]/@map.keys.eval"/>
  53. </xsl:when>
  54. <xsl:otherwise>
  55. <xsl:value-of select="@keys"/>
  56. </xsl:otherwise>
  57. </xsl:choose>
  58. </xsl:variable>
  59. <xsl:call-template name="p5dkp:structurize">
  60. <xsl:with-param name="keys" select="$keys"/>
  61. <xsl:with-param name="keys.keyscope" select="@keys.keyscope"/>
  62. <xsl:with-param name="keyword" select="topicmeta/keywords/keyword/text()"/>
  63. <xsl:with-param name="keyref" select="@keyref"/>
  64. </xsl:call-template>
  65. </xsl:template>
  66. <xsl:template match="text()|comment()" mode="p5suis:p5suis.p5suis.say_to_queue.copy_file"/>
  67. <xsl:template name="p5dkp:structurize">
  68. <xsl:param name="keys" required="yes"/>
  69. <xsl:param name="pos" select="1"/>
  70. <xsl:param name="keys.keyscope"/>
  71. <xsl:param name="keyword"/>
  72. <xsl:param name="keyref"/>
  73. <xsl:for-each select="tokenize($keys,'\.')[$pos]">
  74. <xsl:variable name="name">
  75. <xsl:choose>
  76. <xsl:when test="string(number(.)) != 'NaN'">
  77. <xsl:value-of select="concat('_',.)"/>
  78. </xsl:when>
  79. <xsl:otherwise>
  80. <xsl:value-of select="."/>
  81. </xsl:otherwise>
  82. </xsl:choose>
  83. </xsl:variable>
  84. <xsl:element name="{$name}">
  85. <xsl:copy-of select="$keys.keyscope"/>
  86. <xsl:copy-of select="$keyref"/>
  87. <xsl:copy-of select="$keyword"/>
  88. <xsl:call-template name="p5dkp:structurize">
  89. <xsl:with-param name="pos" select="$pos + 1"/>
  90. <xsl:with-param name="keys" select="$keys"/>
  91. </xsl:call-template>
  92. </xsl:element>
  93. </xsl:for-each>
  94. </xsl:template>
  95. </xsl:stylesheet>