| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?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:include href="system_cache__appinfo/TargetNamespaceBindings.xsl"/>-->
- <xsl:include href="object_modeling.xsl"/> <!-- to use one time system_cache__appinfo:new_object_by_prototype_schema_root -->
- <!--<xsl:param name="new_object_namespace" required="yes"/>--> <!-- example https://biuro.biall-net.pl/wfs/default_db/table/CRM_PROCES.xsd -->
- <xsl:param name="TargetNamespaceBindingsApi" required="yes"/> <!-- example https://biuro.biall-net.pl/wfs -->
- <xsl:param name="NamespaceDatabaseStorageDefinitionPrefix" select="'default_db'"/> <!-- example default_db -->
- <xsl:param name="NamespaceObjectInstanceType" select="'table'"/> <!-- example table -->
- <xsl:param name="NamespaceObjectInstanceTable" required="yes"/> <!-- example CRM_PROCES -->
- <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">
- <xsl:call-template name="system_cache__appinfo:TargetNamespace_from_Bindings">
- <xsl:with-param name="NamespaceDatabaseStorageDefinitionPrefix" select="$NamespaceDatabaseStorageDefinitionPrefix"/>
- <xsl:with-param name="NamespaceObjectInstanceTable" select="$NamespaceObjectInstanceTable"/>
- <xsl:with-param name="TargetNamespaceBindingsApi" select="$TargetNamespaceBindingsApi"/>
- <xsl:with-param name="NamespaceObjectInstanceType" select="$NamespaceObjectInstanceType"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:variable name="prototype_TargetNamespaceBindings_from_Namespace">
- <xsl:call-template name="system_cache__appinfo:TargetNamespaceBindings_from_Namespace">
- <xsl:with-param name="TargetNamespace" select="$prototype_object_namespace"/>
- </xsl:call-template>
- </xsl:variable>
-
-
-
- <xsl:variable name="new_TargetNamespaceBindings_from_Namespace">
- <xsl:call-template name="system_cache__appinfo:TargetNamespaceBindings_from_Namespace">
- <xsl:with-param name="TargetNamespace" select="$TargetNamespace_from_Bindings//@TargetNamespace"/>
- </xsl:call-template>
- </xsl:variable>
-
-
-
- <xsl:variable name="template_object.xml">
- <xsl:choose>
- <xsl:when test=" doc-available( $template_object.xml_location)">
- <xsl:copy-of select=" doc($template_object.xml_location)"></xsl:copy-of>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
-
- <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:object_modeling_new">
- <system_cache__appinfo:object_modeling_new>
- <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"/>
- </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>
- </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">
- <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>
- <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_root">
- <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" match="schema|text()|comment()"/>
-
-
-
- <xsl:template match="system_cache__appinfo:get_all_xsd" mode="system_cache__appinfo:object_modeling_new">
- <xsl:apply-templates mode="system_cache__appinfo:object_modeling_new_test_if_exists"/>
- </xsl:template>
-
- <xsl:template mode="system_cache__appinfo:object_modeling_new_test_if_exists" match="schema[@targetNamespace=$TargetNamespace_from_Bindings]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <!-- not good - we have some objects already in this schema -->
- <xsl:copy-of select="."/>
- </xsl:template>
-
- <xsl:template mode="system_cache__appinfo:object_modeling_new_test_if_exists" match="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
-
-
-
-
-
-
-
- </xsl:stylesheet>
|