get_all_xsd.xsl 70 KB

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