p5frc.xsl 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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:p5frc="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/flat_relation_cache/p5frc.xsd"
  7. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  8. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. xmlns:p5dkp="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd"
  10. exclude-result-prefixes="xs"
  11. version="2.0">
  12. <xsl:output indent="yes"/>
  13. <xsl:strip-space elements="*"/>
  14. <xsl:param name="p5frc:basedir"/>
  15. <xsl:param name="p5dkp.local.idref.xsl" required="yes"/>
  16. <xsl:param name="p5dkp.map.keys.xml" required="yes"/>
  17. <xsl:param name="p5dkp:xsd" required="yes"/>
  18. <xsl:param name="p5dkp.nodes.path.add.xsl" required="yes"/>
  19. <xsl:param name="p5frc:debug" select="10"/>
  20. <xsl:param name="p5frc:targetNamespace" select="'http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd'"/> <!-- http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd -->
  21. <xsl:param name="p5frc:targetNamespace.name" select="'p5dkp'"/> <!-- p5dkp -->
  22. <xsl:param name="p5dkp.repository"/>
  23. <xsl:include href="p5frc.build_complexType.xsl"/>
  24. <!-- generate style like p5dkp:map.budzet_rola.xml xsl constructor -->
  25. <xsl:template xpath-default-namespace="http://www.w3.org/2001/XMLSchema"
  26. match="schema" mode="p5frc:map.budzet_rola.xsl">
  27. <xsl:variable name="schema">
  28. <xsl:apply-templates mode="p5frc:build_complexType" select="." xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  29. </xsl:variable>
  30. <xsl:result-document href="/Users/a.binder/Downloads/schema.xml">
  31. <xsl:copy-of select="$schema"/>
  32. </xsl:result-document>
  33. <xsl:element name="xsl:stylesheet">
  34. <xsl:copy-of select="namespace::node()"/>
  35. <xsl:namespace name="p5xsda" select="'http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/xsd_asserts/p5xsda.xsd'"/>
  36. <xsl:namespace name="p5frc" select="'http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/flat_relation_cache/p5frc.xsd'"/>
  37. <xsl:attribute name="exclude-result-prefixes" select="'xs'"/>
  38. <xsl:attribute name="version" select="'2.0'"/>
  39. <xsl:element name="xsl:output">
  40. <xsl:attribute name="indent" select="'yes'"/>
  41. </xsl:element>
  42. <xsl:element name="xsl:strip-space">
  43. <xsl:attribute name="elements" select="'*'"/>
  44. </xsl:element>
  45. <xsl:element name="xsl:include">
  46. <xsl:attribute name="href" select="$p5dkp.local.idref.xsl"/>
  47. </xsl:element>
  48. <xsl:element name="xsl:include">
  49. <xsl:attribute name="href" select="$p5dkp.nodes.path.add.xsl"/>
  50. </xsl:element>
  51. <xsl:element name="xsl:variable">
  52. <xsl:attribute name="name" select="'p5dkp.map.keys'"/>
  53. <xsl:attribute name="select">doc('<xsl:value-of select="$p5dkp.map.keys.xml"/>')</xsl:attribute>
  54. </xsl:element>
  55. <xsl:comment>#63</xsl:comment>
  56. <xsl:element name="xsl:template">
  57. <xsl:attribute name="mode" select="'p5frc:map.budzet_rola.xsl.apply.root'"/>
  58. <xsl:attribute name="match" select="'p5dkp:merged.xml'"/>
  59. <xsl:element name="p5dkp:p5dkp.map.budzet_rola.xsl.flat_relations.xml">
  60. <xsl:attribute name="xsi:schemaLocation">http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd <xsl:value-of select="$p5dkp:xsd"/></xsl:attribute>
  61. <xsl:element name="xsl:apply-templates">
  62. <xsl:attribute name="mode" select="'#current'"/>
  63. </xsl:element>
  64. </xsl:element>
  65. </xsl:element>
  66. <xsl:apply-templates mode="p5frc:map.budzet_rola.xsl.child" select="$schema"/>
  67. <xsl:comment>#76</xsl:comment>
  68. <xsl:element name="xsl:template">
  69. <xsl:attribute name="mode" select="'p5frc:map.budzet_rola.xsl.apply.root p5frc:map.budzet_rola.xsl.apply'"/>
  70. <xsl:attribute name="match" select="'text()|comment()'"/>
  71. </xsl:element>
  72. </xsl:element>
  73. </xsl:template>
  74. <xsl:template mode="p5frc:derived p5frc:derived.match p5frc:derived.mode p5frc:derived.name" match="*|text()|comment()"/>
  75. <xsl:template mode="p5frc:derived" match="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  76. <xsl:variable name="targetNamespace.detect" select="root()/schema/@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  77. <xsl:choose>
  78. <xsl:when test=".//p5frc:derived" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  79. <xsl:value-of select=".//p5frc:derived" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  80. </xsl:when>
  81. <xsl:otherwise><xsl:value-of select="concat(p5frc:targetNamespace.name(root()),':',@name)"/></xsl:otherwise>
  82. </xsl:choose>
  83. </xsl:template>
  84. <xsl:template mode="p5frc:derived.match" match="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  85. <xsl:attribute name="match"><xsl:apply-templates mode="p5frc:derived" select="." xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/></xsl:attribute>
  86. </xsl:template>
  87. <xsl:template mode="p5frc:derived.mode" match="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  88. <xsl:param name="mode.default" required="yes"/>
  89. <xsl:choose>
  90. <xsl:when test=".//p5frc:derived" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  91. <xsl:attribute name="mode" select=".//p5frc:derived"/>
  92. </xsl:when>
  93. <xsl:otherwise>
  94. <xsl:attribute name="mode" select="$mode.default"/>
  95. </xsl:otherwise>
  96. </xsl:choose>
  97. </xsl:template>
  98. <xsl:template mode="p5frc:derived.name" match="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  99. <xsl:variable name="targetnamespace" select="p5frc:targetNamespace.name(root())" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  100. <xsl:message>#117 $targetnamespace = <xsl:value-of select="$targetnamespace"/></xsl:message>
  101. <xsl:choose>
  102. <xsl:when test=".//p5frc:derived" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  103. <xsl:value-of select=".//p5frc:derived/text()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  104. </xsl:when>
  105. <xsl:otherwise>
  106. <xsl:message>#122 not <xsl:value-of select=".//p5frc:derived" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/> for <xsl:value-of select="@name"/></xsl:message>
  107. <xsl:value-of select="concat($targetnamespace,':',@name)"/>
  108. </xsl:otherwise>
  109. </xsl:choose>
  110. </xsl:template>
  111. <xsl:function name="p5frc:targetNamespace">
  112. <xsl:param name="p5dkp:xsd.root.node"/>
  113. <xsl:choose>
  114. <xsl:when test="not($p5frc:targetNamespace='')">
  115. <xsl:value-of select="$p5frc:targetNamespace"/>
  116. </xsl:when>
  117. <xsl:otherwise>
  118. <xsl:if test="string-length($p5dkp:xsd.root.node/schema/@targetNamespace) = 0">
  119. <xsl:message terminate="yes">#143 cannot detect p5frc:targetNamespace.name - for better safety type $p5frc:targetNamespace parameter as default</xsl:message>
  120. </xsl:if>
  121. <xsl:value-of select="$p5dkp:xsd.root.node/schema/@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  122. </xsl:otherwise>
  123. </xsl:choose>
  124. </xsl:function>
  125. <xsl:function name="p5frc:targetNamespace.name">
  126. <xsl:param name="p5dkp:xsd.root.node"/>
  127. <xsl:choose>
  128. <xsl:when test="not($p5frc:targetNamespace.name='')">
  129. <xsl:value-of select="$p5frc:targetNamespace.name"/>
  130. </xsl:when>
  131. <xsl:otherwise>
  132. <xsl:if test="string-length($p5dkp:xsd.root.node/schema/namespace::*[. = p5frc:targetNamespace($p5dkp:xsd.root.node)]/name()) = 0">
  133. <xsl:message terminate="yes">#159 cannot detect p5frc:targetNamespace.name - for better safety type $p5frc:targetNamespace.name parameter as default</xsl:message>
  134. </xsl:if>
  135. <xsl:value-of select="$p5dkp:xsd.root.node/schema/namespace::*[. = p5frc:targetNamespace($p5dkp:xsd.root.node)]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  136. </xsl:otherwise>
  137. </xsl:choose>
  138. </xsl:function>
  139. <xsl:template match="element[ descendant::system_cache__appinfo:source]" mode="p5frc:map.budzet_rola.xsl.child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" priority="9">
  140. <xsl:comment>#45 <xsl:copy-of select="@*"/> /*/name = <xsl:value-of select="/*/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/> ../name() = <xsl:value-of select="../name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>; ancestor/names = <xsl:value-of select="ancestor::*/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;</xsl:comment>
  141. <xsl:if test="number($p5frc:debug) &gt; 4">
  142. <xsl:message>#45 <xsl:copy-of select="@*"/> /*/name = <xsl:value-of select="/*/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/> ../name() = <xsl:value-of select="../name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>; ancestor/names = <xsl:value-of select="ancestor::*/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;</xsl:message>
  143. </xsl:if>
  144. <xsl:comment>#139</xsl:comment>
  145. <xsl:element name="xsl:template">
  146. <xsl:attribute name="mode" select="'p5frc:map.budzet_rola.xsl.apply.root'"/>
  147. <!--<xsl:apply-templates mode="p5frc:derived.mode" select=".">
  148. <xsl:with-param name="mode.default" select="'p5frc:map.budzet_rola.xsl.apply.root'"/>
  149. </xsl:apply-templates>-->
  150. <xsl:attribute name="match" select="@name"/>
  151. <!--<xsl:apply-templates mode="p5frc:derived.match" select="."/>-->
  152. <xsl:attribute name="xpath-default-namespace" select="ancestor::schema//@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  153. <xsl:element name="xsl:param">
  154. <xsl:attribute name="name" select="'p5frc:nodes.path'"/>
  155. </xsl:element>
  156. <xsl:element name="xsl:copy">
  157. <xsl:element name="xsl:copy-of">
  158. <xsl:attribute name="select" select="'@*'"/>
  159. </xsl:element>
  160. <xsl:element name="xsl:variable">
  161. <xsl:attribute name="name" select="'local'"/>
  162. <p5frc:local>
  163. <xsl:element name="xsl:apply-templates">
  164. <xsl:attribute name="mode" select="'p5dkp:map.budzet_rola.xml.local'"/>
  165. </xsl:element>
  166. </p5frc:local>
  167. </xsl:element>
  168. <xsl:element name="xsl:variable">
  169. <xsl:attribute name="name" select="'root'"/>
  170. <xsl:attribute name="select" select="'/'"/>
  171. </xsl:element>
  172. <xsl:element name="xsl:copy-of">
  173. <xsl:attribute name="select">$local/p5frc:local/*[not(name()='map.keys.eval')]</xsl:attribute>
  174. <xsl:attribute name="xpath-default-namespace"/>
  175. </xsl:element>
  176. <xsl:if test="number($p5frc:debug) &gt; 3">
  177. <xsl:element name="xsl:copy-of">
  178. <xsl:attribute name="select">$p5frc:nodes.path</xsl:attribute>
  179. </xsl:element>
  180. </xsl:if>
  181. <xsl:element name="xsl:variable">
  182. <xsl:attribute name="name" select="'element'"/>
  183. <xsl:attribute name="select">'<xsl:value-of select="@name"/>'</xsl:attribute>
  184. </xsl:element>
  185. <xsl:apply-templates mode="p5frc:map.budzet_rola.xsl.flat_relations"/>
  186. </xsl:element>
  187. </xsl:element>
  188. <xsl:comment>#186</xsl:comment>
  189. <xsl:element name="xsl:template">
  190. <!--<xsl:attribute name="mode" select="'p5frc:map.budzet_rola.xsl.apply'"/>-->
  191. <xsl:variable name="targetNamespace.detect" select="p5frc:targetNamespace(root())"/>
  192. <xsl:if test="number($p5frc:debug) &gt; 44">
  193. <xsl:message>#184 select="concat(root()/schema/namespace::*[. = //@targetNamespace]/name(),':',@name)"
  194. //@targetNamespace = <xsl:value-of select="//@targetNamespace[1]"/>;
  195. <xsl:value-of select="root()/schema/namespace::*[. = //@targetNamespace[1]]/name()"/>
  196. root()/schema/@targetNamespace = <xsl:value-of select="root()/schema/@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;
  197. $targetNamespace.detect = <xsl:value-of select="$targetNamespace.detect"/>;
  198. second tryXXX <xsl:value-of select="root()/schema/namespace::*[. = $targetNamespace.detect]/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  199. 5 <xsl:value-of select="root()/schema/namespace::*/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  200. 7-ns <xsl:value-of select="root()//namespace::*/name()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  201. 7-nons <xsl:value-of select="root()//namespace::*/name()" />
  202. 8-self<xsl:value-of select="root()//namespace::*[ . = //@targetNamespace[1]]/name()" />
  203. 6 <xsl:value-of select="root()//namespace::*[. = $targetNamespace.detect]/name()" />
  204. #239 p5frc:targetNamespace(root()) = <xsl:value-of select="p5frc:targetNamespace(root())"/>
  205. #240 p5frc:targetNamespace.name(root()) = <xsl:value-of select="p5frc:targetNamespace.name(root())"/>
  206. </xsl:message>
  207. </xsl:if>
  208. <xsl:attribute name="mode" select="concat(p5frc:targetNamespace.name(root()),':',@name)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  209. <!--<xsl:apply-templates mode="p5frc:derived.mode" select=".">
  210. <xsl:with-param name="mode.default" select="'p5frc:map.budzet_rola.xsl.apply'"/>
  211. </xsl:apply-templates>-->
  212. <!--<xsl:attribute name="match" select="@name"/>-->
  213. <xsl:apply-templates mode="p5frc:derived.match" select="."/>
  214. <xsl:attribute name="xpath-default-namespace" select="ancestor::schema//@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  215. <xsl:element name="xsl:param">
  216. <xsl:attribute name="name" select="'p5frc:nodes.path'"/>
  217. </xsl:element>
  218. <xsl:comment>#210</xsl:comment>
  219. <xsl:element name="xsl:variable">
  220. <xsl:attribute name="name" select="'p5frc:derived.name'"/>
  221. <!--<xsl:apply-templates mode="p5frc:derived.name" select="." xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>-->
  222. <xsl:value-of select="concat(p5frc:targetNamespace.name(root()),':',@name)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  223. </xsl:element>
  224. <xsl:choose>
  225. <xsl:when test="@name = 'wymagania_no_required_finished'">
  226. <xsl:comment>#131 from p5dkp:wymaganie_no_required_finished</xsl:comment>
  227. </xsl:when>
  228. </xsl:choose>
  229. <!--<xsl:element name="xsl:copy">-->
  230. <xsl:element name="xsl:element">
  231. <xsl:attribute name="name">{$p5frc:derived.name}</xsl:attribute>
  232. <xsl:element name="xsl:copy-of">
  233. <xsl:attribute name="select" select="'@*'"/>
  234. </xsl:element>
  235. <xsl:element name="xsl:variable">
  236. <xsl:attribute name="name" select="'local'"/>
  237. <p5frc:local>
  238. <xsl:element name="xsl:apply-templates">
  239. <xsl:attribute name="mode" select="'p5dkp:map.budzet_rola.xml.local.idref'"/>
  240. </xsl:element>
  241. </p5frc:local>
  242. </xsl:element>
  243. <xsl:element name="xsl:variable">
  244. <xsl:attribute name="name" select="'root'"/>
  245. <xsl:attribute name="select" select="'/'"/>
  246. </xsl:element>
  247. <xsl:element name="xsl:copy-of">
  248. <xsl:attribute name="select">$local/p5frc:local/*[not(name()='map.keys.eval')]</xsl:attribute>
  249. <xsl:attribute name="xpath-default-namespace"/>
  250. </xsl:element>
  251. <xsl:if test="number($p5frc:debug) &gt; 3">
  252. <xsl:element name="xsl:copy-of">
  253. <xsl:attribute name="select">$p5frc:nodes.path</xsl:attribute>
  254. </xsl:element>
  255. </xsl:if>
  256. <xsl:element name="xsl:variable">
  257. <xsl:attribute name="name" select="'element'"/>
  258. <xsl:attribute name="select">'<xsl:value-of select="@name"/>'</xsl:attribute>
  259. </xsl:element>
  260. <xsl:apply-templates mode="p5frc:map.budzet_rola.xsl.flat_relations"/>
  261. </xsl:element>
  262. <!--</xsl:element>-->
  263. </xsl:element>
  264. </xsl:template>
  265. <xsl:template mode="p5frc:derived.ref" match="element[@ref]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  266. <xsl:choose>
  267. <xsl:when test="/schema/element[@name = substring-after(current()/substring-before(.//@system_cache__appinfo:xpath,'/'),':')]/.//p5frc:derived" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  268. <xsl:value-of select="/schema/element[@name = substring-after(current()/@ref,':')]/.//p5frc:derived" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  269. </xsl:when>
  270. <xsl:when test=".//@system_cache__appinfo:xpath" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  271. <xsl:value-of select="substring-before(.//@system_cache__appinfo:xpath,'/')"/>
  272. </xsl:when>
  273. <xsl:otherwise><xsl:value-of select="@ref"/></xsl:otherwise>
  274. </xsl:choose>
  275. </xsl:template>
  276. <xsl:template mode="p5frc:map.budzet_rola.xsl.child" match="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  277. <xsl:apply-templates mode="#current"/>
  278. </xsl:template>
  279. <xsl:template mode="p5frc:map.budzet_rola.xsl.child" match="*" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  280. <xsl:comment>#94 ignored <xsl:value-of select="name()"/>; <xsl:copy-of select="@*"/>; descendant::system_cache__appinfo:source = <xsl:value-of select="descendant::system_cache__appinfo:source" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/> </xsl:comment>
  281. <!--<DEBUG>
  282. <xsl:copy-of select="."/>
  283. </DEBUG>-->
  284. </xsl:template>
  285. <xsl:template match="*" mode="p5frc:map.budzet_rola.xsl.flat_relations" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  286. <xsl:if test="number($p5frc:debug) &gt; 7"><xsl:comment>#55 matched * <xsl:value-of select="name()"/>; <xsl:copy-of select="@*"/></xsl:comment></xsl:if>
  287. <!--<DEBUG55>
  288. <xsl:copy-of select="descendant::system_cache__appinfo:source"/>
  289. </DEBUG55>-->
  290. <xsl:apply-templates mode="p5frc:map.budzet_rola.xsl.flat_relations"/>
  291. </xsl:template>
  292. <xsl:template match="element[ @ref and descendant::system_cache__appinfo:source]" mode="p5frc:map.budzet_rola.xsl.flat_relations" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  293. <xsl:comment>#60 matched element[ @ref and descendant::system_cache__appinfo:source] ; name()=<xsl:value-of select="name()"/>; <xsl:copy-of select="@*"/>;</xsl:comment>
  294. <xsl:element name="xsl:comment">
  295. #60 matched element[ @ref and descendant::system_cache__appinfo:source] ; name()=<xsl:value-of select="name()"/>; <xsl:copy-of select="@*/name()"/></xsl:element>
  296. <xsl:message>#60 matched element[ @ref and descendant::system_cache__appinfo:source] ; name()=<xsl:value-of select="name()"/>; <xsl:copy-of select="@*"/>;</xsl:message>
  297. <xsl:variable name="p5frc:derived">
  298. <xsl:apply-templates mode="p5frc:derived.ref" select="."/>
  299. </xsl:variable>
  300. <xsl:comment>#298 $p5frc:derived = <xsl:value-of select="$p5frc:derived"/>
  301. /schema/element[@name = substring-after(current()/substring-before(.//@system_cache__appinfo:xpath,'/'),':')]/p5frc:derived
  302. = <xsl:value-of select="/schema/element[@name = substring-after(substring-before(current()/.//@system_cache__appinfo:xpath,'/'),':')]/.//p5frc:derived" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  303. substring-after(substring-before(current().//@system_cache__appinfo:xpath,'/'),':') = <xsl:value-of select="substring-before(current()/.//@system_cache__appinfo:xpath,'/')" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  304. </xsl:comment>
  305. <xsl:element name="xsl:for-each-group">
  306. <xsl:attribute name="select"><xsl:value-of select=".//@system_cache__appinfo:name"/></xsl:attribute> <!-- $local/p5frc:local/ -->
  307. <xsl:attribute name="xpath-default-namespace"/>
  308. <xsl:attribute name="group-by">concat(@p5dkp:id,@p5dkp:idref,@keyref)</xsl:attribute>
  309. <!--<TEST_FOR>-->
  310. <xsl:comment>
  311. #198-A TEST FOR EL=<xsl:value-of select=".//@system_cache__appinfo:name"/>;; <xsl:value-of select="substring-before(.//@system_cache__appinfo:xpath,'/')"/> <xsl:copy-of select="@*"/> / <xsl:element name="xsl:copy-of"><xsl:attribute name="select">@*</xsl:attribute></xsl:element> and <xsl:value-of select="substring-before(.//@system_cache__appinfo:xpath,'/')"/>
  312. pos = <xsl:value-of select="position()"/>
  313. </xsl:comment>
  314. <xsl:element name="xsl:comment">
  315. #198-B TEST FOR EL=<xsl:value-of select=".//@system_cache__appinfo:name"/>;; <xsl:value-of select="substring-before(.//@system_cache__appinfo:xpath,'/')"/> p5dkp:idref=<xsl:element name="xsl:value-of"><xsl:attribute name="select">@p5dkp:idref</xsl:attribute></xsl:element> ; p5dkp:id=<xsl:element name="xsl:value-of"><xsl:attribute name="select">@p5dkp:id</xsl:attribute></xsl:element> ; @keyref=<xsl:element name="xsl:value-of"><xsl:attribute name="select">@keyref</xsl:attribute></xsl:element> ; position <xsl:element name="xsl:value-of"><xsl:attribute name="select">position()</xsl:attribute></xsl:element>
  316. </xsl:element>
  317. <xsl:element name="xsl:choose">
  318. <xsl:element name="xsl:when">
  319. <xsl:attribute name="test">$p5frc:nodes.path and $p5frc:nodes.path//<xsl:value-of select=".//@system_cache__appinfo:name"/>[ @p5dkp:element = $element ]/@keyref = current()/(@keyref|@p5dkp:id) </xsl:attribute>
  320. <xsl:attribute name="xpath-default-namespace"/>
  321. <xsl:element name="xsl:comment">#2009-A Element @keyref=<xsl:element name="xsl:value-of"><xsl:attribute name="select">current()/@keyref</xsl:attribute></xsl:element> exists .</xsl:element>
  322. </xsl:element>
  323. <xsl:element name="xsl:when">
  324. <xsl:attribute name="test">$p5frc:nodes.path and $p5frc:nodes.path//<xsl:value-of select=".//@system_cache__appinfo:name"/>[ @p5dkp:element = $element ]/@p5dkp:id = current()/(@p5dkp:id|@keyref)</xsl:attribute>
  325. <xsl:attribute name="xpath-default-namespace"/>
  326. <xsl:element name="xsl:comment">#2009-B Element @p5dkp:id=<xsl:element name="xsl:value-of"><xsl:attribute name="select">current()/@p5dkp:id</xsl:attribute></xsl:element> exists .</xsl:element>
  327. </xsl:element>
  328. <xsl:element name="xsl:when">
  329. <xsl:attribute name="test">$p5frc:nodes.path and count($p5frc:nodes.path//*) &gt; 5</xsl:attribute>
  330. <xsl:attribute name="xpath-default-namespace"/>
  331. <xsl:element name="xsl:comment">#2009-X COUNT EXCEED Element @p5dkp:id=<xsl:element name="xsl:value-of"><xsl:attribute name="select">current()/@p5dkp:id</xsl:attribute></xsl:element> NOR @keyref=<xsl:element name="xsl:value-of"><xsl:attribute name="select">current()/@keyref</xsl:attribute></xsl:element> .</xsl:element>
  332. </xsl:element>
  333. <xsl:element name="xsl:otherwise">
  334. <xsl:element name="xsl:comment">#2009-C Element @p5dkp:id=<xsl:element name="xsl:value-of"><xsl:attribute name="select">current()/@p5dkp:id</xsl:attribute></xsl:element> NOR @keyref=<xsl:element name="xsl:value-of"><xsl:attribute name="select">current()/@keyref</xsl:attribute></xsl:element> NOT EXISTS .</xsl:element>
  335. <xsl:element name="xsl:apply-templates">
  336. <!--<xsl:attribute name="mode" select="@ref"/>-->
  337. <!--<xsl:attribute name="mode" select="'p5frc:map.budzet_rola.xsl.apply'"/>-->
  338. <xsl:attribute name="mode" select="substring-before(.//@system_cache__appinfo:xpath,'/')"/>
  339. <!--<xsl:attribute name="mode" select="$p5frc:derived"/>-->
  340. <!--<xsl:attribute name="select">$root//<xsl:value-of select="substring-before(.//@system_cache__appinfo:xpath,'/')"/>[ * [local-name()='<xsl:value-of select="substring-after(.//@system_cache__appinfo:xpath,'/')"/>' and @p5dkp:id = current()/@keyref or @keyref = current()/@p5dkp:id ]]</xsl:attribute>-->
  341. <xsl:attribute name="select">$root//<xsl:value-of select="$p5frc:derived"/>[ * [local-name()='<xsl:value-of select="substring-after(.//@system_cache__appinfo:xpath,'/')"/>' and @p5dkp:id = current()/@keyref or @keyref = current()/@p5dkp:id ]]</xsl:attribute>
  342. <xsl:attribute name="xpath-default-namespace"/> <!-- select="root()//@targetNamespace" -->
  343. <!--<xsl:attribute name="xpath-default-namespace" select="root()//@targetNamespace"/>-->
  344. <xsl:comment>#105 <xsl:copy-of select="@*"/></xsl:comment>
  345. <xsl:element name="xsl:with-param">
  346. <xsl:attribute name="name" select="'p5frc:nodes.path'"/>
  347. <xsl:attribute name="select">p5dkp:nodes.path.add($p5frc:nodes.path,.,$element)</xsl:attribute>
  348. </xsl:element>
  349. </xsl:element>
  350. </xsl:element>
  351. </xsl:element>
  352. <!--</TEST_FOR>-->
  353. </xsl:element>
  354. <!--<xsl:element name="xsl:apply-templates">
  355. <!-\-<xsl:attribute name="mode" select="@ref"/>-\->
  356. <xsl:attribute name="mode" select="'p5frc:map.budzet_rola.xsl.apply'"/>
  357. <xsl:attribute name="select">//<xsl:value-of select="substring-before(.//@system_cache__appinfo:xpath,'/')"/>[ * [local-name()='<xsl:value-of select="substring-after(.//@system_cache__appinfo:xpath,'/')"/>' and @p5dkp:id = $local/p5frc:local/<xsl:value-of select=".//@system_cache__appinfo:name"/>/@keyref or @keyref = $local/p5frc:local/<xsl:value-of select=".//@system_cache__appinfo:name"/>/@p5dkp:id ]]</xsl:attribute>
  358. <xsl:attribute name="xpath-default-namespace"/> <!-\- select="root()//@targetNamespace" -\->
  359. <!-\-<xsl:attribute name="xpath-default-namespace" select="root()//@targetNamespace"/>-\->
  360. <xsl:comment>#105 <xsl:copy-of select="@*"/></xsl:comment>
  361. <xsl:element name="xsl:with-param">
  362. <xsl:attribute name="name" select="'p5frc:nodes.path'"/>
  363. <xsl:attribute name="select">p5dkp:nodes.path.add($p5frc:nodes.path,<xsl:value-of select=".//@system_cache__appinfo:name"/>)</xsl:attribute>
  364. </xsl:element>
  365. </xsl:element>-->
  366. </xsl:template>
  367. <xsl:template mode="p5frc:map.budzet_rola.xsl.flat_relations" match="text()|comment()"/>
  368. <xsl:template mode="p5frc:map.budzet_rola.xsl.child" match="text()|comment()"/>
  369. </xsl:stylesheet>