get_all_xsd.xsl 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  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:p5_tr_map="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/procesy5_translate_map.xsd"
  7. xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
  8. xmlns:system_cache__resources_tree_generate_xsl_required_occurs_raport="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/resources_tree_generate_xsl_require_occurs_raport"
  9. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  10. xmlns:p5opr="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/object_parent_relations/object_parent_relations.xsd"
  11. xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
  12. <xsl:import href="system_cache__appinfo/vrtfNamespaces.xsl"/>
  13. <xsl:import href="p5_tr_map/element-filename.xsl"/>
  14. <xsl:import href="object_parent_relations/element-filename.xsl"/> <!-- param name="p5opr:detect_objects_parent_relations.local" required="yes" -->
  15. <!--<xsl:import href="system_cache__appinfo/element-filename.xsl"/>-->
  16. <xsl:output indent="yes"/>
  17. <xsl:strip-space elements="*"/>
  18. <xsl:param name="vc:minVersion" select="'1.1'" />
  19. <xsl:param name="vc:maxVersion"/>
  20. <xsl:param name="procesy5_system_schema" select="'../default_db.instance.xml/transformed/procesy5_system_schema.xml'"/>
  21. <xsl:param name="procesy5_system_schema_collection_dir" select="'../'"/>
  22. <xsl:param name="cache" select="'read'"/>
  23. <xsl:param name="targetNamespace_DEFAULTS" select="'http://biuro.biall-net.pl/xmlschema_procesy5/default_db'"/>
  24. <xsl:param name="external_schema" select="'/public_html/external_schema'"/>
  25. <xsl:param name="external_schema_id_namespace_prefix" select="'/public_html/external_schema_id_namespace_prefix'"/>
  26. <xsl:param name="XMLSchema_prefix" select="'xs'"/>
  27. <xsl:param name="external_schema_table.path" required="yes"/>
  28. <xsl:param name="default_db.dir" select="'/public_html/default_db/'"/>
  29. <xsl:param name="default_db_xml_cache.public" select="'/public_html/default_db_xml_cache.public/'"/>
  30. <xsl:param name="targetNamespace_DEFAULTS_prefix" select="'default_db'"/>
  31. <xsl:param name="WPS_Functions" select="'public_html/WPS_Functions/'"/>
  32. <xsl:param name="new-schema-with-ID-to-move-and-rename-to-xsd" select="'/new-schema-with-ID-to-move-and-rename-to-xsd'"/>
  33. <xsl:param name="default_db.instance.xml" required="yes"/> <!-- todo better always include get_all_xsd -->
  34. <xsl:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
  35. <xsl:include href="system_cache__appinfo/external_schema_targetNamespace.xsl"/>
  36. <xsl:include href="system_cache__appinfo/functions.xsl"/>
  37. <xsl:include href="system_cache__resources_tree_generate_xsl_required_occurs_raport/element-filename.xsl"/>
  38. <xsl:include href="system_cache__resources_tree_generate_xsl_required_occurs_raport/detect_resource_type.local.xsl"/>
  39. <xsl:include href="system_cache__appinfo/element-filename.xsl"/>
  40. <xsl:template name="main">
  41. <xsl:call-template name="system_cache__appinfo:get_all_xsd">
  42. <xsl:with-param name="path2collection" select="'../'"/>
  43. <xsl:with-param name="cache" select="'read'"/>
  44. </xsl:call-template>
  45. </xsl:template>
  46. <!-- BEGIN external schema templates -->
  47. <!-- <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">
  48. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema__equals"/>
  49. </xsl:template>
  50. <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"/>
  51. <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">
  52. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema__equals"/>
  53. </xsl:template>
  54. -->
  55. <xsl:template match="complexType" mode="system_cache__appinfo:get_all_xsd_default_db__equals" xpath-default-namespace="http://www.w3.org/2001/XMLSchema" >
  56. <xsl:param name="system_cache__appinfo:get_all_xsd.row" required="yes"/>
  57. <xsl:if test="not($system_cache__appinfo:get_all_xsd.row/*)">
  58. <not_equals>
  59. <xsl:attribute name="empty" select="@name"/>
  60. </not_equals>
  61. </xsl:if>
  62. <xsl:variable name="system_cache__appinfo:get_all_xsd.row">
  63. <var>
  64. <xsl:for-each select="$system_cache__appinfo:get_all_xsd.row/*">
  65. <xsl:element name="{name()}">
  66. <xsl:attribute name="pos" select="position()"/>
  67. <xsl:copy-of select="@*"/>
  68. <xsl:copy-of select="*"/>
  69. </xsl:element>
  70. </xsl:for-each>
  71. </var>
  72. </xsl:variable>
  73. <system_cache__appinfo:get_all_xsd_default_db__equals>
  74. <xsl:copy-of select="@*"/>
  75. <xsl:call-template name="system_cache__appinfo:get_all_xsd_default_db__equals">
  76. <xsl:with-param name="system_cache__appinfo:get_all_xsd_default_db" select=".[*]"/>
  77. <xsl:with-param name="system_cache__appinfo:get_all_xsd.row" select="$system_cache__appinfo:get_all_xsd.row"/>
  78. </xsl:call-template>
  79. <!--<system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
  80. <xsl:copy-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix"></xsl:copy-of>
  81. </system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>-->
  82. </system_cache__appinfo:get_all_xsd_default_db__equals>
  83. </xsl:template>
  84. <xsl:template match="system_cache__appinfo:get_all_xsd_external_schema" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" >
  85. <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
  86. <xsl:variable name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix">
  87. <var>
  88. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/*">
  89. <xsl:element name="{name()}">
  90. <xsl:attribute name="pos" select="position()"/>
  91. <xsl:copy-of select="@*"/>
  92. <xsl:copy-of select="*"/>
  93. </xsl:element>
  94. </xsl:for-each>
  95. </var>
  96. </xsl:variable>
  97. <system_cache__appinfo:get_all_xsd_external_schema__equals>
  98. <xsl:copy-of select="@*"/>
  99. <xsl:call-template name="system_cache__appinfo:get_all_xsd_external_schema__equals">
  100. <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema" select=".[*]"/>
  101. <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"/>
  102. </xsl:call-template>
  103. <!--<system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
  104. <xsl:copy-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix"></xsl:copy-of>
  105. </system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>-->
  106. </system_cache__appinfo:get_all_xsd_external_schema__equals>
  107. </xsl:template>
  108. <!--<xsl:template match="schema" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  109. <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
  110. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema__equals">
  111. <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/*"/>
  112. </xsl:apply-templates>
  113. </xsl:template>-->
  114. <xsl:template name="system_cache__appinfo:get_all_xsd_default_db__equals" >
  115. <xsl:param name="system_cache__appinfo:get_all_xsd_default_db" required="yes"/>
  116. <xsl:param name="system_cache__appinfo:get_all_xsd.row" required="yes"/>
  117. <!--<pre_external_schema>
  118. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema/*">
  119. <xsl:element name="{name()}"><xsl:copy-of select="@*"/></xsl:element>
  120. </xsl:for-each>
  121. </pre_external_schema>
  122. <pre_schema_id_namespace_prefix>
  123. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*">
  124. <xsl:element name="{name()}"><xsl:copy-of select="@*"/></xsl:element>
  125. </xsl:for-each>
  126. </pre_schema_id_namespace_prefix>-->
  127. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_default_db/*">
  128. <xsl:variable name="position" select="position()"/>
  129. <xsl:comment> Try position <xsl:value-of select="$position"/>;</xsl:comment>
  130. <xsl:choose>
  131. <!--<xsl:when test="not($position = $pos)">
  132. <not_pos>
  133. <xsl:attribute name="pos" select="$pos"/>
  134. <xsl:attribute name="position" select="$position"/>
  135. <xsl:attribute name="expected" select="local-name()"/>
  136. </not_pos>
  137. </xsl:when>-->
  138. <xsl:when test="$system_cache__appinfo:get_all_xsd.row/var/*[ @pos = $position]/local-name() = local-name()">
  139. <equals>
  140. <xsl:attribute name="position" select="position()"/>
  141. <xsl:attribute name="expected" select="local-name()"/>
  142. <xsl:attribute name="found" select="$system_cache__appinfo:get_all_xsd.row/var/*[ @pos = $position]/local-name()"/>
  143. <xsl:attribute name="found.name" select="$system_cache__appinfo:get_all_xsd.row/var/*[ @pos = $position]/@name"/>
  144. <xsl:attribute name="first_el_par" select="$system_cache__appinfo:get_all_xsd.row/var[1]/name()"/>
  145. </equals>
  146. <!--<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>-->
  147. </xsl:when>
  148. <xsl:otherwise>
  149. <not_equals>
  150. <xsl:attribute name="position" select="position()"/>
  151. <xsl:attribute name="expected" select="local-name()"/>
  152. <xsl:attribute name="expected.name" select="@name"/>
  153. <xsl:attribute name="found" select="$system_cache__appinfo:get_all_xsd.row/var/*[ @pos = $position]/local-name()"/>
  154. <xsl:attribute name="found.name" select="$system_cache__appinfo:get_all_xsd.row/var/*[ @pos = $position]/@name"/>
  155. <xsl:attribute name="found_id" select="$system_cache__appinfo:get_all_xsd.row/var/*[ @pos = $position]/@id"/>
  156. <xsl:attribute name="found_pos" select="$system_cache__appinfo:get_all_xsd.row/var/*[ @pos = $position]/@pos"/>
  157. <xsl:attribute name="first_el_par" select="$system_cache__appinfo:get_all_xsd.row/var/*[1]/name()"/>
  158. </not_equals>
  159. </xsl:otherwise>
  160. </xsl:choose>
  161. <!--<child>-->
  162. <xsl:variable name="system_cache__appinfo:get_all_xsd_default_db_new">
  163. <var>
  164. <xsl:for-each select="$system_cache__appinfo:get_all_xsd.row/var/*[@pos=$position]/*">
  165. <xsl:element name="{name()}">
  166. <xsl:attribute name="pos" select="position()"/>
  167. <xsl:copy-of select="@*"/>
  168. <xsl:copy-of select="*"/>
  169. </xsl:element>
  170. </xsl:for-each>
  171. </var>
  172. </xsl:variable>
  173. <!--<test_var_new><xsl:copy-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix_new"/></test_var_new>-->
  174. <xsl:call-template name="system_cache__appinfo:get_all_xsd_default_db__equals">
  175. <xsl:with-param name="system_cache__appinfo:get_all_xsd_default_db" select=".[*]"/>
  176. <xsl:with-param name="system_cache__appinfo:get_all_xsd.row" select="$system_cache__appinfo:get_all_xsd_default_db_new/.[*]"/>
  177. </xsl:call-template>
  178. <!--</child>-->
  179. </xsl:for-each>
  180. </xsl:template>
  181. <xsl:template name="system_cache__appinfo:get_all_xsd_external_schema__equals" >
  182. <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema" required="yes"/>
  183. <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
  184. <!--<pre_external_schema>
  185. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema/*">
  186. <xsl:element name="{name()}"><xsl:copy-of select="@*"/></xsl:element>
  187. </xsl:for-each>
  188. </pre_external_schema>
  189. <pre_schema_id_namespace_prefix>
  190. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*">
  191. <xsl:element name="{name()}"><xsl:copy-of select="@*"/></xsl:element>
  192. </xsl:for-each>
  193. </pre_schema_id_namespace_prefix>-->
  194. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema/*">
  195. <xsl:variable name="position" select="position()"/>
  196. <xsl:comment> Try position <xsl:value-of select="$position"/>;</xsl:comment>
  197. <xsl:choose>
  198. <!--<xsl:when test="not($position = $pos)">
  199. <not_pos>
  200. <xsl:attribute name="pos" select="$pos"/>
  201. <xsl:attribute name="position" select="$position"/>
  202. <xsl:attribute name="expected" select="local-name()"/>
  203. </not_pos>
  204. </xsl:when>-->
  205. <xsl:when test="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/local-name() = local-name()">
  206. <!--<equals>
  207. <xsl:attribute name="position" select="position()"/>
  208. <xsl:attribute name="expected" select="local-name()"/>
  209. <xsl:attribute name="found" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/local-name()"/>
  210. <xsl:attribute name="first_el_par" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var[1]/name()"/>
  211. </equals>-->
  212. <!--<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>-->
  213. </xsl:when>
  214. <xsl:otherwise>
  215. <not_equals>
  216. <xsl:attribute name="position" select="position()"/>
  217. <xsl:attribute name="expected" select="local-name()"/>
  218. <xsl:attribute name="found" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/local-name()"/>
  219. <xsl:attribute name="found_id" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/@id"/>
  220. <xsl:attribute name="found_pos" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/@pos"/>
  221. <xsl:attribute name="first_el_par" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[1]/name()"/>
  222. </not_equals>
  223. </xsl:otherwise>
  224. </xsl:choose>
  225. <!--<child>-->
  226. <xsl:variable name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix_new">
  227. <var>
  228. <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[@pos=$position]/*">
  229. <xsl:element name="{name()}">
  230. <xsl:attribute name="pos" select="position()"/>
  231. <xsl:copy-of select="@*"/>
  232. <xsl:copy-of select="*"/>
  233. </xsl:element>
  234. </xsl:for-each>
  235. </var>
  236. </xsl:variable>
  237. <!--<test_var_new><xsl:copy-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix_new"/></test_var_new>-->
  238. <xsl:call-template name="system_cache__appinfo:get_all_xsd_external_schema__equals">
  239. <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema" select=".[*]"/>
  240. <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/.[*]"/>
  241. </xsl:call-template>
  242. <!--</child>-->
  243. </xsl:for-each>
  244. </xsl:template>
  245. <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">
  246. <xsl:param name="system_cache__appinfo:document-uri" required="yes"/>
  247. <xsl:variable name="targetNamespace" select="@targetNamespace"/>
  248. <xsl:variable name="namespaces_cur">
  249. <namespaces_cur>
  250. <xsl:for-each select="namespace::node()">
  251. <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
  252. </xsl:for-each>
  253. </namespaces_cur>
  254. </xsl:variable>
  255. <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema" extension-element-prefixes="#default" inherit-namespaces="yes">
  256. <xsl:choose>
  257. <xsl:when test="@targetNamespace and ( not($namespaces_cur//ns[@uri=$targetNamespace]/@prefix) or $namespaces_cur//ns[@uri=$targetNamespace]/@prefix='' ) " xpath-default-namespace="">
  258. <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
  259. <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace(@targetNamespace)"/>
  260. <xsl:copy-of select="namespace::node()"/>
  261. <xsl:namespace name="p5Type" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
  262. <xsl:copy-of select="@targetNamespace"/>
  263. <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
  264. <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
  265. <xsl:comment>#144 when @targetNamespace exists and prefix not exists</xsl:comment>
  266. <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>
  267. <xsl:comment> count: <xsl:value-of select="count($namespaces_cur/namespaces_cur/ns)"/> </xsl:comment>
  268. <xsl:copy-of select="*"/>
  269. </xsl:when>
  270. <xsl:when test="@targetNamespace">
  271. <xsl:variable name="detect_prefix" select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix" xpath-default-namespace=""/>
  272. <xsl:namespace name="{$detect_prefix}" select="@targetNamespace"/>
  273. <xsl:namespace name="p5Type" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
  274. <xsl:copy-of select="namespace::node()"/>
  275. <xsl:copy-of select="@targetNamespace"/>
  276. <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
  277. <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
  278. <xsl:comment>#147 when @targetNamespace and prefix probably exists!</xsl:comment>
  279. <xsl:copy-of select="*"/>
  280. </xsl:when>
  281. <xsl:otherwise>
  282. <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
  283. <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  284. <xsl:copy-of select="namespace::node()"/>
  285. <xsl:namespace name="p5Type" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
  286. <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  287. <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
  288. <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
  289. <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>
  290. <xsl:comment>#158 otherwise not @targetNamespace and no prefix</xsl:comment>
  291. <xsl:copy-of select="*"/>
  292. </xsl:otherwise>
  293. </xsl:choose>
  294. </xsl:element>
  295. </xsl:template>
  296. <xsl:template match="schema" mode="system_cache__appinfo:get_all_xsd_external_schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  297. <xsl:param name="system_cache__appinfo:document-uri" required="yes"/>
  298. <xsl:variable name="targetNamespace" select="@targetNamespace"/>
  299. <xsl:variable name="namespaces_cur">
  300. <namespaces_cur>
  301. <xsl:for-each select="namespace::node()">
  302. <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
  303. </xsl:for-each>
  304. </namespaces_cur>
  305. </xsl:variable>
  306. <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema" extension-element-prefixes="#default" inherit-namespaces="yes">
  307. <xsl:choose>
  308. <xsl:when test="@targetNamespace and ( not($namespaces_cur//ns[@uri=$targetNamespace]/@prefix) or $namespaces_cur//ns[@uri=$targetNamespace]/@prefix='' ) " xpath-default-namespace="">
  309. <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
  310. <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace(@targetNamespace)"/>
  311. <xsl:copy-of select="namespace::node()"/>
  312. <xsl:copy-of select="@targetNamespace"/>
  313. <xsl:attribute name="vc:minVersion" select="'1.0'"/>
  314. <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
  315. <xsl:comment>#144 when @targetNamespace exists and prefix not exists</xsl:comment>
  316. <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>
  317. <xsl:comment> count: <xsl:value-of select="count($namespaces_cur/namespaces_cur/ns)"/> </xsl:comment>
  318. <!--<xsl:for-each select="$namespaces_cur/namespaces_cur/ns">
  319. <xsl:comment> ns @element=<xsl:value-of select="@element"/>; @prefix=<xsl:value-of select="@prefix"/>; @uri=<xsl:value-of select="@uri"/>;</xsl:comment>
  320. </xsl:for-each>-->
  321. <!-- <xs:debug>
  322. <xsl:copy-of select="$namespaces_cur"/>
  323. </xs:debug>
  324. <xs:debug_filter>
  325. <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]"/>
  326. </xs:debug_filter>
  327. <xs:debug_filter_NS>
  328. <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]" xpath-default-namespace=""/>
  329. </xs:debug_filter_NS>-->
  330. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
  331. <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
  332. <xsl:with-param name="detect_targetNamespace" select="@targetNamespace"/>
  333. <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
  334. </xsl:apply-templates>
  335. </xsl:when>
  336. <xsl:when test="@targetNamespace">
  337. <xsl:variable name="detect_prefix" select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix" xpath-default-namespace=""/>
  338. <xsl:namespace name="{$detect_prefix}" select="@targetNamespace"/>
  339. <xsl:copy-of select="namespace::node()"/>
  340. <xsl:copy-of select="@targetNamespace"/>
  341. <xsl:attribute name="vc:minVersion" select="'1.1'"/>
  342. <!--<xsl:attribute name="vc:maxVersion" select="'1.1'"/>-->
  343. <xsl:comment>#147 when @targetNamespace and prefix probably exists!</xsl:comment>
  344. <!--<xsl:copy-of select="*" copy-namespaces="yes"/>-->
  345. <!--<xs:debug_test>
  346. <xsl:value-of select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix"/>
  347. </xs:debug_test>
  348. <xs:debug>
  349. <xsl:copy-of select="$namespaces_cur"/>
  350. </xs:debug>
  351. <xs:debug_filter>
  352. <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]"/>
  353. </xs:debug_filter>
  354. <xs:debug_filter_NS>
  355. <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]" xpath-default-namespace=""/>
  356. </xs:debug_filter_NS>-->
  357. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>
  358. </xsl:when>
  359. <xsl:otherwise>
  360. <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
  361. <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  362. <xsl:copy-of select="namespace::node()"/>
  363. <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  364. <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
  365. <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
  366. <!--<xsl:attribute name="vc:maxVersion" select="'1.1'"/>-->
  367. <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>
  368. <xsl:comment>#158 otherwise not @targetNamespace and no prefix</xsl:comment>
  369. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
  370. <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
  371. <xsl:with-param name="detect_targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
  372. <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
  373. </xsl:apply-templates>
  374. </xsl:otherwise>
  375. </xsl:choose>
  376. </xsl:element>
  377. </xsl:template>
  378. <xsl:template match="*" mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  379. <xsl:element name="{$XMLSchema_prefix}:{local-name()}" namespace="http://www.w3.org/2001/XMLSchema">
  380. <xsl:apply-templates select="@*" mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>
  381. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>
  382. </xsl:element>
  383. </xsl:template>
  384. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" match="@type|@base">
  385. <!-- sa bledy ze schematami z prefix xsd... -->
  386. <xsl:choose>
  387. <xsl:when test="contains(.,'xsd:')">
  388. <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
  389. </xsl:when>
  390. <xsl:otherwise>
  391. <xsl:attribute name="{name()}" select="."/>
  392. </xsl:otherwise>
  393. </xsl:choose>
  394. </xsl:template>
  395. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" match="@*">
  396. <xsl:attribute name="{name()}" select="."/>
  397. </xsl:template>
  398. <xsl:template match="*" mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  399. <xsl:param name="detect_prefix" required="yes"/>
  400. <xsl:param name="detect_targetNamespace" required="yes"/>
  401. <xsl:param name="namespaces_cur" required="yes"/>
  402. <xsl:element name="{$XMLSchema_prefix}:{local-name()}" namespace="http://www.w3.org/2001/XMLSchema">
  403. <!--<xsl:attribute name="test_prefix" select="system_cache__appinfo:prefix_from_targetNamespace($namespaces_cur,'http://www.w3.org/2001/XMLSchema')"/>-->
  404. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" select="@*">
  405. <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
  406. <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
  407. </xsl:apply-templates>
  408. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
  409. <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
  410. <xsl:with-param name="detect_targetNamespace" select="$detect_targetNamespace"/>
  411. <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
  412. </xsl:apply-templates>
  413. </xsl:element>
  414. </xsl:template>
  415. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@type|@base">
  416. <!-- sa bledy ze schematami z prefix xsd... -->
  417. <xsl:param name="namespaces_cur" required="yes"/>
  418. <xsl:param name="detect_prefix" required="yes"/>
  419. <xsl:choose>
  420. <!--<xsl:when test="contains(.,'xsd:')">
  421. <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
  422. </xsl:when>-->
  423. <xsl:when test="not(contains(.,':'))">
  424. <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
  425. </xsl:when>
  426. <xsl:when test="system_cache__appinfo:prefix_from_targetNamespace($namespaces_cur,'http://www.w3.org/2001/XMLSchema')=system_cache__appinfo:get_object_prefix(.)">
  427. <!--<xsl:message terminate="yes">#281 - wykryte ze jest to type XSD <xsl:value-of select="."/></xsl:message>-->
  428. <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
  429. </xsl:when>
  430. <xsl:when test="contains(.,':')">
  431. <xsl:copy-of select="."/>
  432. </xsl:when>
  433. <xsl:otherwise>
  434. <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>
  435. <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
  436. </xsl:otherwise>
  437. </xsl:choose>
  438. </xsl:template>
  439. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@ref">
  440. <xsl:param name="namespaces_cur" required="yes"/>
  441. <xsl:param name="detect_prefix" required="yes"/>
  442. <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
  443. </xsl:template>
  444. <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@*">
  445. <xsl:param name="namespaces_cur" required="yes"/>
  446. <xsl:attribute name="{name()}" select="."/>
  447. </xsl:template>
  448. <!-- EOF external schema templates -->
  449. <xsl:template name="system_cache__appinfo:get_all_xsd.verify_unique_id">
  450. <system_cache__appinfo:get_all_xsd.verify_unique_id>
  451. <xsl:variable name="system_cache__appinfo:get_all_xsd" select="doc($procesy5_system_schema)"/>
  452. <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">
  453. <xsl:message>#486 testing <xsl:value-of select="name()"/> and @id=<xsl:value-of select="@id"/></xsl:message>
  454. <xsl:choose>
  455. <xsl:when test="count($system_cache__appinfo:get_all_xsd//*[@id = current()/@id]) &gt; 1">
  456. <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"/>
  457. </xsl:message>
  458. </xsl:when>
  459. </xsl:choose>
  460. </xsl:for-each>
  461. </system_cache__appinfo:get_all_xsd.verify_unique_id>
  462. </xsl:template>
  463. <xsl:template name="system_cache__appinfo:get_all_xsd">
  464. <xsl:param name="path2collection" select="$procesy5_system_schema_collection_dir"/>
  465. <xsl:param name="get_system_schemas"/>
  466. <xsl:param name="cache" select="$cache"/>
  467. <xsl:variable name="element-filename" select="'procesy5_system_schema'"/>
  468. <xsl:choose>
  469. <xsl:when test="unparsed-text-available(concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')) and $cache='read'">
  470. <xsl:copy-of select="doc(concat('../default_db.instance.xml/transformed/',$element-filename,'.xml'))"/>
  471. </xsl:when>
  472. <xsl:otherwise>
  473. <xsl:variable name="path">
  474. <xsl:value-of select="concat($path2collection,'?select=*.(xsd);recurse=yes;on-error=fail;xinclude=no')"/>
  475. </xsl:variable>
  476. <xsl:variable name="docs" select="collection($path)"/>
  477. <xsl:variable name="procesy5_system_schema">
  478. <system_cache__appinfo:get_all_xsd_list>
  479. <xsl:for-each select="$docs">
  480. <xsl:message> get_all_xsd przetwarzam plik <xsl:value-of select="document-uri(/)"/></xsl:message>
  481. <xsl:choose>
  482. <xsl:when test="contains(document-uri(/),'/ant-object/')">
  483. <xsl:message>#519 ignored /ant-object for <xsl:value-of select="document-uri(/)"/>"/> ;</xsl:message>
  484. </xsl:when>
  485. <xsl:when test="contains(document-uri(/),$new-schema-with-ID-to-move-and-rename-to-xsd)">
  486. <xsl:message>#638 ignored /ant-object for <xsl:value-of select="document-uri(/)"/>;</xsl:message>
  487. </xsl:when>
  488. <xsl:when test=" contains(document-uri(/), concat($external_schema,'/'))">
  489. <xsl:comment>#145 Ignored /public_html/external_schema <xsl:value-of select="document-uri(/)"/></xsl:comment>
  490. <system_cache__appinfo:get_all_xsd_external_schema>
  491. <xsl:attribute name="system_cache__appinfo:document-uri" select="system_cache__appinfo:document-uri_for_external_schema_id_namespace_prefix(document-uri(/))"/>
  492. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="system_cache__appinfo:document-uri-full_for_external_schema_id_namespace_prefix(document-uri(/))"/>
  493. <xsl:attribute name="system_cache__appinfo:document-uri-orig" select="substring-after(document-uri(/), $external_schema)"/>
  494. <!--<xsl:attribute name="system_cache__appinfo:document-uri-full-orig" select="document-uri(/)"/>-->
  495. <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  496. <xsl:element name="{name()}">
  497. <xsl:for-each select="@*">
  498. <xsl:attribute name="{name()}" select="."/>
  499. <xsl:copy-of select="child::node()"/>
  500. </xsl:for-each>
  501. </xsl:element>
  502. </xsl:for-each>-->
  503. <!--<xsl:copy-of select="/"/>-->
  504. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema" select=".">
  505. <xsl:with-param name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  506. </xsl:apply-templates>
  507. </system_cache__appinfo:get_all_xsd_external_schema>
  508. </xsl:when>
  509. <xsl:when test=" contains(document-uri(/), concat($external_schema_id_namespace_prefix,'/'))">
  510. <xsl:comment>#248 Ignored /public_html/external_schema_id_namespace_prefix <xsl:value-of select="document-uri(/)"/></xsl:comment>
  511. <system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
  512. <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  513. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
  514. <xsl:attribute name="system_cache__appinfo:document-uri-orig" select="substring-after(document-uri(/), $external_schema_id_namespace_prefix)"/>
  515. <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  516. <xsl:element name="{name()}">
  517. <xsl:for-each select="@*">
  518. <xsl:attribute name="{name()}" select="."/>
  519. <xsl:copy-of select="child::node()"/>
  520. </xsl:for-each>
  521. </xsl:element>
  522. </xsl:for-each>-->
  523. <!--<xsl:copy-of select="/"/>-->
  524. <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" select=".">
  525. <xsl:with-param name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  526. </xsl:apply-templates>
  527. </system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
  528. </xsl:when>
  529. <xsl:when test=" contains(document-uri(/), $default_db_xml_cache.public)">
  530. <system_cache__appinfo:get_all_xsd.default_db_xml_cache.public>
  531. <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  532. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
  533. <xsl:copy-of select="/"/>
  534. </system_cache__appinfo:get_all_xsd.default_db_xml_cache.public>
  535. </xsl:when>
  536. <xsl:when test=" contains(document-uri(/), $default_db.dir)">
  537. <system_cache__appinfo:get_all_xsd_default_db>
  538. <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  539. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
  540. <xsl:copy-of select="/"/>
  541. </system_cache__appinfo:get_all_xsd_default_db>
  542. </xsl:when>
  543. <xsl:when test=" contains(document-uri(/), $external_schema_table.path)">
  544. <system_cache__appinfo:get_all_xsd_external_schema_table>
  545. <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  546. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
  547. <xsl:copy-of select="/"/>
  548. </system_cache__appinfo:get_all_xsd_external_schema_table>
  549. </xsl:when>
  550. <xsl:when test=" contains(document-uri(/), $WPS_Functions)">
  551. <xsl:comment>#700 ignored schema by contains(document-uri(/), $WPS_Functions)</xsl:comment>
  552. <xsl:message>#700 ignored schema by contains(document-uri(/), $WPS_Functions)</xsl:message>
  553. </xsl:when>
  554. <xsl:otherwise>
  555. <system_cache__appinfo:get_all_xsd>
  556. <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
  557. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
  558. <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  559. <xsl:element name="{name()}">
  560. <xsl:for-each select="@*">
  561. <xsl:attribute name="{name()}" select="."/>
  562. <xsl:copy-of select="child::node()"/>
  563. </xsl:for-each>
  564. </xsl:element>
  565. </xsl:for-each>-->
  566. <xsl:copy-of select="/"/>
  567. </system_cache__appinfo:get_all_xsd>
  568. </xsl:otherwise>
  569. </xsl:choose>
  570. </xsl:for-each>
  571. <!-- -->
  572. <xsl:message> schemat dla XML primitives <xsl:value-of select="'http://www.w3.org/1999/XSL/Transform'"/></xsl:message>
  573. <system_cache__appinfo:get_all_xsd>
  574. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
  575. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
  576. <xsl:copy-of select="$system_cache__appinfo:primitives.xsd"/>
  577. </system_cache__appinfo:get_all_xsd>
  578. <xsl:message> schemat dla XML primitives/derived <xsl:value-of select="'http://www.w3.org/1999/XSL/Transform'"/></xsl:message>
  579. <system_cache__appinfo:get_all_xsd>
  580. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
  581. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
  582. <xsl:copy-of select="$system_cache__appinfo:derived.xsd"/>
  583. </system_cache__appinfo:get_all_xsd>
  584. <system_cache__appinfo:get_all_xsd>
  585. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
  586. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
  587. <xsl:copy-of select="$system_cache__appinfo:XMLSchema11.xsd"/>
  588. </system_cache__appinfo:get_all_xsd>
  589. <system_cache__appinfo:get_all_xsd>
  590. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
  591. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
  592. <xsl:copy-of select="$system_cache__appinfo:builtintypes.xsd"/>
  593. </system_cache__appinfo:get_all_xsd>
  594. <system_cache__appinfo:get_all_xsd>
  595. <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
  596. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://biuro.biall-net.pl/p5/schema/types'"/>
  597. <xsl:copy-of select="$system_cache__appinfo:p5Type.xsd"/>
  598. </system_cache__appinfo:get_all_xsd>
  599. </system_cache__appinfo:get_all_xsd_list>
  600. </xsl:variable>
  601. <!--<xsl:result-document href="{concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')}">
  602. <xsl:copy-of select="$procesy5_system_schema"/>
  603. </xsl:result-document>-->
  604. <xsl:copy-of select="$procesy5_system_schema"></xsl:copy-of>
  605. </xsl:otherwise>
  606. </xsl:choose>
  607. </xsl:template>
  608. <!--TODO DISABLED TEMPORARY - IF IS USED? <xsl:template name="system_cache__appinfo:vrtfNamespaces"><!-\- consider namespaces for get_all_xsd_external_schema -\->
  609. <xsl:variable name="procesy5_system_schema">
  610. <xsl:call-template name="system_cache__appinfo:get_all_xsd">
  611. <xsl:with-param name="path2collection" select="$procesy5_system_schema_collection_dir"/>
  612. <xsl:with-param name="cache" select="'read'"/>
  613. </xsl:call-template>
  614. </xsl:variable>
  615. <system_cache__appinfo:vrtfNamespaces>
  616. <xsl:for-each select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/system_cache__appinfo:get_all_xsd/schema/namespace::node()"
  617. xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  618. <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
  619. </xsl:for-each>
  620. </system_cache__appinfo:vrtfNamespaces>
  621. </xsl:template>-->
  622. <!--<xsl:template name="system_cache__appinfo:vrtfNamespaces_external_schema">
  623. <xsl:variable name="procesy5_system_schema">
  624. <xsl:call-template name="system_cache__appinfo:get_all_xsd">
  625. <xsl:with-param name="path2collection" select="$procesy5_system_schema_collection_dir"/>
  626. <xsl:with-param name="cache" select="'read'"/>
  627. </xsl:call-template>
  628. </xsl:variable>
  629. <system_cache__appinfo:vrtfNamespaces_external_schema>
  630. <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()"
  631. xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  632. <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
  633. </xsl:for-each>
  634. </system_cache__appinfo:vrtfNamespaces_external_schema>
  635. </xsl:template>-->
  636. <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:vrtfNamespaces">
  637. <system_cache__appinfo:vrtfNamespaces>
  638. <xsl:for-each select="//(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix|system_cache__appinfo:get_all_xsd_default_db)/schema/namespace::node()"
  639. xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  640. <ns element="{name(..)}" prefix="{name()}" uri="{.}" system_cache__appinfo:document-uri="{../../@system_cache__appinfo:document-uri}"/>
  641. </xsl:for-each>
  642. <xsl:for-each select="//system_cache__appinfo:get_all_xsd_default_db/schema"
  643. xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  644. <xsl:variable name="targetNamespace" select="@targetNamespace"/>
  645. <xsl:choose>
  646. <xsl:when test="namespace::node()=$targetNamespace">
  647. <xsl:message>#701-A OK $targetNamespace <xsl:value-of select="$targetNamespace"/> has declared prefix </xsl:message>
  648. </xsl:when>
  649. <xsl:otherwise>
  650. <xsl:message>#701-B WARNING we should crete prefix ($zasob_id_db_targetNamespace_detect_string=<xsl:value-of select="$zasob_id_db_targetNamespace_detect_string"/>) for $targetNamespace <xsl:value-of select="$targetNamespace"/> = <xsl:value-of select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($targetNamespace)"/> </xsl:message>
  651. <ns element="{name(.)}" prefix="{system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($targetNamespace)}" uri="{$targetNamespace}" system_cache__appinfo:document-uri="{../@system_cache__appinfo:document-uri}"/>
  652. </xsl:otherwise>
  653. </xsl:choose>
  654. </xsl:for-each>
  655. </system_cache__appinfo:vrtfNamespaces>
  656. </xsl:template>
  657. <!--<xsl:function name="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename">
  658. <xsl:param name="template_context"/><!-\- system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type.single_complexType , system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type.single_element -\->
  659. <xsl:param name="parent_type"/>
  660. <xsl:choose>
  661. <xsl:when test="$template_context='system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type.single_element'">
  662. <xsl:value-of select="concat($default_db.instance.xml,'/detect_resource_type/element-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
  663. </xsl:when>
  664. <xsl:when test="$template_context='system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type.single_complexType'">
  665. <xsl:value-of select="concat($default_db.instance.xml,'/detect_resource_type/complexType-',system_cache__appinfo:escape_object_prefix_to_string($parent_type),'.xml')"/>
  666. </xsl:when>
  667. <xsl:otherwise><xsl:message terminate="yes">#767 unknown type $template_context=<xsl:value-of select="$template_context"/></xsl:message></xsl:otherwise>
  668. </xsl:choose>
  669. </xsl:function>
  670. -->
  671. <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:element_complexType">
  672. <xsl:param name="targetNamespace" select="$targetNamespace_DEFAULTS"/>
  673. <system_cache__appinfo:element_complexType>
  674. <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">
  675. <xsl:variable name="get_all_xsd_236" select="."/>
  676. <xsl:comment>
  677. 246:detect_resource_type, przetwarzam schemat:<xsl:value-of select="@system_cache__appinfo:document-uri"/>; $targetNamespace:<xsl:value-of select="$targetNamespace"/>;
  678. @targetNamespace:<xsl:value-of select="schema/@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;</xsl:comment>
  679. <xsl:variable name="schema_node_144" select="."/>
  680. <xsl:for-each select="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!--[ @targetNamespace != $targetNamespace ] namespace::node() = $targetNamespace and @targetNamespace='moj_ogrodek' -->
  681. <xsl:message>239::detect_resource_type przetwarzam schemat:@targetNamespace:<xsl:value-of select="@targetNamespace"/>;</xsl:message>
  682. <xsl:variable name="prefix_83" select="namespace::node()[. = $targetNamespace]/name()"/>
  683. <xsl:variable name="targetNamespace_134" select="@targetNamespace"/>
  684. <xsl:variable name="prefix_134" select="namespace::node()[. = $targetNamespace_134][1]/name()"/><!-- np. test_objects -->
  685. <xsl:if test="not(@targetNamespace) or not($prefix_134) ">
  686. <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>
  687. </xsl:if>
  688. <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">
  689. <xsl:for-each select="(element|complexType)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!-- dla ograniczenia mozna [$prefix_134='test_objects']-->
  690. <xsl:variable name="complexType_or_element_name186">
  691. <xsl:choose>
  692. <xsl:when test="local-name()='element'"><xsl:value-of select="@name"/></xsl:when>
  693. <xsl:when test="local-name()='complexType'"><xsl:value-of select="@name"/></xsl:when>
  694. <xsl:otherwise><xsl:message terminate="yes">#391 it should work only for element or complexType</xsl:message></xsl:otherwise>
  695. </xsl:choose>
  696. </xsl:variable>
  697. <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>
  698. <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>
  699. <xsl:choose>
  700. <xsl:when test="local-name()='element'">
  701. <build_cache name="build_element">
  702. <xsl:attribute name="id.int.rand" select="system_cache__appinfo:id.int.rand(@id)"/>
  703. <xsl:attribute name="system_cache__appinfo:document-uri" select="../.././@system_cache__appinfo:document-uri"/>
  704. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="../.././@system_cache__appinfo:document-uri-full"/>
  705. <xsl:attribute name="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename" select="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename(../.././@system_cache__appinfo:document-uri, .././@targetNamespace,local-name(),@name)"/>
  706. <xsl:attribute name="complexType_or_element_name" select="$complexType_or_element_name186"/>
  707. <xsl:attribute name="p5opr:element-filename" select="p5opr:element-filename(../.././@system_cache__appinfo:document-uri, .././@targetNamespace,local-name(),@name)"/>
  708. <xsl:attribute name="system_cache__appinfo:path" select="concat(../@targetNamespace,'/',$complexType_or_element_name186)"/>
  709. <!--<xsl:attribute name="system_cache__appinfo:element-filename" select="system_cache__appinfo:element-filename()"/>-->
  710. <with-param name="element" select="{$prefix_134}:{$complexType_or_element_name186}"/>
  711. <system_cache__appinfo:element-filename><xsl:value-of select="system_cache__appinfo:element-filename('build_element',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename>
  712. <system_cache__appinfo:element-filename-prefixed><xsl:value-of select="system_cache__appinfo:element-filename-prefixed('build_element',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename-prefixed>
  713. <p5_tr_map:element-filename><xsl:value-of select="p5_tr_map:element-filename('go_recurse_from_root_by_build_element_cache',concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename>
  714. <p5_tr_map:element-filename-prefixed><xsl:value-of select="p5_tr_map:element-filename-prefixed(concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename-prefixed>
  715. <system_cache__appinfo:targetNamespace><xsl:value-of select="../@targetNamespace"/></system_cache__appinfo:targetNamespace>
  716. <system_cache__appinfo:name><xsl:value-of select="@name"/></system_cache__appinfo:name>
  717. <system_cache__appinfo:prefix><xsl:value-of select="$prefix_134"/></system_cache__appinfo:prefix>
  718. <!--<system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename><xsl:value-of select="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename('system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type.single_element',concat($prefix_134,':',$complexType_or_element_name186))"/></system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename>-->
  719. </build_cache>
  720. </xsl:when>
  721. <xsl:when test="local-name()='complexType'">
  722. <build_cache name="build_complexType">
  723. <xsl:attribute name="id.int.rand" select="system_cache__appinfo:id.int.rand(@id)"/>
  724. <xsl:attribute name="system_cache__appinfo:document-uri" select="../.././@system_cache__appinfo:document-uri"/>
  725. <xsl:attribute name="system_cache__appinfo:document-uri-full" select="../.././@system_cache__appinfo:document-uri-full"/>
  726. <xsl:attribute name="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename" select="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename(../.././@system_cache__appinfo:document-uri, .././@targetNamespace,local-name(),@name)"/>
  727. <xsl:attribute name="complexType_or_element_name" select="$complexType_or_element_name186"/>
  728. <xsl:attribute name="p5opr:element-filename" select="p5opr:element-filename(../.././@system_cache__appinfo:document-uri, .././@targetNamespace,local-name(),@name)"/>
  729. <xsl:attribute name="system_cache__appinfo:path" select="concat(../@targetNamespace,'/',$complexType_or_element_name186)"/>
  730. <with-param name="complexType"
  731. select="{$prefix_134}:{$complexType_or_element_name186}"/>
  732. <system_cache__appinfo:element-filename><xsl:value-of select="system_cache__appinfo:element-filename('build_complexType',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename>
  733. <!--<system_cache__appinfo:element-filename-prefixed><xsl:value-of select="system_cache__appinfo:element-filename-prefixed('build_complexType',@name,$prefix_134,$targetNamespace_134)"/></system_cache__appinfo:element-filename-prefixed>-->
  734. <p5_tr_map:element-filename><xsl:value-of select="p5_tr_map:element-filename('go_recurse_from_root_by_build_complexType_cache',concat($prefix_134,':',$complexType_or_element_name186))"/></p5_tr_map:element-filename>
  735. <system_cache__appinfo:targetNamespace><xsl:value-of select="../@targetNamespace"/></system_cache__appinfo:targetNamespace>
  736. <system_cache__appinfo:name><xsl:value-of select="@name"/></system_cache__appinfo:name>
  737. <system_cache__appinfo:prefix><xsl:value-of select="$prefix_134"/></system_cache__appinfo:prefix>
  738. <!--<system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename><xsl:value-of select="system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename('system_cache__resources_tree_generate_xsl_required_occurs_raport:detect_resource_type.single_complexType',concat($prefix_134,':',$complexType_or_element_name186))"/></system_cache__resources_tree_generate_xsl_required_occurs_raport:element-filename>-->
  739. </build_cache>
  740. </xsl:when>
  741. </xsl:choose>
  742. </xsl:for-each>
  743. </xsl:if>
  744. </xsl:for-each>
  745. </xsl:for-each>
  746. </system_cache__appinfo:element_complexType>
  747. </xsl:template>
  748. <!-- do aktualizowania pozycji w schemache-->
  749. <xsl:template name="system_cache__appinfo:position">
  750. <xsl:param name="xml"/>
  751. <xsl:for-each select="$xml/*">
  752. <xsl:if test="name()">
  753. <xsl:element name="{name()}">
  754. <xsl:attribute name="system_cache__appinfo:position" select="position()"/>
  755. <xsl:apply-templates mode="system_cache__appinfo:position" select="@*"/>
  756. <xsl:call-template name="system_cache__appinfo:position">
  757. <xsl:with-param name="xml" select="."/>
  758. </xsl:call-template>
  759. </xsl:element>
  760. </xsl:if>
  761. </xsl:for-each>
  762. </xsl:template>
  763. <xsl:template match="@*" mode="system_cache__appinfo:position">
  764. <xsl:attribute name="{name()}" select="."/>
  765. </xsl:template>
  766. <xsl:template match="text()" mode="system_cache__appinfo:position"/>
  767. <xsl:template match="comment()" mode="system_cache__appinfo:position"/>
  768. </xsl:stylesheet>