p5dkp.map.keys.xsl 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd"
  7. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  8. xmlns:p5suis="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/system_ui_info_speech/system_ui_info_speech.xsd"
  9. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  10. xmlns:p5xsda="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/xsd_asserts/p5xsda.xsd"
  11. xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
  12. xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
  13. exclude-result-prefixes="xs ditaarch"
  14. version="2.0">
  15. <!--<xsl:include href="p5dkp.keyscope.xsl"/>-->
  16. <xsl:template mode="p5dkp:map.keys" match="@class"/>
  17. <xsl:template mode="p5dkp:map.keys" match="@*">
  18. <xsl:param name="keyscope"/>
  19. <xsl:copy-of select="."/>
  20. </xsl:template>
  21. <xsl:template mode="p5dkp:map.keys" match="@keys">
  22. <xsl:param name="keyscope"/>
  23. <!--<xsl:copy-of select="."/>-->
  24. <xsl:copy-of select="."/>
  25. <xsl:variable name="current" select="."/>
  26. <xsl:attribute name="keys.keyscope">
  27. <xsl:for-each select="$keyscope/keyscope/key">
  28. <xsl:choose>
  29. <xsl:when test="string-length(current()) = 0">
  30. <xsl:value-of select="$current"/>
  31. </xsl:when>
  32. <xsl:otherwise>
  33. <xsl:value-of select="concat(current(),'.',$current)"/>
  34. </xsl:otherwise>
  35. </xsl:choose>
  36. <xsl:if test="not(position() = last())"><xsl:text> </xsl:text></xsl:if>
  37. </xsl:for-each>
  38. </xsl:attribute>
  39. </xsl:template>
  40. <xsl:template mode="p5dkp:map.keys.eval" match="@*"/>
  41. <!-- <map.keys.keyscope>
  42. <keys map.keys.eval="event.KIKE_wydarzenia_2008__2018"/>
  43. <keys map.keys.eval="event.2008__2018_wydarzen"/>
  44. </map.keys.keyscope>
  45. <map.keys.eval>
  46. <keys map.keys.eval="w_2008_roku_za_o_enie_kike_przez_arkadiusz_binder.dita"/>
  47. <keys map.keys.eval="event.KIKE_wydarzenia_2008__2018.w_2008_roku_za_o_enie_kike_przez_arkadiusz_binder.dita"/>
  48. <keys map.keys.eval="event.2008__2018_wydarzen.w_2008_roku_za_o_enie_kike_przez_arkadiusz_binder.dita"/>
  49. </map.keys.eval>
  50. event.KIKE_wydarzenia_2008__2018 - event.2008__2018_wydarzen - w_2008_roku_za_o_enie_kike_przez_arkadiusz_binder.dita
  51. event.KIKE_wydarzenia_2008__2018.event.2008__2018_wydarzen.w_2008_roku_za_o_enie_kike_przez_arkadiusz_binder.dita
  52. =
  53. #1 + #2 + @keys
  54. -->
  55. <xsl:template name="p5dkp:map.keys.eval"><!-- to force create map.keys.eval elements -->
  56. <xsl:param name="keyscope"/>
  57. <xsl:param name="keys.attr" required="no"/>
  58. <map.keys.eval>
  59. <xsl:for-each select="$keyscope/keyscope/key">
  60. <xsl:choose>
  61. <xsl:when test="string-length(current()) = 0 and string-length($keys.attr) = 0"/>
  62. <xsl:when test="string-length(current()) = 0">
  63. <keys>
  64. <xsl:attribute name="map.keys.eval" select="$keys.attr"/>
  65. </keys>
  66. </xsl:when>
  67. <xsl:otherwise>
  68. <keys>
  69. <xsl:choose>
  70. <xsl:when test="string-length($keys.attr) = 0">
  71. <xsl:attribute name="map.keys.eval" select="."/>
  72. </xsl:when>
  73. <xsl:otherwise>
  74. <xsl:attribute name="map.keys.eval" select="concat(current(),'.',$keys.attr)"/>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. </keys>
  78. </xsl:otherwise>
  79. </xsl:choose>
  80. </xsl:for-each>
  81. <xsl:comment>#83 </xsl:comment>
  82. <xsl:choose>
  83. <xsl:when test="$keyscope//key[ string-length(@map.keys.eval) &gt; 0 ] or string-length($keys.attr) &gt; 0">
  84. <keys>
  85. <xsl:attribute name="map.keys.eval">
  86. <xsl:for-each select="$keyscope/keyscope/key">
  87. <xsl:choose>
  88. <xsl:when test="position() = last()">
  89. <xsl:if test="string-length(current()) &gt; 0"><xsl:value-of select="."/></xsl:if>
  90. <xsl:choose>
  91. <xsl:when test="string-length($keys.attr)"><xsl:text>.</xsl:text><xsl:value-of select="$keys.attr"/></xsl:when>
  92. </xsl:choose>
  93. </xsl:when>
  94. <xsl:otherwise>
  95. <xsl:if test="string-length(current()) &gt; 0"><xsl:value-of select="."/><xsl:text>.</xsl:text></xsl:if>
  96. </xsl:otherwise>
  97. </xsl:choose>
  98. </xsl:for-each>
  99. </xsl:attribute>
  100. </keys>
  101. </xsl:when>
  102. </xsl:choose>
  103. </map.keys.eval>
  104. </xsl:template>
  105. <xsl:template mode="p5dkp:map.keys.eval" match="@keys">
  106. <xsl:param name="keyscope"/>
  107. <xsl:call-template name="p5dkp:map.keys.eval">
  108. <xsl:with-param name="keys.attr" select="."/>
  109. <xsl:with-param name="keyscope" select="$keyscope"/>
  110. </xsl:call-template>
  111. <!--<xsl:variable name="current" select="."/>
  112. <map.keys.eval>
  113. <xsl:for-each select="$keyscope/keyscope/key">
  114. <keys>
  115. <xsl:choose>
  116. <xsl:when test="string-length(current()) = 0">
  117. <xsl:attribute name="map.keys.eval" select="$current"/>
  118. </xsl:when>
  119. <xsl:otherwise>
  120. <xsl:attribute name="map.keys.eval" select="concat(current(),'.',$current)"/>
  121. </xsl:otherwise>
  122. </xsl:choose>
  123. </keys>
  124. </xsl:for-each>
  125. </map.keys.eval>-->
  126. </xsl:template>
  127. <xsl:template name="p5dkp:map.keys.keyscope">
  128. <xsl:param name="keyscope"/>
  129. <map.keys.keyscope>
  130. <xsl:for-each select="$keyscope/keyscope/key">
  131. <xsl:choose>
  132. <xsl:when test="string-length(.) &gt; 0 ">
  133. <keys > <!-- todo xml:id="{.}" -->
  134. <xsl:attribute name="map.keys.eval" select="."/>
  135. </keys>
  136. </xsl:when>
  137. </xsl:choose>
  138. </xsl:for-each>
  139. </map.keys.keyscope>
  140. </xsl:template>
  141. <xsl:template mode="p5dkp:map.keys" match="*">
  142. <xsl:param name="map.path"/>
  143. <xsl:param name="keyscope" required="yes"/>
  144. <xsl:param name="audience"/>
  145. <!--<xsl:param name="p5dkp:map.keys.files" required="yes"/>-->
  146. <xsl:copy>
  147. <xsl:variable name="keyscope">
  148. <xsl:call-template name="p5dkp:keyscope">
  149. <xsl:with-param name="keyscope" select="$keyscope"/>
  150. <xsl:with-param name="keyscope.attr" select="@keyscope"/>
  151. </xsl:call-template>
  152. </xsl:variable>
  153. <xsl:apply-templates mode="p5dkp:map.keys" select="@*">
  154. <xsl:with-param name="keyscope" select="$keyscope"/>
  155. </xsl:apply-templates>
  156. <xsl:if test="$map.path"><xsl:attribute name="map.path" select="$map.path"/></xsl:if>
  157. <xsl:apply-templates mode="p5dkp:map.keys.eval" select="@*">
  158. <xsl:with-param name="keyscope" select="$keyscope"/>
  159. </xsl:apply-templates>
  160. <!--<xsl:copy-of select="$keyscope"/>-->
  161. <!--<xsl:apply-templates mode="p5suis:p5suis.p5suis.say_to_queue.copy_file" select="."/>-->
  162. <xsl:choose>
  163. <xsl:when test="$audience">
  164. <!-- BYPASS output loop from dkp5.ditafiles. -->
  165. </xsl:when>
  166. <xsl:otherwise>
  167. <xsl:apply-templates mode="#current">
  168. <xsl:with-param name="map.path" select="$map.path"/>
  169. <xsl:with-param name="keyscope" select="$keyscope"/>
  170. <xsl:with-param name="audience" select="$audience"/>
  171. <!--<xsl:with-param name="p5dkp:map.keys.files" select="$p5dkp:map.keys.files"/>-->
  172. </xsl:apply-templates>
  173. </xsl:otherwise>
  174. </xsl:choose>
  175. </xsl:copy>
  176. </xsl:template>
  177. </xsl:stylesheet>