get_all_xsd.xsl 62 KB

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