get_all_xsd.xsl 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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. exclude-result-prefixes="xs hfp"
  5. version="2.0"
  6. xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
  7. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  8. xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
  9. <xsl:output indent="yes"/>
  10. <xsl:strip-space elements="*"/>
  11. <xsl:param name="procesy5_system_schema" select="'../default_db.instance.xml/transformed/procesy5_system_schema.xml'"/>
  12. <xsl:param name="procesy5_system_schema_collection_dir" select="'../'"/>
  13. <xsl:param name="cache" select="'refresh'"/>
  14. <xsl:param name="targetNamespace_DEFAULTS" select="'http://biuro.biall-net.pl/xmlschema_procesy5/default_db'"/>
  15. <xsl:param name="external_schema" select="'/public_html/external_schema'"/>
  16. <xsl:param name="external_schema_id_namespace_prefix" select="'/public_html/external_schema_id_namespace_prefix'"/>
  17. <xsl:param name="XMLSchema_prefix" select="'xs'"/>
  18. <xsl:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
  19. <xsl:include href="system_cache__appinfo/external_schema_targetNamespace.xsl"/>
  20. <xsl:function name="system_cache__appinfo:document-uri_for_external_schema_id_namespace_prefix">
  21. <xsl:param name="system_cache__appinfo:document-uri_from_external_schema"/>
  22. <xsl:value-of select="substring-after(replace($system_cache__appinfo:document-uri_from_external_schema,$external_schema,$external_schema_id_namespace_prefix ), '/public_html/') "/>
  23. </xsl:function>
  24. <xsl:function name="system_cache__appinfo:document-uri-full_for_external_schema_id_namespace_prefix">
  25. <xsl:param name="system_cache__appinfo:document-uri_from_external_schema"/>
  26. <xsl:value-of select="replace($system_cache__appinfo:document-uri_from_external_schema,$external_schema,$external_schema_id_namespace_prefix )"/>
  27. </xsl:function>
  28. <xsl:function name="system_cache__appinfo:clean_object_prefix">
  29. <xsl:param name="name" />
  30. <xsl:choose>
  31. <xsl:when test="substring-after($name,':')">
  32. <xsl:value-of select="substring-after($name,':')"/>
  33. </xsl:when>
  34. <xsl:otherwise>
  35. <xsl:value-of select="$name"/>
  36. </xsl:otherwise>
  37. </xsl:choose>
  38. </xsl:function>
  39. <xsl:function name="system_cache__appinfo:get_object_prefix">
  40. <xsl:param name="name" />
  41. <xsl:choose>
  42. <xsl:when test="substring-before($name,':')">
  43. <xsl:value-of select="substring-before($name,':')"/>
  44. </xsl:when>
  45. <xsl:otherwise>
  46. <xsl:message terminate="yes">system_cache__appinfo:get_object_prefix(<xsl:value-of select="$name"/>) - parameter has no exptected prefix:object format definition! Maybe not expected schema?</xsl:message>
  47. </xsl:otherwise>
  48. </xsl:choose>
  49. </xsl:function>
  50. <!-- funkcja do wyczyszczenia wyescapowenago prefixu z np. default_db__x3A__IN7_DZIENNIK_KORESP do IN7_DZIENNIK_KORESP -->
  51. <xsl:function name="system_cache__appinfo:clean_object_escaped_prefix">
  52. <xsl:param name="name" />
  53. </xsl:function>
  54. <!-- funkcja do ponownego zamienienia na sredniki itp z np. default_db__x3A__IN7_DZIENNIK_KORESP do IN7_DZIENNIK_KORESP -->
  55. <xsl:function name="system_cache__appinfo:translate_object_escaped_prefix_from_string">
  56. <xsl:param name="name" />
  57. <xsl:value-of select="replace(replace(replace(replace(replace(replace(replace(replace($name, '__x2F__', '/'), '__x3A__', ':'),'__x2D__','-'),'__x25__','%'),'__x28__','('),'__x29__',')'),'__x23__','#'),'__x2A__','*')"/>
  58. </xsl:function>
  59. <!-- funkcja do zamienienia na postac default_db__x3A__IN7_DZIENNIK_KORESP do IN7_DZIENNIK_KORESP -->
  60. <xsl:function name="system_cache__appinfo:escape_object_prefix_to_string">
  61. <xsl:param name="name" />
  62. <xsl:value-of select="replace(replace(replace(replace(replace(replace(replace(replace($name, '/', '__x2F__'), ':', '__x3A__'),'-','__x2D__'),'%','__x25__'), '\(', '__x28__'), '\)' ,'__x29__'),'#','__x23__'),'\*','__x2A__')"/>
  63. </xsl:function>
  64. <xsl:template name="system_cache__appinfo:prefixed_object_info">
  65. <xsl:param name="prefixed_object" required="yes"/>
  66. <xsl:variable name="prefix_token" select="tokenize(system_cache__appinfo:translate_object_escaped_prefix_from_string($prefixed_object),':')"/>
  67. <xsl:choose>
  68. <xsl:when test=" string-length($prefix_token[3]) &gt; 0">
  69. <system_cache__appinfo:prefixed_object_info>
  70. <xsl:attribute name="prefix" select="$prefix_token[1]"/>
  71. <xsl:attribute name="name" select="$prefix_token[2]"/>
  72. <xsl:attribute name="element" select="$prefix_token[3]"/>
  73. </system_cache__appinfo:prefixed_object_info>
  74. </xsl:when>
  75. <xsl:otherwise>
  76. <system_cache__appinfo:prefixed_object_info>
  77. <xsl:attribute name="prefix" select="$prefix_token[1]"/>
  78. <xsl:attribute name="name" select="$prefix_token[2]"/>
  79. <xsl:attribute name="element" select="$prefix_token[2]"/>
  80. </system_cache__appinfo:prefixed_object_info>
  81. </xsl:otherwise>
  82. </xsl:choose>
  83. </xsl:template>
  84. <!-- @2016-08 funkcje do wykrywania prefixow, namespace itp itd...
  85. <xsl:attribute name="prefix" select="$vrtfNamespaces/ns[@uri=$targetnamespace][1]/@prefix" xpath-default-namespace=""/>
  86. <xsl:attribute name="targetnamespace" select="$targetnamespace"/>
  87. <xsl:attribute name="type_79" select="$type_79"/>
  88. <xsl:attribute name="prefix_79" select="$prefix_79"/>
  89. <xsl:attribute name="type_79_nopref" select="$type_79_nopref"/>
  90. -->
  91. <xsl:function name="system_cache__appinfo:prefix_from_targetNamespace">
  92. <xsl:param name="system_cache__appinfo:vrtfNamespaces" />
  93. <xsl:param name="targetNamespace" />
  94. <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces//ns[@uri=$targetNamespace][1]/@prefix" xpath-default-namespace=""/>
  95. </xsl:function>
  96. <xsl:function name="system_cache__appinfo:targetNamespace_from_prefix">
  97. <xsl:param name="system_cache__appinfo:vrtfNamespaces" />
  98. <xsl:param name="prefix" />
  99. <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces//ns[@prefix=$prefix][1]/@uri" xpath-default-namespace=""/>
  100. </xsl:function>
  101. <xsl:function name="system_cache__appinfo:get_default_db_obj_url_table_name"><!-- @2016-10 funkcja do wykrywania nazwy tabeli dla default db, w przypadku braku zgodnosci namespace - nic nie zwraca -->
  102. <xsl:param name="parent_complexTypeNamespace" />
  103. <xsl:variable name="uri_tokens" select="tokenize($parent_complexTypeNamespace,'/')"/>
  104. <xsl:variable name="uri_tokens_count" select="count($uri_tokens)"/>
  105. <xsl:if test="$uri_tokens[($uri_tokens_count - 1)]='table' and $uri_tokens[($uri_tokens_count - 2)]='default_db' and $uri_tokens[($uri_tokens_count - 3)]='wfs'">
  106. <xsl:variable name="get_default_db_obj_url_table_name" select="tokenize($uri_tokens[$uri_tokens_count],'\.')"/>
  107. <xsl:value-of select="$get_default_db_obj_url_table_name[1]"/>
  108. </xsl:if>
  109. </xsl:function>
  110. <!--<xsl:function name="system_cache__appinfo:php_function_name_from_obj_with_prefix">
  111. <xsl:param name="object_name" required="yes"/>
  112. <xsl:value-of select="replace($object_name,':','__x3A__')"/>
  113. </xsl:function>-->
  114. <xsl:template name="main">
  115. <xsl:call-template name="system_cache__appinfo:get_all_xsd">
  116. <xsl:with-param name="path2collection" select="'../'"/>
  117. <xsl:with-param name="cache" select="'read'"/>
  118. </xsl:call-template>
  119. </xsl:template>
  120. <!-- BEGIN external schema templates -->
  121. <!-- <xsl:template match="get_all_xsd_list" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" xpath-default-namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
  122. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema__equals"/>
  123. </xsl:template>
  124. <xsl:template match="get_all_xsd|get_all_xsd_external_schema_id_namespace_prefix" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" xpath-default-namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"/>
  125. <xsl:template match="get_all_xsd_external_schema" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" xpath-default-namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
  126. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema__equals"/>
  127. </xsl:template>
  128. -->
  129. <xsl:template match="system_cache__appinfo:get_all_xsd_external_schema" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" >
  130. <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
  131. <xsl:variable name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix">
  132. <var>
  133. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/*">
  134. <xsl:element name="{name()}">
  135. <xsl:attribute name="pos" select="position()"/>
  136. <xsl:copy-of select="@*"/>
  137. <xsl:copy-of select="*"/>
  138. </xsl:element>
  139. </xsl:for-each>
  140. </var>
  141. </xsl:variable>
  142. <system_cache__appinfo:get_all_xsd_external_schema__equals>
  143. <xsl:copy-of select="@*"/>
  144. <xsl:call-template name="system_cache__appinfo:get_all_xsd_external_schema__equals">
  145. <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema" select=".[*]"/>
  146. <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix"/>
  147. </xsl:call-template>
  148. <!--<system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
  149. <xsl:copy-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix"></xsl:copy-of>
  150. </system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>-->
  151. </system_cache__appinfo:get_all_xsd_external_schema__equals>
  152. </xsl:template>
  153. <!--<xsl:template match="schema" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  154. <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
  155. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema__equals">
  156. <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/*"/>
  157. </xsl:apply-templates>
  158. </xsl:template>-->
  159. <xsl:template name="system_cache__appinfo:get_all_xsd_external_schema__equals" >
  160. <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema" required="yes"/>
  161. <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
  162. <!--<pre_external_schema>
  163. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema/*">
  164. <xsl:element name="{name()}"><xsl:copy-of select="@*"/></xsl:element>
  165. </xsl:for-each>
  166. </pre_external_schema>
  167. <pre_schema_id_namespace_prefix>
  168. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*">
  169. <xsl:element name="{name()}"><xsl:copy-of select="@*"/></xsl:element>
  170. </xsl:for-each>
  171. </pre_schema_id_namespace_prefix>-->
  172. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema/*">
  173. <xsl:variable name="position" select="position()"/>
  174. <xsl:comment> Try position <xsl:value-of select="$position"/>;</xsl:comment>
  175. <xsl:choose>
  176. <!--<xsl:when test="not($position = $pos)">
  177. <not_pos>
  178. <xsl:attribute name="pos" select="$pos"/>
  179. <xsl:attribute name="position" select="$position"/>
  180. <xsl:attribute name="expected" select="local-name()"/>
  181. </not_pos>
  182. </xsl:when>-->
  183. <xsl:when test="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/local-name() = local-name()">
  184. <!--<equals>
  185. <xsl:attribute name="position" select="position()"/>
  186. <xsl:attribute name="expected" select="local-name()"/>
  187. <xsl:attribute name="found" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/local-name()"/>
  188. <xsl:attribute name="first_el_par" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var[1]/name()"/>
  189. </equals>-->
  190. <!--<xsl:message>#170 comp equal <xsl:value-of select="local-name()"/> === <xsl:value-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix[ position() = $position]/local-name()"/></xsl:message>-->
  191. </xsl:when>
  192. <xsl:otherwise>
  193. <not_equals>
  194. <xsl:attribute name="position" select="position()"/>
  195. <xsl:attribute name="expected" select="local-name()"/>
  196. <xsl:attribute name="found" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/local-name()"/>
  197. <xsl:attribute name="found_id" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/@id"/>
  198. <xsl:attribute name="found_pos" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/@pos"/>
  199. <xsl:attribute name="first_el_par" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[1]/name()"/>
  200. </not_equals>
  201. </xsl:otherwise>
  202. </xsl:choose>
  203. <!--<child>-->
  204. <xsl:variable name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix_new">
  205. <var>
  206. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[@pos=$position]/*">
  207. <xsl:element name="{name()}">
  208. <xsl:attribute name="pos" select="position()"/>
  209. <xsl:copy-of select="@*"/>
  210. <xsl:copy-of select="*"/>
  211. </xsl:element>
  212. </xsl:for-each>
  213. </var>
  214. </xsl:variable>
  215. <!--<test_var_new><xsl:copy-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix_new"/></test_var_new>-->
  216. <xsl:call-template name="system_cache__appinfo:get_all_xsd_external_schema__equals">
  217. <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema" select=".[*]"/>
  218. <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix_new/.[*]"/>
  219. </xsl:call-template>
  220. <!--</child>-->
  221. </xsl:for-each>
  222. </xsl:template>
  223. <xsl:template match="schema" mode="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  224. <xsl:param name="system_cache__appinfo:document-uri" required="yes"/>
  225. <xsl:variable name="targetNamespace" select="@targetNamespace"/>
  226. <xsl:variable name="namespaces_cur">
  227. <namespaces_cur>
  228. <xsl:for-each select="namespace::node()">
  229. <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
  230. </xsl:for-each>
  231. </namespaces_cur>
  232. </xsl:variable>
  233. <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema" extension-element-prefixes="#default" inherit-namespaces="yes">
  234. <xsl:choose>
  235. <xsl:when test="@targetNamespace and ( not($namespaces_cur//ns[@uri=$targetNamespace]/@prefix) or $namespaces_cur//ns[@uri=$targetNamespace]/@prefix='' ) " xpath-default-namespace="">
  236. <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
  237. <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace(@targetNamespace)"/>
  238. <xsl:copy-of select="@targetNamespace"/>
  239. <xsl:attribute name="vc:minVersion" select="'1.0'"/>
  240. <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
  241. <xsl:comment>#144 when @targetNamespace exists and prefix not exists</xsl:comment>
  242. <xsl:comment>namespaces_cur/ns/@uri=<xsl:value-of select="$targetNamespace"/> = <xsl:value-of select="$namespaces_cur/namespaces_cur/ns[@uri=$targetNamespace]/@prefix"/> </xsl:comment>
  243. <xsl:comment> count: <xsl:value-of select="count($namespaces_cur/namespaces_cur/ns)"/> </xsl:comment>
  244. <xsl:copy-of select="*"/>
  245. </xsl:when>
  246. <xsl:when test="@targetNamespace">
  247. <xsl:variable name="detect_prefix" select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix" xpath-default-namespace=""/>
  248. <xsl:namespace name="{$detect_prefix}" select="@targetNamespace"/>
  249. <xsl:copy-of select="@targetNamespace"/>
  250. <xsl:attribute name="vc:minVersion" select="'1.0'"/>
  251. <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
  252. <xsl:comment>#147 when @targetNamespace and prefix probably exists!</xsl:comment>
  253. <xsl:copy-of select="*"/>
  254. </xsl:when>
  255. <xsl:otherwise>
  256. <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
  257. <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  258. <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  259. <xsl:attribute name="vc:minVersion" select="'1.0'"/>
  260. <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
  261. <xsl:message>#35 detect. targetNamespace <xsl:value-of select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/></xsl:message>
  262. <xsl:comment>#158 otherwise not @targetNamespace and no prefix</xsl:comment>
  263. <xsl:copy-of select="*"/>
  264. </xsl:otherwise>
  265. </xsl:choose>
  266. </xsl:element>
  267. </xsl:template>
  268. <xsl:template match="schema" mode="system_cache__appinfo:get_all_xsd_external_schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  269. <xsl:param name="system_cache__appinfo:document-uri" required="yes"/>
  270. <xsl:variable name="targetNamespace" select="@targetNamespace"/>
  271. <xsl:variable name="namespaces_cur">
  272. <namespaces_cur>
  273. <xsl:for-each select="namespace::node()">
  274. <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
  275. </xsl:for-each>
  276. </namespaces_cur>
  277. </xsl:variable>
  278. <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema" extension-element-prefixes="#default" inherit-namespaces="yes">
  279. <xsl:choose>
  280. <xsl:when test="@targetNamespace and ( not($namespaces_cur//ns[@uri=$targetNamespace]/@prefix) or $namespaces_cur//ns[@uri=$targetNamespace]/@prefix='' ) " xpath-default-namespace="">
  281. <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
  282. <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace(@targetNamespace)"/>
  283. <xsl:copy-of select="@targetNamespace"/>
  284. <xsl:attribute name="vc:minVersion" select="'1.0'"/>
  285. <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
  286. <xsl:comment>#144 when @targetNamespace exists and prefix not exists</xsl:comment>
  287. <xsl:comment>namespaces_cur/ns/@uri=<xsl:value-of select="$targetNamespace"/> = <xsl:value-of select="$namespaces_cur/namespaces_cur/ns[@uri=$targetNamespace]/@prefix"/> </xsl:comment>
  288. <xsl:comment> count: <xsl:value-of select="count($namespaces_cur/namespaces_cur/ns)"/> </xsl:comment>
  289. <!--<xsl:for-each select="$namespaces_cur/namespaces_cur/ns">
  290. <xsl:comment> ns @element=<xsl:value-of select="@element"/>; @prefix=<xsl:value-of select="@prefix"/>; @uri=<xsl:value-of select="@uri"/>;</xsl:comment>
  291. </xsl:for-each>-->
  292. <!-- <xs:debug>
  293. <xsl:copy-of select="$namespaces_cur"/>
  294. </xs:debug>
  295. <xs:debug_filter>
  296. <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]"/>
  297. </xs:debug_filter>
  298. <xs:debug_filter_NS>
  299. <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]" xpath-default-namespace=""/>
  300. </xs:debug_filter_NS>-->
  301. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
  302. <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
  303. <xsl:with-param name="detect_targetNamespace" select="@targetNamespace"/>
  304. <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
  305. </xsl:apply-templates>
  306. </xsl:when>
  307. <xsl:when test="@targetNamespace">
  308. <xsl:variable name="detect_prefix" select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix" xpath-default-namespace=""/>
  309. <xsl:namespace name="{$detect_prefix}" select="@targetNamespace"/>
  310. <xsl:copy-of select="@targetNamespace"/>
  311. <xsl:attribute name="vc:minVersion" select="'1.0'"/>
  312. <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
  313. <xsl:comment>#147 when @targetNamespace and prefix probably exists!</xsl:comment>
  314. <!--<xsl:copy-of select="*" copy-namespaces="yes"/>-->
  315. <!--<xs:debug_test>
  316. <xsl:value-of select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix"/>
  317. </xs:debug_test>
  318. <xs:debug>
  319. <xsl:copy-of select="$namespaces_cur"/>
  320. </xs:debug>
  321. <xs:debug_filter>
  322. <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]"/>
  323. </xs:debug_filter>
  324. <xs:debug_filter_NS>
  325. <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]" xpath-default-namespace=""/>
  326. </xs:debug_filter_NS>-->
  327. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>
  328. </xsl:when>
  329. <xsl:otherwise>
  330. <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
  331. <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  332. <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  333. <xsl:attribute name="vc:minVersion" select="'1.0'"/>
  334. <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
  335. <xsl:message>#35 detect. targetNamespace <xsl:value-of select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/></xsl:message>
  336. <xsl:comment>#158 otherwise not @targetNamespace and no prefix</xsl:comment>
  337. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
  338. <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
  339. <xsl:with-param name="detect_targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  340. <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
  341. </xsl:apply-templates>
  342. </xsl:otherwise>
  343. </xsl:choose>
  344. </xsl:element>
  345. </xsl:template>
  346. <xsl:template match="*" mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  347. <xsl:element name="{$XMLSchema_prefix}:{local-name()}" namespace="http://www.w3.org/2001/XMLSchema">
  348. <xsl:apply-templates select="@*" mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>
  349. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>
  350. </xsl:element>
  351. </xsl:template>
  352. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" match="@type|@base">
  353. <!-- sa bledy ze schematami z prefix xsd... -->
  354. <xsl:choose>
  355. <xsl:when test="contains(.,'xsd:')">
  356. <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
  357. </xsl:when>
  358. <xsl:otherwise>
  359. <xsl:attribute name="{name()}" select="."/>
  360. </xsl:otherwise>
  361. </xsl:choose>
  362. </xsl:template>
  363. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" match="@*">
  364. <xsl:attribute name="{name()}" select="."/>
  365. </xsl:template>
  366. <xsl:template match="*" mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  367. <xsl:param name="detect_prefix" required="yes"/>
  368. <xsl:param name="detect_targetNamespace" required="yes"/>
  369. <xsl:param name="namespaces_cur" required="yes"/>
  370. <xsl:element name="{$XMLSchema_prefix}:{local-name()}" namespace="http://www.w3.org/2001/XMLSchema">
  371. <!--<xsl:attribute name="test_prefix" select="system_cache__appinfo:prefix_from_targetNamespace($namespaces_cur,'http://www.w3.org/2001/XMLSchema')"/>-->
  372. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" select="@*">
  373. <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
  374. <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
  375. </xsl:apply-templates>
  376. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
  377. <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
  378. <xsl:with-param name="detect_targetNamespace" select="$detect_targetNamespace"/>
  379. <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
  380. </xsl:apply-templates>
  381. </xsl:element>
  382. </xsl:template>
  383. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@type|@base">
  384. <!-- sa bledy ze schematami z prefix xsd... -->
  385. <xsl:param name="namespaces_cur" required="yes"/>
  386. <xsl:param name="detect_prefix" required="yes"/>
  387. <xsl:choose>
  388. <!--<xsl:when test="contains(.,'xsd:')">
  389. <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
  390. </xsl:when>-->
  391. <xsl:when test="not(contains(.,':'))">
  392. <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
  393. </xsl:when>
  394. <xsl:when test="system_cache__appinfo:prefix_from_targetNamespace($namespaces_cur,'http://www.w3.org/2001/XMLSchema')=system_cache__appinfo:get_object_prefix(.)">
  395. <!--<xsl:message terminate="yes">#281 - wykryte ze jest to type XSD <xsl:value-of select="."/></xsl:message>-->
  396. <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
  397. </xsl:when>
  398. <xsl:when test="contains(.,':')">
  399. <xsl:copy-of select="."/>
  400. </xsl:when>
  401. <xsl:otherwise>
  402. <xsl:message> #285 test : <xsl:value-of select="system_cache__appinfo:prefix_from_targetNamespace($namespaces_cur,'http://www.w3.org/2001/XMLSchema')"/> = <xsl:value-of select="system_cache__appinfo:get_object_prefix(.)"/> (<xsl:value-of select="."/>) ?</xsl:message>
  403. <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
  404. </xsl:otherwise>
  405. </xsl:choose>
  406. </xsl:template>
  407. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@ref">
  408. <xsl:param name="namespaces_cur" required="yes"/>
  409. <xsl:param name="detect_prefix" required="yes"/>
  410. <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
  411. </xsl:template>
  412. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@*">
  413. <xsl:param name="namespaces_cur" required="yes"/>
  414. <xsl:attribute name="{name()}" select="."/>
  415. </xsl:template>
  416. <!-- EOF external schema templates -->
  417. <xsl:template name="system_cache__appinfo:get_all_xsd">
  418. <xsl:param name="path2collection" select="$procesy5_system_schema_collection_dir"/>
  419. <xsl:param name="get_system_schemas"/>
  420. <xsl:param name="cache" select="$cache"/>
  421. <xsl:variable name="element-filename" select="'procesy5_system_schema'"/>
  422. <xsl:choose>
  423. <xsl:when test="unparsed-text-available(concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')) and $cache='read'">
  424. <xsl:copy-of select="doc(concat('../default_db.instance.xml/transformed/',$element-filename,'.xml'))"/>
  425. </xsl:when>
  426. <xsl:otherwise>
  427. <xsl:variable name="path">
  428. <xsl:value-of select="concat($path2collection,'?select=*.(xsd);recurse=yes;on-error=warning')"/>
  429. </xsl:variable>
  430. <xsl:variable name="docs" select="collection($path)"/>
  431. <xsl:variable name="procesy5_system_schema">
  432. <system_cache__appinfo:get_all_xsd_list>
  433. <xsl:for-each select="$docs">
  434. <xsl:message> get_all_xsd przetwarzam plik <xsl:value-of select="document-uri(/)"/></xsl:message>
  435. <xsl:choose>
  436. <xsl:when test=" contains(document-uri(/), concat($external_schema,'/'))">
  437. <xsl:comment>#145 Ignored /public_html/external_schema <xsl:value-of select="document-uri(/)"/></xsl:comment>
  438. <system_cache__appinfo:get_all_xsd_external_schema>
  439. <xsl:attribute name="system_cache__appinfo:document-uri" select="system_cache__appinfo:document-uri_for_external_schema_id_namespace_prefix(document-uri(/))"/>
  440. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="system_cache__appinfo:document-uri-full_for_external_schema_id_namespace_prefix(document-uri(/))"/>
  441. <xsl:attribute name="system_cache__appinfo:document-uri-orig" select="substring-after(document-uri(/), $external_schema)"/>
  442. <!--<xsl:attribute name="system_cache__appinfo:document-uri-full-orig" select="document-uri(/)"/>-->
  443. <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  444. <xsl:element name="{name()}">
  445. <xsl:for-each select="@*">
  446. <xsl:attribute name="{name()}" select="."/>
  447. <xsl:copy-of select="child::node()"/>
  448. </xsl:for-each>
  449. </xsl:element>
  450. </xsl:for-each>-->
  451. <!--<xsl:copy-of select="/"/>-->
  452. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema" select=".">
  453. <xsl:with-param name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  454. </xsl:apply-templates>
  455. </system_cache__appinfo:get_all_xsd_external_schema>
  456. </xsl:when>
  457. <xsl:when test=" contains(document-uri(/), concat($external_schema_id_namespace_prefix,'/'))">
  458. <xsl:comment>#248 Ignored /public_html/external_schema_id_namespace_prefix <xsl:value-of select="document-uri(/)"/></xsl:comment>
  459. <system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
  460. <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  461. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
  462. <xsl:attribute name="system_cache__appinfo:document-uri-orig" select="substring-after(document-uri(/), $external_schema_id_namespace_prefix)"/>
  463. <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  464. <xsl:element name="{name()}">
  465. <xsl:for-each select="@*">
  466. <xsl:attribute name="{name()}" select="."/>
  467. <xsl:copy-of select="child::node()"/>
  468. </xsl:for-each>
  469. </xsl:element>
  470. </xsl:for-each>-->
  471. <!--<xsl:copy-of select="/"/>-->
  472. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" select=".">
  473. <xsl:with-param name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  474. </xsl:apply-templates>
  475. </system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
  476. </xsl:when>
  477. <xsl:otherwise>
  478. <system_cache__appinfo:get_all_xsd>
  479. <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  480. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
  481. <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  482. <xsl:element name="{name()}">
  483. <xsl:for-each select="@*">
  484. <xsl:attribute name="{name()}" select="."/>
  485. <xsl:copy-of select="child::node()"/>
  486. </xsl:for-each>
  487. </xsl:element>
  488. </xsl:for-each>-->
  489. <xsl:copy-of select="/"/>
  490. </system_cache__appinfo:get_all_xsd>
  491. </xsl:otherwise>
  492. </xsl:choose>
  493. </xsl:for-each>
  494. <!-- -->
  495. <xsl:message> schemat dla XML primitives <xsl:value-of select="'http://www.w3.org/1999/XSL/Transform'"/></xsl:message>
  496. <system_cache__appinfo:get_all_xsd>
  497. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
  498. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
  499. <xsl:copy-of select="$system_cache__appinfo:primitives.xsd"/>
  500. </system_cache__appinfo:get_all_xsd>
  501. <xsl:message> schemat dla XML primitives/derived <xsl:value-of select="'http://www.w3.org/1999/XSL/Transform'"/></xsl:message>
  502. <system_cache__appinfo:get_all_xsd>
  503. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
  504. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
  505. <xsl:copy-of select="$system_cache__appinfo:derived.xsd"/>
  506. </system_cache__appinfo:get_all_xsd>
  507. <system_cache__appinfo:get_all_xsd>
  508. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
  509. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
  510. <xsl:copy-of select="$system_cache__appinfo:XMLSchema11.xsd"/>
  511. </system_cache__appinfo:get_all_xsd>
  512. <system_cache__appinfo:get_all_xsd>
  513. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
  514. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
  515. <xsl:copy-of select="$system_cache__appinfo:builtintypes.xsd"/>
  516. </system_cache__appinfo:get_all_xsd>
  517. <system_cache__appinfo:get_all_xsd>
  518. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
  519. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
  520. <xsl:copy-of select="$system_cache__appinfo:p5Type.xsd"/>
  521. </system_cache__appinfo:get_all_xsd>
  522. </system_cache__appinfo:get_all_xsd_list>
  523. </xsl:variable>
  524. <!--<xsl:result-document href="{concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')}">
  525. <xsl:copy-of select="$procesy5_system_schema"/>
  526. </xsl:result-document>-->
  527. <xsl:copy-of select="$procesy5_system_schema"></xsl:copy-of>
  528. </xsl:otherwise>
  529. </xsl:choose>
  530. </xsl:template>
  531. <!--TODO DISABLED TEMPORARY - IF IS USED? <xsl:template name="system_cache__appinfo:vrtfNamespaces"><!-\- consider namespaces for get_all_xsd_external_schema -\->
  532. <xsl:variable name="procesy5_system_schema">
  533. <xsl:call-template name="system_cache__appinfo:get_all_xsd">
  534. <xsl:with-param name="path2collection" select="$procesy5_system_schema_collection_dir"/>
  535. <xsl:with-param name="cache" select="'read'"/>
  536. </xsl:call-template>
  537. </xsl:variable>
  538. <system_cache__appinfo:vrtfNamespaces>
  539. <xsl:for-each select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/system_cache__appinfo:get_all_xsd/schema/namespace::node()"
  540. xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  541. <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
  542. </xsl:for-each>
  543. </system_cache__appinfo:vrtfNamespaces>
  544. </xsl:template>-->
  545. <!--<xsl:template name="system_cache__appinfo:vrtfNamespaces_external_schema">
  546. <xsl:variable name="procesy5_system_schema">
  547. <xsl:call-template name="system_cache__appinfo:get_all_xsd">
  548. <xsl:with-param name="path2collection" select="$procesy5_system_schema_collection_dir"/>
  549. <xsl:with-param name="cache" select="'read'"/>
  550. </xsl:call-template>
  551. </xsl:variable>
  552. <system_cache__appinfo:vrtfNamespaces_external_schema>
  553. <xsl:for-each select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/system_cache__appinfo:get_all_xsd_external_schema/schema/namespace::node()"
  554. xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  555. <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
  556. </xsl:for-each>
  557. </system_cache__appinfo:vrtfNamespaces_external_schema>
  558. </xsl:template>-->
  559. <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:vrtfNamespaces">
  560. <system_cache__appinfo:vrtfNamespaces>
  561. <xsl:for-each select="//(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema/namespace::node()"
  562. xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  563. <ns element="{name(..)}" prefix="{name()}" uri="{.}" system_cache__appinfo:document-uri="{../@system_cache__appinfo:document-uri}"/>
  564. </xsl:for-each>
  565. </system_cache__appinfo:vrtfNamespaces>
  566. </xsl:template>
  567. <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:element_complexType">
  568. <xsl:param name="targetNamespace" select="$targetNamespace_DEFAULTS"/>
  569. <system_cache__appinfo:element_complexType>
  570. <xsl:for-each select="get_all_xsd[ substring-before(@system_cache__appinfo:document-uri,'/')!='default_db_xml_cache' and substring-before(@system_cache__appinfo:document-uri,'/')!='default_db_xml_cache.public']" xpath-default-namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
  571. <xsl:variable name="get_all_xsd_236" select="."/>
  572. <xsl:comment>
  573. 246:detect_resource_type, przetwarzam schemat:<xsl:value-of select="@system_cache__appinfo:document-uri"/>; $targetNamespace:<xsl:value-of select="$targetNamespace"/>;
  574. @targetNamespace:<xsl:value-of select="schema/@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;</xsl:comment>
  575. <xsl:variable name="schema_node_144" select="."/>
  576. <xsl:for-each select="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!--[ @targetNamespace != $targetNamespace ] namespace::node() = $targetNamespace and @targetNamespace='moj_ogrodek' -->
  577. <xsl:message>239::detect_resource_type przetwarzam schemat:@targetNamespace:<xsl:value-of select="@targetNamespace"/>;</xsl:message>
  578. <xsl:variable name="prefix_83" select="namespace::node()[. = $targetNamespace]/name()"/>
  579. <xsl:variable name="targetNamespace_134" select="@targetNamespace"/>
  580. <xsl:variable name="prefix_134" select="namespace::node()[. = $targetNamespace_134][1]/name()"/><!-- np. test_objects -->
  581. <xsl:if test="not(@targetNamespace) or not($prefix_134) ">
  582. <xsl:message terminate="yes">#394 ERROR - schema error - set @targetNamespace and prefix for shema file:<xsl:value-of select="../@system_cache__appinfo:document-uri-full"/> ; </xsl:message>
  583. </xsl:if>
  584. <xsl:if test="count(.//node()[(local-name()='element' or local-name()='complexType' or local-name()='sequence' or local-name()='choice' or local-name()='complexContent' or local-name()='extension' ) and not(@id)])=0">
  585. <xsl:for-each select="(element|complexType)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!-- dla ograniczenia mozna [$prefix_134='test_objects']-->
  586. <xsl:variable name="complexType_or_element_name186">
  587. <xsl:choose>
  588. <xsl:when test="local-name()='element'"><xsl:value-of select="@name"/></xsl:when>
  589. <xsl:when test="local-name()='complexType'"><xsl:value-of select="@name"/></xsl:when>
  590. <xsl:otherwise><xsl:message terminate="yes">#391 it should work only for element or complexType</xsl:message></xsl:otherwise>
  591. </xsl:choose>
  592. </xsl:variable>
  593. <xsl:comment>157: buduje plaski obiekt/mape przetwarzania w celu przeszukania relacji @id:<xsl:value-of select="@id"/>; targetNamespace:<xsl:value-of select="$prefix_134"/>; $complexType_or_element_name186:<xsl:value-of select="$complexType_or_element_name186"/>; name:<xsl:value-of select="@name"/>; namespace-uri-for-prefix:<xsl:value-of select="namespace-uri-for-prefix($prefix_134,.)"/></xsl:comment>
  594. <xsl:message>157: buduje plaski obiekt/mape przetwarzania w celu przeszukania relacji @id:<xsl:value-of select="@id"/>; targetNamespace:<xsl:value-of select="$prefix_134"/>; $complexType_or_element_name186:<xsl:value-of select="$complexType_or_element_name186"/>; name:<xsl:value-of select="@name"/>; namespace-uri-for-prefix:<xsl:value-of select="namespace-uri-for-prefix($prefix_134,.)"/></xsl:message>
  595. <xsl:choose>
  596. <xsl:when test="local-name()='element'">
  597. <build_cache name="build_element">
  598. <with-param name="element" select="{$prefix_134}:{$complexType_or_element_name186}"/>
  599. </build_cache>
  600. </xsl:when>
  601. <xsl:when test="local-name()='complexType'">
  602. <build_cache name="build_complexType">
  603. <with-param name="complexType"
  604. select="{$prefix_134}:{$complexType_or_element_name186}"/>
  605. </build_cache>
  606. </xsl:when>
  607. </xsl:choose>
  608. </xsl:for-each>
  609. </xsl:if>
  610. </xsl:for-each>
  611. </xsl:for-each>
  612. </system_cache__appinfo:element_complexType>
  613. </xsl:template>
  614. <!-- do aktualizowania pozycji w schemache-->
  615. <xsl:template name="system_cache__appinfo:position">
  616. <xsl:param name="xml"/>
  617. <xsl:for-each select="$xml/*">
  618. <xsl:if test="name()">
  619. <xsl:element name="{name()}">
  620. <xsl:attribute name="system_cache__appinfo:position" select="position()"/>
  621. <xsl:apply-templates mode="system_cache__appinfo:position" select="@*"/>
  622. <xsl:call-template name="system_cache__appinfo:position">
  623. <xsl:with-param name="xml" select="."/>
  624. </xsl:call-template>
  625. </xsl:element>
  626. </xsl:if>
  627. </xsl:for-each>
  628. </xsl:template>
  629. <xsl:template match="@*" mode="system_cache__appinfo:position">
  630. <xsl:attribute name="{name()}" select="."/>
  631. </xsl:template>
  632. <xsl:template match="text()" mode="system_cache__appinfo:position"/>
  633. <xsl:template match="comment()" mode="system_cache__appinfo:position"/>
  634. </xsl:stylesheet>