get_all_xsd.xsl 53 KB

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