a.binder 8 gadi atpakaļ
vecāks
revīzija
c05eff4718

+ 1 - 0
SE/schema/WPS_Functions/build_WPS_Functions.xml

@@ -11,6 +11,7 @@
     <property name="build_properties" location="${basedir}/.build_properties" />
   
     <!-- modules WPS_Functions - to be copied to any module needed -->
+    <property name="public_html" location="${basedir}" />
     <property name="WPS_Functions" location="${basedir}/WPS_Functions"/>
     <property name="WPS_Functions.temp" location="${WPS_Functions}/temp"/>
     <property name="WPS_Functions.childproperties" location="${WPS_Functions}/.build_WPS_Functions.childproperties"/>

+ 1 - 1
SE/schema/WPS_Functions/get_wfs/build_get_wfs.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project xmlns:ogc="http://www.opengis.net/ogc" 
-    basedir="../../." name="example wfs" default="http_first_input">
+    basedir="../../." name="get_wfs" default="http_first_input">
   <description>
     Based on ant-url-action module to ordinary retrieve feature from WMF
     To be called from CRM_PROCES_Tree etc

+ 374 - 20
SE/schema/default_db_xml_cache.public/get_all_xsd.xsl

@@ -14,9 +14,22 @@
     <xsl:param name="cache" select="'refresh'"/>
     <xsl:param name="targetNamespace_DEFAULTS" select="'http://biuro.biall-net.pl/xmlschema_procesy5/default_db'"/>
     
-    <xsl:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
+    <xsl:param name="external_schema" select="'/public_html/external_schema'"/>
+    <xsl:param name="external_schema_id_namespace_prefix" select="'/public_html/external_schema_id_namespace_prefix'"/>
+    <xsl:param name="XMLSchema_prefix" select="'xs'"/><xsl:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
     
-    <xsl:function name="system_cache__appinfo:clean_object_prefix">
+    <xsl:include href="system_cache__appinfo/external_schema_targetNamespace.xsl"/>
+    
+    
+    <xsl:function name="system_cache__appinfo:document-uri_for_external_schema_id_namespace_prefix">
+        <xsl:param name="system_cache__appinfo:document-uri_from_external_schema"/>
+        <xsl:value-of select="substring-after(replace($system_cache__appinfo:document-uri_from_external_schema,$external_schema,$external_schema_id_namespace_prefix  ), '/public_html/') "/>
+    </xsl:function>
+    
+    <xsl:function name="system_cache__appinfo:document-uri-full_for_external_schema_id_namespace_prefix">
+        <xsl:param name="system_cache__appinfo:document-uri_from_external_schema"/>
+        <xsl:value-of select="replace($system_cache__appinfo:document-uri_from_external_schema,$external_schema,$external_schema_id_namespace_prefix  )"/>
+    </xsl:function><xsl:function name="system_cache__appinfo:clean_object_prefix">
         <xsl:param name="name" />
         <xsl:choose>
             <xsl:when test="substring-after($name,':')">
@@ -89,7 +102,7 @@
     <xsl:function name="system_cache__appinfo:prefix_from_targetNamespace">
         <xsl:param name="system_cache__appinfo:vrtfNamespaces" />
         <xsl:param name="targetNamespace" />
-        <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces/ns[@uri=$targetNamespace][1]/@prefix" xpath-default-namespace=""/>
+        <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces//ns[@uri=$targetNamespace][1]/@prefix" xpath-default-namespace=""/>
     </xsl:function>
     <xsl:function name="system_cache__appinfo:targetNamespace_from_prefix">
         <xsl:param name="system_cache__appinfo:vrtfNamespaces" />
@@ -121,7 +134,316 @@
         </xsl:call-template>
     </xsl:template>
     
-    <xsl:template name="system_cache__appinfo:get_all_xsd">
+    <xsl:template match="system_cache__appinfo:get_all_xsd_external_schema" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" >
+                <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
+                <xsl:variable name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix">
+                    <var>
+                        <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/*">
+                            <xsl:element name="{name()}">
+                                <xsl:attribute name="pos" select="position()"/>
+                                <xsl:copy-of select="@*"/>
+                                <xsl:copy-of select="*"/>
+                            </xsl:element>
+                        </xsl:for-each>
+                    </var>
+                </xsl:variable>
+                <system_cache__appinfo:get_all_xsd_external_schema__equals>
+                    <xsl:copy-of select="@*"/>
+                    <xsl:call-template name="system_cache__appinfo:get_all_xsd_external_schema__equals">
+                        <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema" select=".[*]"/>
+                        <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"/>
+                        
+                    </xsl:call-template>
+                    <!--<system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
+                        <xsl:copy-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix"></xsl:copy-of>
+                    </system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>-->
+                </system_cache__appinfo:get_all_xsd_external_schema__equals>
+            </xsl:template>
+    
+            <!--<xsl:template match="schema" mode="system_cache__appinfo:get_all_xsd_external_schema__equals" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
+                <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema__equals">
+                    <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/*"/>
+                </xsl:apply-templates>
+            </xsl:template>-->
+    
+            <xsl:template  name="system_cache__appinfo:get_all_xsd_external_schema__equals" >
+                <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema" required="yes"/>
+                <xsl:param name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" required="yes"/>
+                <!--<pre_external_schema>
+                    <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema/*">
+                        <xsl:element name="{name()}"><xsl:copy-of select="@*"/></xsl:element>
+                    </xsl:for-each>
+                </pre_external_schema>
+                <pre_schema_id_namespace_prefix>
+                    <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*">
+                        <xsl:element name="{name()}"><xsl:copy-of select="@*"/></xsl:element>
+                    </xsl:for-each>
+                </pre_schema_id_namespace_prefix>-->
+                
+                <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema/*">
+                    <xsl:variable name="position" select="position()"/>
+                    <xsl:comment> Try position <xsl:value-of select="$position"/>;</xsl:comment>
+                    
+                        <xsl:choose>
+                            <!--<xsl:when test="not($position = $pos)">
+                                <not_pos>
+                                    <xsl:attribute name="pos" select="$pos"/>
+                                    <xsl:attribute name="position" select="$position"/>
+                                    <xsl:attribute name="expected" select="local-name()"/>
+                                </not_pos>
+                            </xsl:when>-->
+                            <xsl:when test="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/local-name() = local-name()">
+                                <!--<equals>
+                                    <xsl:attribute name="position" select="position()"/>
+                                    <xsl:attribute name="expected" select="local-name()"/>
+                                    <xsl:attribute name="found" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[ @pos = $position]/local-name()"/>
+                                    
+                                    <xsl:attribute name="first_el_par" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var[1]/name()"/>
+                                </equals>-->
+                                <!--<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>-->
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <not_equals>
+                                    <xsl:attribute name="position" select="position()"/>
+                                    <xsl:attribute name="expected" select="local-name()"/>
+                                    <xsl:attribute name="found" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[  @pos = $position]/local-name()"/>
+                                    <xsl:attribute name="found_id" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[  @pos = $position]/@id"/>
+                                    <xsl:attribute name="found_pos" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[  @pos = $position]/@pos"/>
+                                    <xsl:attribute name="first_el_par" select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[1]/name()"/>
+                                </not_equals>
+                            </xsl:otherwise>
+                        </xsl:choose>
+
+                    <!--<child>-->
+                        <xsl:variable name="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix_new">
+                            <var>
+                                <xsl:for-each select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix/var/*[@pos=$position]/*">
+                                    <xsl:element name="{name()}">
+                                        <xsl:attribute name="pos" select="position()"/>
+                                        <xsl:copy-of select="@*"/>
+                                        <xsl:copy-of select="*"/>
+                                    </xsl:element>
+                                </xsl:for-each>
+                            </var>
+                        </xsl:variable>
+                        <!--<test_var_new><xsl:copy-of select="$system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix_new"/></test_var_new>-->
+                            <xsl:call-template name="system_cache__appinfo:get_all_xsd_external_schema__equals">
+                                <xsl:with-param name="system_cache__appinfo:get_all_xsd_external_schema" select=".[*]"/>
+                                <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/.[*]"/>
+                            </xsl:call-template>
+                        <!--</child>-->
+
+                </xsl:for-each>
+            </xsl:template>
+    
+    <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">
+        <xsl:param name="system_cache__appinfo:document-uri" required="yes"/>
+        <xsl:variable name="targetNamespace" select="@targetNamespace"/>
+        <xsl:variable name="namespaces_cur">
+            <namespaces_cur>
+                <xsl:for-each select="namespace::node()">
+                    <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
+                </xsl:for-each>
+            </namespaces_cur>
+        </xsl:variable>
+        
+        
+        <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema" extension-element-prefixes="#default" inherit-namespaces="yes">
+            <xsl:choose>
+                <xsl:when test="@targetNamespace and ( not($namespaces_cur//ns[@uri=$targetNamespace]/@prefix)  or $namespaces_cur//ns[@uri=$targetNamespace]/@prefix='' ) " xpath-default-namespace="">
+                    <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
+                    <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace(@targetNamespace)"/>
+                    <xsl:copy-of select="@targetNamespace"/>
+                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
+                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:comment>#144 when  @targetNamespace exists and prefix not exists</xsl:comment>
+                    <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>
+                    <xsl:comment> count: <xsl:value-of select="count($namespaces_cur/namespaces_cur/ns)"/> </xsl:comment>
+                   <xsl:copy-of select="*"/>
+                </xsl:when>
+                <xsl:when test="@targetNamespace">
+                    <xsl:variable name="detect_prefix" select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix" xpath-default-namespace=""/>
+                    <xsl:namespace name="{$detect_prefix}" select="@targetNamespace"/>
+                    <xsl:copy-of select="@targetNamespace"/>
+                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
+                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:comment>#147 when  @targetNamespace and prefix probably exists!</xsl:comment>
+                    <xsl:copy-of select="*"/>                    
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
+                    <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
+                    <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
+                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
+                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <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>
+                    <xsl:comment>#158 otherwise not @targetNamespace and no prefix</xsl:comment>
+                    <xsl:copy-of select="*"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:element>
+    </xsl:template>
+    
+    
+    <xsl:template match="schema" mode="system_cache__appinfo:get_all_xsd_external_schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="system_cache__appinfo:document-uri" required="yes"/>
+        <xsl:variable name="targetNamespace" select="@targetNamespace"/>
+        <xsl:variable name="namespaces_cur">
+            <namespaces_cur>
+                <xsl:for-each select="namespace::node()">
+                    <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
+                </xsl:for-each>
+            </namespaces_cur>
+        </xsl:variable>
+        
+        
+        <xsl:element name="schema" namespace="http://www.w3.org/2001/XMLSchema" extension-element-prefixes="#default" inherit-namespaces="yes">
+            <xsl:choose>
+                <xsl:when test="@targetNamespace and ( not($namespaces_cur//ns[@uri=$targetNamespace]/@prefix)  or $namespaces_cur//ns[@uri=$targetNamespace]/@prefix='' ) " xpath-default-namespace="">
+                    <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
+                    <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace(@targetNamespace)"/>
+                    <xsl:copy-of select="@targetNamespace"/>
+                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
+                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:comment>#144 when  @targetNamespace exists and prefix not exists</xsl:comment>
+                    <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>
+                    <xsl:comment> count: <xsl:value-of select="count($namespaces_cur/namespaces_cur/ns)"/> </xsl:comment>
+                    <!--<xsl:for-each select="$namespaces_cur/namespaces_cur/ns">
+                        <xsl:comment> ns @element=<xsl:value-of select="@element"/>; @prefix=<xsl:value-of select="@prefix"/>;  @uri=<xsl:value-of select="@uri"/>;</xsl:comment>
+                    </xsl:for-each>-->
+                  <!--  <xs:debug>
+                        <xsl:copy-of select="$namespaces_cur"/>
+                    </xs:debug>
+                    <xs:debug_filter>
+                        <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]"/>
+                    </xs:debug_filter>
+                    <xs:debug_filter_NS>
+                        <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]" xpath-default-namespace=""/>
+                    </xs:debug_filter_NS>-->
+                    <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
+                        <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
+                        <xsl:with-param name="detect_targetNamespace" select="@targetNamespace"/>
+                        <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
+                    </xsl:apply-templates>
+                </xsl:when>
+                <xsl:when test="@targetNamespace">
+                    <xsl:variable name="detect_prefix" select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix" xpath-default-namespace=""/>
+                    <xsl:namespace name="{$detect_prefix}" select="@targetNamespace"/>
+                    <xsl:copy-of select="@targetNamespace"/>
+                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
+                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <xsl:comment>#147 when  @targetNamespace and prefix probably exists!</xsl:comment>
+                    <!--<xsl:copy-of select="*" copy-namespaces="yes"/>-->
+                    <!--<xs:debug_test>
+                        <xsl:value-of select="$namespaces_cur//ns[@uri=$targetNamespace]/@prefix"/>
+                    </xs:debug_test>  
+                    <xs:debug>
+                        <xsl:copy-of select="$namespaces_cur"/>
+                    </xs:debug>
+                    <xs:debug_filter>
+                        <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]"/>
+                    </xs:debug_filter>
+                    <xs:debug_filter_NS>
+                        <xsl:copy-of select="$namespaces_cur//ns[@uri=$targetNamespace]" xpath-default-namespace=""/>
+                    </xs:debug_filter_NS>-->
+                    <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>                    
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:variable name="detect_prefix" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace_prefix($system_cache__appinfo:document-uri)"/>
+                    <xsl:namespace name="{$detect_prefix}" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
+                    <xsl:attribute name="targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
+                    <xsl:attribute name="vc:minVersion" select="'1.0'"/>
+                    <xsl:attribute name="vc:maxVersion" select="'1.1'"/>
+                    <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>
+                    <xsl:comment>#158 otherwise not @targetNamespace and no prefix</xsl:comment>
+                    <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
+                        <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
+                        <xsl:with-param name="detect_targetNamespace" select="system_cache__appinfo:object_install_se_ant_object.detect_external_targetNamespace($system_cache__appinfo:document-uri)"/>
+                        <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
+                    </xsl:apply-templates>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:element>
+    </xsl:template>
+    
+    
+    <xsl:template match="*" mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:element name="{$XMLSchema_prefix}:{local-name()}" namespace="http://www.w3.org/2001/XMLSchema">
+            <xsl:apply-templates select="@*" mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>
+            <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix"/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" match="@type|@base">
+        <!-- sa bledy ze schematami z prefix xsd... -->
+        <xsl:choose>
+            <xsl:when test="contains(.,'xsd:')">
+                <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="{name()}" select="."/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_with_prefix" match="@*">
+        <xsl:attribute name="{name()}" select="."/>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="detect_prefix" required="yes"/>
+        <xsl:param name="detect_targetNamespace" required="yes"/>
+        <xsl:param name="namespaces_cur" required="yes"/>
+        <xsl:element name="{$XMLSchema_prefix}:{local-name()}"  namespace="http://www.w3.org/2001/XMLSchema">
+            <!--<xsl:attribute name="test_prefix" select="system_cache__appinfo:prefix_from_targetNamespace($namespaces_cur,'http://www.w3.org/2001/XMLSchema')"/>-->
+            <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" select="@*">
+                <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
+                <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
+            </xsl:apply-templates>
+            <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace">
+                <xsl:with-param name="detect_prefix" select="$detect_prefix"/>
+                <xsl:with-param name="detect_targetNamespace" select="$detect_targetNamespace"/>
+                <xsl:with-param name="namespaces_cur" select="$namespaces_cur"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    
+    <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@type|@base">
+        <!-- sa bledy ze schematami z prefix xsd... -->
+        <xsl:param name="namespaces_cur" required="yes"/>
+        <xsl:param name="detect_prefix" required="yes"/>
+        <xsl:choose>
+            <!--<xsl:when test="contains(.,'xsd:')">
+                <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
+            </xsl:when>-->
+            <xsl:when test="not(contains(.,':'))">
+                <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
+            </xsl:when>
+            <xsl:when test="system_cache__appinfo:prefix_from_targetNamespace($namespaces_cur,'http://www.w3.org/2001/XMLSchema')=system_cache__appinfo:get_object_prefix(.)">
+                <!--<xsl:message terminate="yes">#281 - wykryte ze jest to type XSD <xsl:value-of select="."/></xsl:message>-->
+                <xsl:attribute name="{name()}" select="concat($XMLSchema_prefix,':', system_cache__appinfo:clean_object_prefix(.))"/>
+            </xsl:when>
+            <xsl:when test="contains(.,':')">
+                <xsl:copy-of select="."/>
+            </xsl:when>
+            <xsl:otherwise>
+                <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>
+                <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@ref">
+        <xsl:param name="namespaces_cur" required="yes"/>
+        <xsl:param name="detect_prefix" required="yes"/>
+        <xsl:attribute name="{name()}" select="concat($detect_prefix,':',.)"/>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__appinfo:get_all_xsd_external_schema_not_targetNamespace" match="@*">
+        <xsl:param name="namespaces_cur" required="yes"/>
+        <xsl:attribute name="{name()}" select="."/>
+    </xsl:template><xsl:template name="system_cache__appinfo:get_all_xsd">
         <xsl:param name="path2collection" select="$procesy5_system_schema_collection_dir"/> 
         <xsl:param name="get_system_schemas"/>
         <xsl:param name="cache" select="$cache"/>
@@ -139,7 +461,49 @@
                   <system_cache__appinfo:get_all_xsd_list>
                     <xsl:for-each select="$docs">
                         <xsl:message> get_all_xsd przetwarzam plik <xsl:value-of select="document-uri(/)"/></xsl:message>
-                        <system_cache__appinfo:get_all_xsd>
+                        <xsl:choose>
+                            <xsl:when test=" contains(document-uri(/), concat($external_schema,'/'))">
+                                <xsl:comment>#145 Ignored /public_html/external_schema <xsl:value-of select="document-uri(/)"/></xsl:comment>
+                                <system_cache__appinfo:get_all_xsd_external_schema>
+                                    <xsl:attribute name="system_cache__appinfo:document-uri" select="system_cache__appinfo:document-uri_for_external_schema_id_namespace_prefix(document-uri(/))"/>
+                                    <xsl:attribute name="system_cache__appinfo:document-uri-full" select="system_cache__appinfo:document-uri-full_for_external_schema_id_namespace_prefix(document-uri(/))"/>
+                                    <xsl:attribute name="system_cache__appinfo:document-uri-orig" select="substring-after(document-uri(/), $external_schema)"/>
+                                    <!--<xsl:attribute name="system_cache__appinfo:document-uri-full-orig" select="document-uri(/)"/>-->
+                                    <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                                                    <xsl:element name="{name()}">
+                                                        <xsl:for-each select="@*">
+                                                            <xsl:attribute name="{name()}" select="."/>
+                                                            <xsl:copy-of select="child::node()"/>
+                                                        </xsl:for-each>
+                                                    </xsl:element>
+                                                </xsl:for-each>-->
+                                    <!--<xsl:copy-of select="/"/>-->
+                                    <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema" select=".">
+                                        <xsl:with-param name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
+                                    </xsl:apply-templates>
+                                </system_cache__appinfo:get_all_xsd_external_schema>
+                            </xsl:when>
+                            <xsl:when test=" contains(document-uri(/), concat($external_schema_id_namespace_prefix,'/'))">
+                                <xsl:comment>#248 Ignored /public_html/external_schema_id_namespace_prefix <xsl:value-of select="document-uri(/)"/></xsl:comment>
+                                <system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
+                                    <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
+                                    <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
+                                    <xsl:attribute name="system_cache__appinfo:document-uri-orig" select="substring-after(document-uri(/), $external_schema_id_namespace_prefix)"/>
+                                    <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                                                    <xsl:element name="{name()}">
+                                                        <xsl:for-each select="@*">
+                                                            <xsl:attribute name="{name()}" select="."/>
+                                                            <xsl:copy-of select="child::node()"/>
+                                                        </xsl:for-each>
+                                                    </xsl:element>
+                                                </xsl:for-each>-->
+                                    <!--<xsl:copy-of select="/"/>-->
+                                    <xsl:apply-templates mode="system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix" select=".">
+                                        <xsl:with-param name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
+                                    </xsl:apply-templates>
+                                </system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix>
+                            </xsl:when>
+                            <xsl:otherwise><system_cache__appinfo:get_all_xsd>
                             <xsl:attribute name="system_cache__appinfo:document-uri" select="substring-after(document-uri(/), '/public_html/')"/>
                             <xsl:attribute name="system_cache__appinfo:document-uri-full" select="document-uri(/)"/>
                             <!--<xsl:for-each select="//schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
@@ -152,7 +516,8 @@
                                             </xsl:for-each>-->
                             <xsl:copy-of select="/"/>
                         </system_cache__appinfo:get_all_xsd>
-                    </xsl:for-each>
+                    </xsl:otherwise>
+                        </xsl:choose></xsl:for-each>
                     <!-- -->
                       <xsl:message> schemat dla XML primitives  <xsl:value-of select="'http://www.w3.org/1999/XSL/Transform'"/></xsl:message>
                       <system_cache__appinfo:get_all_xsd>
@@ -186,24 +551,13 @@
         </xsl:choose>          
     </xsl:template>
     
-    <xsl:template name="system_cache__appinfo:vrtfNamespaces">
-        <xsl:variable name="procesy5_system_schema">
-            <xsl:call-template name="system_cache__appinfo:get_all_xsd">
-                <xsl:with-param name="path2collection" select="$procesy5_system_schema_collection_dir"/>
-                <xsl:with-param name="cache" select="'read'"/>
-            </xsl:call-template>
-        </xsl:variable>
-        <xsl:for-each select="$procesy5_system_schema//schema/namespace::node()"
-            xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
-            <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
-        </xsl:for-each>
-    </xsl:template>
+    
     
     <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:vrtfNamespaces">
         <system_cache__appinfo:vrtfNamespaces>
-            <xsl:for-each select="//schema/namespace::node()"
+            <xsl:for-each select="//(system_cache__appinfo:get_all_xsd|system_cache__appinfo:get_all_xsd_external_schema_id_namespace_prefix)/schema/namespace::node()"
                 xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
-                <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
+                <ns element="{name(..)}" prefix="{name()}" uri="{.}" system_cache__appinfo:document-uri="{../@system_cache__appinfo:document-uri}"/>
             </xsl:for-each>
         </system_cache__appinfo:vrtfNamespaces>
     </xsl:template>