p5dkp.xsl 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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:import href="p5dkp.keyscope.xsl"/>
  16. <!--<xsl:import href="p5dkp.map.keys.files.xsl"/>-->
  17. <xsl:import href="p5dkp.map.keys.xsl"/>
  18. <xsl:import href="p5dkp.true.path.xsl"/>
  19. <xsl:import href="p5dkp.fix-glossgroup.xsl"/>
  20. <xsl:import href="p5dkp.fix-topic.xsl"/>
  21. <xsl:import href="p5dkp.ditamap_to_reltable.xsl"/>
  22. <xsl:output indent="yes" method="xml" standalone="yes" exclude-result-prefixes="ditaarch"/>
  23. <!--<xsl:output indent="yes" method="xml" standalone="no" doctype-public="-//OASIS//DTD DITA Glossary Group//EN" doctype-system="glossgroup.dtd"/>-->
  24. <xsl:strip-space elements="*"/>
  25. <xsl:param name="basedir"/>
  26. <xsl:param name="debug"/>
  27. <xsl:param name="p5dkp:xsd" required="yes"/>
  28. <xsl:param name="dita_root_path" required="yes"/> <!-- select="'/Users/a.binder/procesy5-dita-templates-druki/6927.Projekt_Badawczo_Roz_Procesy5_Stratego/PrzebiegProjektu/Budzet_Adam_Arek/'" -->
  29. <xsl:param name="dita_out_dir" required="yes" /> <!-- select="'/Users/a.binder/procesy5-dita-templates-druki/6927.Projekt_Badawczo_Roz_Procesy5_Stratego/PrzebiegProjektu/Budzet_Adam_Arek/generated_operat/'" -->
  30. <!--<xsl:param name="zadania_z_google.xml" select="'/Users/a.binder/procesy5-dita-templates-druki/6927.Projekt_Badawczo_Roz_Procesy5_Stratego/PrzebiegProjektu/Budzet_Adam_Arek/zadania_z_googledocs/zadania_z_google.xml'"/>-->
  31. <xsl:param name="p5dkp.zadania_z_google.xml.ditamap"/>
  32. <xsl:param name="p5dkp.repository"/>
  33. <xsl:param name="p5dkp.MATRYCA_PROJEKTU_BUDZET_ETAP_ROLA_PRACOWNIK.szablony"/>
  34. <xsl:param name="p5dkp:to_reltable.force" />
  35. <xsl:param name="system_cache__dita:props.disable"/><!-- to filter content in development progress - like devel_level_1 devel_level_2-->
  36. <!--<xsl:param name="procesy5-dita-templates-druki.symlink" select="'/Users/a.binder/procesy5-dita-templates-druki.symlink'"/>-->
  37. <!--<xsl:param name="procesy5-dita-templates-druki" select="'/Users/a.binder/procesy5-dita-templates-druki'"/>-->
  38. <xsl:function name="p5dkp:href.no.component">
  39. <xsl:param name="href"/>
  40. <xsl:choose>
  41. <xsl:when test="contains($href,'#')">
  42. <xsl:value-of select="substring-before($href,'#')"/>
  43. </xsl:when>
  44. <xsl:otherwise>
  45. <xsl:value-of select="$href"/>
  46. </xsl:otherwise>
  47. </xsl:choose>
  48. </xsl:function>
  49. <xsl:template match="map" mode="p5dkp:map.keys.xml">
  50. <xsl:variable name="keyscope" select="p5dkp:keyscope.init()"/>
  51. <p5dkp:map.keys.xml xsi:schemaLocation="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd {$p5dkp:xsd}">
  52. <xsl:apply-templates mode="p5dkp:map.keys">
  53. <xsl:with-param name="map.path" select="$dita_root_path"/>
  54. <xsl:with-param name="keyscope" select="$keyscope"/>
  55. </xsl:apply-templates>
  56. <xsl:message>#37 trying to open <xsl:value-of select="$p5dkp.zadania_z_google.xml.ditamap"/></xsl:message>
  57. <xsl:choose>
  58. <xsl:when test=" doc-available($p5dkp.zadania_z_google.xml.ditamap)">
  59. <xsl:message>#40 parsing $p5dkp.zadania_z_google.xml.ditamap = <xsl:value-of select="$p5dkp.zadania_z_google.xml.ditamap"/>; </xsl:message>
  60. <xsl:apply-templates mode="p5dkp:map.keys" select="doc($p5dkp.zadania_z_google.xml.ditamap)">
  61. <xsl:with-param name="map.path" select="$dita_root_path"/>
  62. <xsl:with-param name="keyscope" select="$keyscope"/>
  63. </xsl:apply-templates>
  64. </xsl:when>
  65. </xsl:choose>
  66. </p5dkp:map.keys.xml>
  67. </xsl:template>
  68. <!--
  69. <xsl:template match="*" mode="p5suis:p5suis.p5suis.say_to_queue.copy_file"/>
  70. <xsl:template mode="p5suis:p5suis.p5suis.say_to_queue.copy_file" match="keydef[contains(@keys,'worker')]">
  71. <p5suis:analyze>
  72. </p5suis:analyze>
  73. </xsl:template>
  74. <xsl:template match="text()|comment()" mode="p5suis:p5suis.p5suis.say_to_queue.copy_file"/>
  75. -->
  76. <xsl:template mode="p5dkp:map.keys" match="topicref[@href ]"> <!-- @format='ditamap' and and not( contains(@href,'operat_koszt_w_b_r.ditamap')) -->
  77. <xsl:param name="map.path" required="yes"/>
  78. <xsl:param name="keyscope" required="yes"/>
  79. <xsl:variable name="p5dkp:true.path" select="p5dkp:true.path(concat($map.path,'/',p5dkp:href.no.component(@href)))"/>
  80. <xsl:copy>
  81. <!--<xsl:copy-of select="@*"/>-->
  82. <xsl:variable name="keyscope">
  83. <xsl:call-template name="p5dkp:keyscope">
  84. <xsl:with-param name="keyscope" select="$keyscope"/>
  85. <xsl:with-param name="keyscope.attr" select="@keyscope"/>
  86. </xsl:call-template>
  87. </xsl:variable>
  88. <xsl:apply-templates select="@*" mode="p5dkp:map.keys">
  89. <xsl:with-param name="keyscope" select="$keyscope"/>
  90. </xsl:apply-templates>
  91. <xsl:attribute name="map.path" select="$map.path"/>
  92. <xsl:apply-templates mode="p5dkp:map.keys.eval" select="@*">
  93. <xsl:with-param name="keyscope" select="$keyscope"/>
  94. </xsl:apply-templates>
  95. <!--<DEBUG1107>-->
  96. <xsl:apply-templates mode="#current">
  97. <xsl:with-param name="map.path" select="$map.path"/>
  98. <xsl:with-param name="keyscope" select="$keyscope"/>
  99. </xsl:apply-templates>
  100. <!--</DEBUG1107>-->
  101. <xsl:variable name="path.tokens" select="tokenize(@href,'/')[ count( tokenize( current()/@href,'/' )) ]"/>
  102. <xsl:variable name="path" select=" substring-before(@href,$path.tokens)"/>
  103. <xsl:message>#50 path.tokens is <xsl:value-of select="$path.tokens"/>; $path = <xsl:value-of select="$path"/></xsl:message>
  104. <xsl:message>Openning <xsl:value-of select="$dita_root_path"/>/<xsl:value-of select="$path"/>/<xsl:value-of select="@href"/> ;</xsl:message>
  105. <xsl:message>Openning2 <xsl:value-of select="$map.path"/>/<xsl:value-of select="@href"/> ;</xsl:message>
  106. <xsl:message>#158 $system_cache__dita:props.disable = <xsl:value-of select="$system_cache__dita:props.disable"/></xsl:message>
  107. <xsl:variable name="system_cache__dita:props.disable.test">
  108. <xsl:for-each select="tokenize(@props,' ')">
  109. <xsl:if test="contains($system_cache__dita:props.disable,.)">
  110. <system_cache__dita:props.disable.test>DISABLED by @prop = <xsl:value-of select="."/></system_cache__dita:props.disable.test>
  111. </xsl:if>
  112. </xsl:for-each>
  113. </xsl:variable>
  114. <xsl:choose>
  115. <xsl:when test="string-length($system_cache__dita:props.disable) &gt; 0 and $system_cache__dita:props.disable.test/*">
  116. <xsl:message>#159 TEMPORARY DISABLED <xsl:value-of select="@href"/> by $system_cache__dita:props.disable = <xsl:value-of select="$system_cache__dita:props.disable"/> ; $system_cache__dita:props.disable.test = <xsl:copy-of select="$system_cache__dita:props.disable.test" copy-namespaces="no"/></xsl:message>
  117. </xsl:when>
  118. <xsl:otherwise>
  119. <xsl:choose>
  120. <!--<xsl:when test="contains(@href,'p5dkp.zadania_z_google.xml.ditamap')">
  121. <xsl:message>#151 bypasing self generated file p5dkp.zadania_z_google.xml.ditamap = <xsl:value-of select="$p5dkp.zadania_z_google.xml.ditamap"/> ;</xsl:message>
  122. </xsl:when>-->
  123. <xsl:when test="@format='ditamap'">
  124. <xsl:choose>
  125. <xsl:when test="contains(p5dkp:href.no.component(@href),'.reltable.ditamap')">
  126. <xsl:message>#197777 contains reltable.ditamap=<xsl:value-of select="@href"/>;;</xsl:message>
  127. </xsl:when>
  128. <xsl:when test="string-length(string($p5dkp:to_reltable.force)) &gt; 0">
  129. <xsl:message>#179 fixing to mode="p5dkp:to_reltable" for file src <xsl:value-of select="concat($map.path,'/',p5dkp:href.no.component(@href))"/> ; </xsl:message>
  130. <xsl:apply-templates mode="p5dkp:to_reltable" select="doc(concat($map.path,'/',p5dkp:href.no.component(@href)))">
  131. <xsl:with-param name="map.path" select="$map.path"/>
  132. <xsl:with-param name="keyscope" select="$keyscope"/>
  133. <xsl:with-param name="href" select="p5dkp:href.no.component(@href)"/>
  134. </xsl:apply-templates>
  135. </xsl:when>
  136. </xsl:choose>
  137. <xsl:apply-templates mode="#current" select="doc(concat($map.path,'/',p5dkp:href.no.component(@href)))"> <!-- doc(concat($path,'/',@href)) -->
  138. <xsl:with-param name="map.path" select="concat($map.path,'/',$path)"/>
  139. <xsl:with-param name="keyscope" select="$keyscope"/>
  140. </xsl:apply-templates>
  141. </xsl:when>
  142. <xsl:otherwise>
  143. <!-- zajrzyjmy jednak do topicow zeby poszukac tresci do analizy co jest w srodku -->
  144. <xsl:apply-templates mode="#current" select="doc(concat($map.path,'/',p5dkp:href.no.component(@href)))"> <!-- doc(concat($path,'/',@href)) -->
  145. <!--<xsl:with-param name="map.path" select="concat($map.path,'/',$path)"/>-->
  146. <xsl:with-param name="keyscope" select="$keyscope"/>
  147. </xsl:apply-templates>
  148. <p5dkp:true.path>
  149. <xsl:copy-of select="$p5dkp:true.path"/>
  150. <xsl:message>#172 $p5dkp:true.path = <xsl:copy-of select="$p5dkp:true.path" copy-namespaces="no"/></xsl:message>
  151. </p5dkp:true.path>
  152. <xsl:choose>
  153. <xsl:when test="contains($p5dkp:true.path,$p5dkp.MATRYCA_PROJEKTU_BUDZET_ETAP_ROLA_PRACOWNIK.szablony)">
  154. <xsl:message>#171 igroring contains(concat($map.path,'/',@href),$p5dkp.MATRYCA_PROJEKTU_BUDZET_ETAP_ROLA_PRACOWNIK.szablony) for <xsl:value-of select="concat($map.path,'/',@href)"/></xsl:message>
  155. </xsl:when>
  156. <xsl:otherwise>
  157. <xsl:apply-templates mode="p5dkp:fix-topic" select="doc(concat($map.path,'/',p5dkp:href.no.component(@href)))"> <!-- doc(concat($path,'/',@href)) -->
  158. <xsl:with-param name="map.path" select="$map.path"/>
  159. <xsl:with-param name="keyscope" select="$keyscope"/>
  160. <xsl:with-param name="keyscope.attr" select="@keyscope"/>
  161. <xsl:with-param name="keydef" select="keydef"/>
  162. <xsl:with-param name="href" select="p5dkp:href.no.component(@href)"/>
  163. </xsl:apply-templates>
  164. </xsl:otherwise>
  165. </xsl:choose>
  166. </xsl:otherwise>
  167. </xsl:choose>
  168. <xsl:call-template name="p5dkp:fix-glossgroup">
  169. <xsl:with-param name="file.href" select="concat($map.path,'/',p5dkp:href.no.component(@href))"/>
  170. <xsl:with-param name="map.path" select="$map.path"/>
  171. <xsl:with-param name="keyscope" select="$keyscope"/>
  172. <xsl:with-param name="keyscope.attr" select="@keyscope"/>
  173. <xsl:with-param name="keydef" select="keydef"/>
  174. <xsl:with-param name="href" select="p5dkp:href.no.component(@href)"/>
  175. </xsl:call-template>
  176. </xsl:otherwise>
  177. </xsl:choose>
  178. </xsl:copy>
  179. </xsl:template>
  180. </xsl:stylesheet>