get_all_xsd.xsl 69 KB

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