get_all_xsd.xsl 63 KB

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