Przeglądaj źródła

merge ze xmlschema

a.binder 9 lat temu
rodzic
commit
7531c59a39

+ 0 - 7
SE/schema/default_db_xml_cache.public/build_recurse_ant_loop_path_maintain.xsl

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    exclude-result-prefixes="xs"
-    version="2.0">
-    
-</xsl:stylesheet>

+ 0 - 79
SE/schema/default_db_xml_cache.public/build_recurse_ant_merge_dita_from_temp_old.xsl

@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    xmlns:xlink="http://www.w3.org/1999/xlink"
-    xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
-    xmlns:wfs="http://www.opengis.net/wfs"
-    exclude-result-prefixes="xs"
-    version="2.0">
-    
-    
-    <xsl:output indent="yes" />
-    <xsl:strip-space elements="*"/>
-    
-    <xsl:param name="uuid" required="yes"/>
-    <xsl:param name="basedir" required="yes"/>
-    
-    <!-- template do zlaczenia wszystkich xmli z danymi z dita 
-    description="z plikow temp/$uuid.* buduje $out_task.dita " -->
-    
-    
-    <xsl:template match="RelatedFeature">
-        <!-- podstawamy dane z xml na podstawie path -->
-        <xsl:param name="loop_xpath" select="'root'"/>
-        <xsl:variable name="RelatedFeaturePos" select="position()"/>
-        <xsl:variable name="featureID_name" select="substring-after(@typeName,':')"/>
-        <xsl:variable name="xml_id" select="@xml_id"/>
-        <xsl:variable name="loop_xpath" select="concat($loop_xpath,'_x2f_.',$xml_id,'.',$featureID_name)"/>
-
-        <xsl:message>#26 odpalam loop_xpath=<xsl:value-of select="$loop_xpath"/>.dita.xml.vals.dita;</xsl:message>
-        <!--<debug26>
-            Will try to put file=<xsl:value-of select="concat($uuid,'.',$loop_xpath,$featureID_name,'.',$RelatedFeaturePos,'.dita.xml.vals.dita')"/>;
-        </debug26>-->
-        <xsl:variable name="dita_fragment" select="doc(concat($basedir,'/temp/',$uuid,'.',$loop_xpath,'.',$RelatedFeaturePos,'.dita.xml.vals.dita'))"/>
-        
-        <xsl:apply-templates mode="RelatedFeature" select="$dita_fragment/RelatedFeatureRoot/*">
-            <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-        </xsl:apply-templates>
-    </xsl:template>
-    
-    <xsl:template mode="RelatedFeature" match="RelatedFeature">
-        <xsl:param name="loop_xpath" required="yes"/>
-        <xsl:apply-templates select=".">
-            <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-        </xsl:apply-templates>
-    </xsl:template>
-    
-    <xsl:template mode="RelatedFeature" match="*">
-        <xsl:param name="loop_xpath" required="yes"/>
-        <xsl:element name="{name()}">
-            <!--<xsl:copy-of select="@*"/>-->
-            <xsl:apply-templates select="@*"/>
-            <xsl:apply-templates mode="RelatedFeature">
-                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-            </xsl:apply-templates>
-        </xsl:element>
-    </xsl:template>
-    
-    
-  
-    
-    <xsl:template match="*">
-        <xsl:param name="loop_xpath"/>
-        <xsl:element name="{name()}">
-            <xsl:copy-of select="@*"/>
-            <xsl:apply-templates>
-                <xsl:with-param name="loop_xpath" select="$loop_xpath"/>
-            </xsl:apply-templates>
-        </xsl:element>
-    </xsl:template>
-    
-    
-    <xsl:template match="@*">
-        <xsl:copy-of select="."/>
-    </xsl:template>
-    <xsl:template match="@xml_id"/>
-        
-    
-    
-</xsl:stylesheet>

+ 0 - 25
SE/schema/default_db_xml_cache.public/crm_testy_pytania.xsd

@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    xmlns:default_crm_testy_pytania="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/crm_testy_pytania.xsd"
-    elementFormDefault="qualified"
-    targetNamespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/crm_testy_pytania.xsd"
-    xmlns:default_crm_proces="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/crm_proces.xsd">
-    <xs:import
-        namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/crm_proces.xsd"
-        schemaLocation="../default_db_xml_cache/crm_proces.xsd"
-        id="default_crm_testy_pytania___d16e3"/>
-    <xs:import
-        namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/crm_wskaznik.xsd"
-        schemaLocation="crm_wskaznik.xsd" id="default_crm_testy_pytania___d16e7"/>
-    <xs:complexType name="crm_test_question_object" id="default_crm_testy_pytania___d16e9">
-        <xs:sequence id="default_crm_testy_pytania___d16e11">
-            <xs:element name="idref" id="default_crm_testy_pytania___d16e13"/>
-            <xs:sequence id="default_crm_testy_pytania___d16e15">
-                <xs:element name="id" id="default_crm_testy_pytania___d16e17"/>
-                <xs:choice id="default_crm_testy_pytania___d16e19">
-                    <xs:element name="id_proces" id="default_crm_testy_pytania___d16e21"/>
-                </xs:choice>
-            </xs:sequence>
-        </xs:sequence>
-    </xs:complexType>
-</xs:schema>

+ 0 - 23
SE/schema/default_db_xml_cache.public/crm_wskaznik.xsd

@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    xmlns:default_crm_wskaznik="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/crm_wskaznik.xsd"
-    xmlns:system_cache__procesy5_xsd_business_objects="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/procesy5_xsd_business_objects.xsd"
-    elementFormDefault="qualified"
-    targetNamespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/crm_wskaznik.xsd"
-    attributeFormDefault="qualified" vc:minVersion="1.1"
-    xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
-    <xs:import
-        namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/procesy5_xsd_business_objects.xsd"
-        schemaLocation="../default_db_xml_cache/procesy5_xsd_business_objects.xsd"
-        id="default_crm_wskaznik___d18e3"/>
-    <xs:complexType name="asocjacja" id="default_crm_wskaznik___d18e7">
-        <xs:choice id="default_crm_wskaznik___d18e9">
-            <xs:element name="idref" type="xs:IDREF" id="default_crm_wskaznik___d18e11"/>
-            <xs:sequence id="default_crm_wskaznik___d18e13">
-                <xs:element name="resource"
-                    type="system_cache__procesy5_xsd_business_objects:procesy5_busines_object"
-                    id="default_crm_wskaznik___d18e15"/>
-            </xs:sequence>
-        </xs:choice>
-    </xs:complexType>
-</xs:schema>

+ 6 - 0
SE/schema/default_db_xml_cache.public/object_modeling_new.xsl

@@ -16,6 +16,7 @@
     <xsl:param name="template_object.xml_location" required="yes"/> <!-- <xsl:variable name="template_object.xml_location" select="concat($object_modeling_new_repository,'/',$NamespaceDatabaseStorageDefinitionPrefix,'/',$NamespaceObjectInstanceType,'/',$NamespaceObjectInstanceTable,'.xml')"/> -->
     <xsl:param name="object_modeling_new_basedir_repository" required="yes"/> <!-- location where is template modified objects repository for debug only -->
     
+    
     <!--<xsl:param name="prototype_object_namespace" select="'https://biuro.biall-net.pl/wfs/default_db/Types/Default.xsd'"/>--> <!-- for default prototype object set in child xsl -->
     
     <xsl:variable name="TargetNamespace_from_Bindings">
@@ -94,6 +95,11 @@
     </xsl:template>
     
     
+    
+    
+    
+    
+    
     <xsl:template mode="system_cache__appinfo:object_modeling_new_add" match="schema[@targetNamespace=$prototype_object_namespace]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
         <xsl:result-document href="{$template_object.xml_location}">
         <xsl:element name="xs:schema">

+ 168 - 0
SE/schema/default_db_xml_cache.public/object_modeling_new_by_xml_schema.xsl

@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    
+    <xsl:include href="object_modeling_new.xsl"/>
+    <!--<xsl:param name="new_object_namespace" required="yes"/>--> <!-- example https://biuro.biall-net.pl/wfs/default_db/table/CRM_PROCES.xsd -->
+   
+    <xsl:param name="default_db.xml" required="yes"/>
+    
+    
+    
+    
+    
+    <!-- based on object_modeling_new.xsl for use with  system_cache__appinfo:object_modeling_new_by_xml_schema in build_object_modelling_new.xml - to generate merged object from default_db.xml and prototype from Type -->
+    
+    
+    
+    
+    
+    <xsl:template mode="system_cache__appinfo:object_modeling_new_add_xml_schema" match="schema|text()|comment()"/>
+    
+    
+    
+    <xsl:template match="system_cache__appinfo:get_all_xsd"  mode="system_cache__appinfo:object_modeling_new_by_xml_schema">
+        <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_test_if_exists"/>
+    </xsl:template>
+    
+    <xsl:template match="system_cache__appinfo:get_all_xsd_list"  mode="system_cache__appinfo:object_modeling_new_by_xml_schema">
+        <system_cache__appinfo:object_modeling_new_by_xml_schema>
+            <xsl:attribute name="object_modeling_new_basedir_repository" select="$object_modeling_new_basedir_repository"/>
+            <xsl:copy-of select="$TargetNamespace_from_Bindings"/>
+            <new_TargetNamespaceBindings_from_Namespace>
+                <xsl:copy-of select="$new_TargetNamespaceBindings_from_Namespace"></xsl:copy-of>
+            </new_TargetNamespaceBindings_from_Namespace>
+            <xsl:variable name="system_cache__appinfo:object_modeling_new_test_if_exists">
+                <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_test_if_exists"/>
+            </xsl:variable>
+            <xsl:choose>
+                <xsl:when test="$system_cache__appinfo:object_modeling_new_test_if_exists/*">
+                    <ERROR>
+                        Object already defined in current schema
+                    </ERROR>
+                </xsl:when>
+                <xsl:otherwise>
+                    <OK>
+                        We try to create new object in <xsl:value-of select="$template_object.xml_location"/>
+                    </OK>
+                    <xsl:variable name="system_cache__appinfo:new_object_by_prototype_test_if_prototype">
+                        <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_test_if_prototype"/>
+                    </xsl:variable>
+                    <xsl:choose>
+                        <xsl:when test="$system_cache__appinfo:new_object_by_prototype_test_if_prototype/*">
+                            <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_add_xml_schema"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <!--<xsl:message terminate="yes">#84 prototype <xsl:value-of select="$prototype_object_namespace"/> not exists in schema! if it realy exist consider rebuild procesy5_system_schema.xml !</xsl:message>-->
+                            <system_cache__appinfo:new_object_by_prototype_test_if_prototype>
+                                <xsl:copy-of select="$system_cache__appinfo:new_object_by_prototype_test_if_prototype"></xsl:copy-of>
+                            </system_cache__appinfo:new_object_by_prototype_test_if_prototype>
+                            <ERROR>Not exists prototype $prototype_object_namespace=<xsl:value-of select="$prototype_object_namespace"/>;</ERROR>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:otherwise>
+            </xsl:choose>
+        </system_cache__appinfo:object_modeling_new_by_xml_schema>
+    </xsl:template>
+    
+    
+    <xsl:template mode="system_cache__appinfo:object_modeling_new_add_xml_schema" match="schema[@targetNamespace=$prototype_object_namespace]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:result-document href="{$template_object.xml_location}">
+            <xsl:element name="xs:schema">
+                <xsl:copy-of select="namespace::node()"/>
+                <xsl:namespace name="{$new_TargetNamespaceBindings_from_Namespace//@NamespacePrefix}" select="$TargetNamespace_from_Bindings//@TargetNamespace"/>
+                <xsl:attribute name="targetNamespace" select="$TargetNamespace_from_Bindings//@TargetNamespace"/>
+                <xsl:variable name="prototype_NamespacePrefix">
+                    <xsl:for-each select="namespace::node()">
+                        <xsl:if test=".= $prototype_object_namespace">
+                            <xsl:value-of select="name()"/>
+                        </xsl:if>
+                    </xsl:for-each>
+                </xsl:variable>
+                
+                <!-- read object from default_db.xml -->
+                
+                <xsl:variable name="merge_complexType" select="doc($default_db.xml)//complexType[@name=$NamespaceObjectInstanceTable]/sequence" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                <xsl:variable name="schema_merged">
+                    <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_add_xml_schema_root">
+                        <xsl:with-param name="merge_complexType" select="$merge_complexType"/>
+                    </xsl:apply-templates>
+                </xsl:variable>
+                <xsl:message>#93 default_db.xml object found <xsl:copy-of select="$default_db.xml"/></xsl:message>
+                
+                <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_root" select="$schema_merged" >
+                    <xsl:with-param name="prototype_TargetNamespaceBindings_from_Namespace" select="$prototype_TargetNamespaceBindings_from_Namespace"/>
+                    <xsl:with-param name="new_TargetNamespaceBindings_from_Namespace" select="$new_TargetNamespaceBindings_from_Namespace"/>
+                    <xsl:with-param name="prototype_NamespacePrefix" select="$prototype_NamespacePrefix"/>
+                </xsl:apply-templates>
+            </xsl:element>
+        </xsl:result-document>
+    </xsl:template>
+    
+    
+    <xsl:template mode="system_cache__appinfo:object_modeling_new_add_xml_schema_root" match="complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="merge_complexType" required="yes"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_add_xml_schema_child">
+                <xsl:with-param name="merge_complexType" select="$merge_complexType"/>
+            </xsl:apply-templates>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__appinfo:object_modeling_new_add_xml_schema_root" match="*" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template mode="system_cache__appinfo:object_modeling_new_add_xml_schema_child" match="sequence" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="merge_complexType" required="yes"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <!--<xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_add_xml_schema_child">
+                <xsl:with-param name="merge_complexType" select="$merge_complexType/sequence"/>
+            </xsl:apply-templates>-->
+            <xsl:for-each select="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                <xsl:element name="{name()}">
+                    <xsl:copy-of select="@*"/>
+                </xsl:element>
+            </xsl:for-each>
+            <xsl:variable name="current" select="element"/>
+            <xsl:for-each select="$merge_complexType/element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                <xsl:choose>
+                    <xsl:when test="$current[@name = current()/@name]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+                        <xsl:message>#140 element <xsl:value-of select="@name"/> already exists!</xsl:message>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:element name="{name()}">
+                            <xsl:attribute name="name" select="@name"/>
+                            <xsl:attribute name="type" select="$merge_complexType/ancestor::node()/simpleType[@name= substring-after(current()/@type,':')]/restriction/@base" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
+                        </xsl:element>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:for-each>
+        </xsl:element>
+    </xsl:template>
+    
+    <!--<xsl:template mode="system_cache__appinfo:object_modeling_new_add_xml_schema_child" match="element" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
+        <xsl:param name="merge_complexType" required="yes"/>
+        <xsl:element name="{name()}">
+            <xsl:copy-of select="@*"/>
+            <xsl:for-each select=".">
+                <xsl:element name="{name()}">
+                    <xsl:copy-of select="@*"/>
+                </xsl:element>
+            </xsl:for-each>
+            
+            
+        </xsl:element>
+    </xsl:template>-->
+    
+    
+</xsl:stylesheet>