| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <?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="get_all_xsd.xsl"/>-->
- <!--<xsl:param name="procesy5_system_schema_file" select="'../default_db.instance.xml/transformed/procesy5_system_schema.xml'"/>-->
- <xsl:include href="system_cache__appinfo/TargetNamespaceBindings.xsl"/>
- <!--<xsl:include href="get_all_xsd.xsl"/>--> <!-- for use system_cache__appinfo:escape_object_prefix_to_string -->
-
- <xsl:param name="prototype_object_namespace" select="'https://biuro.biall-net.pl/wfs/default_db/Types/Infrastructure.xsd'"/>
- <xsl:param name="new_object_namespace"/> <!-- example https://biuro.biall-net.pl/wfs/default_db/table/CRM_PROCES.xsd -->
- <!--<xsl:param name="procesy5_system_schema_collection_dir" select="'../../'"/>--> <!-- should be like /Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html -->
-
-
-
- <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:new_object_by_prototype">
- <xsl:choose>
- <xsl:when test="$prototype_object_namespace and $new_object_namespace">
- <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:new_object_by_prototype"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message terminate="yes">#32 prototype <xsl:value-of select="$prototype_object_namespace"/> not exists in schema ! if it realy exiss consider rebuild procesy5_system_schema.xml !</xsl:message>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:when>
- <xsl:otherwise><xsl:message terminate="yes">#25 not set required $prototype_object_namespace and $new_object_namespace params!</xsl:message></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template mode="system_cache__appinfo:new_object_by_prototype" match="system_cache__appinfo:get_all_xsd">
- <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype"/>
- </xsl:template>
-
-
- <xsl:template mode="system_cache__appinfo:new_object_by_prototype_test_if_prototype" match="system_cache__appinfo:get_all_xsd">
- <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_test_if_prototype"/>
- </xsl:template>
- <xsl:template mode="system_cache__appinfo:new_object_by_prototype_test_if_prototype" match="schema[@targetNamespace=$prototype_object_namespace]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <system_cache__appinfo:new_object_by_prototype_test_if_prototype>exists_flag</system_cache__appinfo:new_object_by_prototype_test_if_prototype>
- </xsl:template>
-
- <xsl:template mode="system_cache__appinfo:new_object_by_prototype_test_if_prototype" match="*|text()|comment()"/>
-
-
-
-
- <xsl:template mode="system_cache__appinfo:new_object_by_prototype" match="schema[@targetNamespace=$prototype_object_namespace]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <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="$new_object_namespace"/>
- </xsl:call-template>
- </xsl:variable>
- <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>
- <system_cache__appinfo:new_object_by_prototype>
- <xsl:attribute name="prototype_object_namespace" select="$prototype_object_namespace"/>
- <xsl:attribute name="new_object_namespace" select="$new_object_namespace"/>
- <xsl:attribute name="generating_schema_file_to" select="concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd')"/>
- <prototype_TargetNamespaceBindings_from_Namespace>
- <xsl:copy-of select="$prototype_TargetNamespaceBindings_from_Namespace"/>
- </prototype_TargetNamespaceBindings_from_Namespace>
- <new_TargetNamespaceBindings_from_Namespace>
- <xsl:copy-of select="$new_TargetNamespaceBindings_from_Namespace"/>
- </new_TargetNamespaceBindings_from_Namespace>
- <prototype_NamespacePrefix>
- <xsl:copy-of select="$prototype_NamespacePrefix"/>
- </prototype_NamespacePrefix>
- <xsl:choose>
- <xsl:when test=" doc-available(concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd'))">
- <ERROR>
- <xsl:attribute name="message" select="'document already generated and aviable'"/>
- OUTPUT__START
- document already generated and aviable
- OUTPUT__END
- </ERROR>
- </xsl:when>
- <xsl:otherwise>
- <xsl:result-document href="{ concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd')}">
- <!--<xsl:attribute name="href" select=" concat($procesy5_system_schema_collection_dir,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceType,'/',$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'.xsd')"/>-->
- <xsl:element name="xs:schema">
- <xsl:copy-of select="namespace::node()"/>
- <xsl:namespace name="{$new_TargetNamespaceBindings_from_Namespace//@NamespacePrefix}" select="$new_object_namespace"/>
- <xsl:attribute name="targetNamespace" select="$new_object_namespace"/>
- <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:otherwise>
- </xsl:choose>
- </system_cache__appinfo:new_object_by_prototype>
- </xsl:template>
-
-
- <xsl:template mode="system_cache__appinfo:new_object_by_prototype_schema_root" match="import" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:copy-of select="."/>
- </xsl:template>
-
-
-
- <xsl:template mode="system_cache__appinfo:new_object_by_prototype_schema_root" match="element|complexType|simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="prototype_NamespacePrefix" required="yes"/>
- <xsl:element name="{name()}">
- <xsl:apply-templates select="@*" 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:attribute name="id" select="concat(substring($new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,0,8),'_', substring(replace(@name,$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable),0,5),'_',generate-id())"/>-->
- <!--<xsl:attribute name="name" select=" replace(@name,$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,'InfrastructureAAAA')"/>-->
- <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_child">
- <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:template>
-
- <xsl:template match="sequence|choice|all" mode="system_cache__appinfo:new_object_by_prototype_schema_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="prototype_NamespacePrefix" required="yes"/>
- <xsl:element name="{name()}">
- <!--<xsl:attribute name="id" select="concat(substring($new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,0,15),'_',generate-id())"/>-->
- <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_child">
- <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:template>
-
- <xsl:template match="element|complexContent|restriction|enumeration|minInclusive" mode="system_cache__appinfo:new_object_by_prototype_schema_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="prototype_NamespacePrefix" required="yes"/>
- <xsl:element name="{name()}">
- <xsl:copy-of select="@minOccurs"/>
- <xsl:copy-of select="@maxOccurs"/>
- <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_child" select="@*">
- <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:with-param name="node" select="."/>
- </xsl:apply-templates>
- <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_child">
- <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:template>
-
- <xsl:template match="annotation|appinfo|documentation" mode="system_cache__appinfo:new_object_by_prototype_schema_child" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:element name="{name()}">
- <xsl:copy-of select="@*"/>
- <xsl:copy-of select="text()"/>
- <xsl:copy-of select="system_cache__appinfo:base_type"/>
- <xsl:apply-templates mode="system_cache__appinfo:new_object_by_prototype_schema_child"/>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="system_cache__appinfo:flat_relation_cache" mode="system_cache__appinfo:new_object_by_prototype_schema_child">
- <xsl:copy-of select="."/>
- </xsl:template>
-
- <xsl:template match="@ref" mode="system_cache__appinfo:new_object_by_prototype_schema_child">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="prototype_NamespacePrefix" required="yes"/>
- <xsl:attribute name="{ name()}" select=" replace(.,$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable)"/>
- </xsl:template>
-
- <xsl:template match="@base|@type" mode="system_cache__appinfo:new_object_by_prototype_schema_child">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="prototype_NamespacePrefix" required="yes"/>
- <!--<xsl:attribute name="{name()}" select=" concat($prototype_NamespacePrefix,':', substring-after(.,':'),'__to__',concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable, ':', replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable )) )"/>-->
- <xsl:attribute name="{ name()}" select=" replace(., concat($prototype_NamespacePrefix,':', substring-after(.,':')), concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,':', replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable ) ) )"/>
- </xsl:template>
-
- <xsl:template match="@*" mode="system_cache__appinfo:new_object_by_prototype_schema_child">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:attribute name="{ name()}" select="."/>
- </xsl:template>
-
- <xsl:template match="@id" mode="system_cache__appinfo:new_object_by_prototype_schema_child">
- <!-- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="node" required="yes"/>
- <xsl:attribute name="{ name()}" select="concat(substring($new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,0,15),'_',generate-id($node))"/>-->
- </xsl:template>
-
- <xsl:template match="@id" mode="system_cache__appinfo:new_object_by_prototype_schema_root"/>
- <xsl:template match="@name" mode="system_cache__appinfo:new_object_by_prototype_schema_root">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:attribute name="{ name()}" select=" replace(.,$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable)"/>
- </xsl:template>
-
- <xsl:template match="@type" mode="system_cache__appinfo:new_object_by_prototype_schema_root">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="prototype_NamespacePrefix" required="yes"/>
- <!--<xsl:attribute name="{name()}" select=" concat($prototype_NamespacePrefix,':', substring-after(.,':'),'__to__',concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable, ':', replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable )) )"/>-->
- <xsl:attribute name="{ name()}" select=" replace(., concat($prototype_NamespacePrefix,':', substring-after(.,':')), concat($new_TargetNamespaceBindings_from_Namespace//@NamespaceDatabaseStorageDefinitionPrefix ,'__x3A__', $new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,':', replace( substring-after(.,':'),$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable ) ) )"/>
- </xsl:template>
-
- <!--<xsl:template match="@type" mode="system_cache__appinfo:new_object_by_prototype_schema_root">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="prototype_NamespacePrefix" required="yes"/>
- <xsl:attribute name="{ name()}" select=" replace(.,$prototype_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable,$new_TargetNamespaceBindings_from_Namespace//@NamespaceObjectInstanceTable)"/>
- </xsl:template>-->
-
- <xsl:template match="@*" mode="system_cache__appinfo:new_object_by_prototype_schema_root">
- <xsl:param name="prototype_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:param name="new_TargetNamespaceBindings_from_Namespace" required="yes"/>
- <xsl:attribute name="{name()}" select="."/>
- </xsl:template>
-
- <xsl:template match="@abstract" mode="system_cache__appinfo:new_object_by_prototype_schema_root"/>
-
- <xsl:template match=" text()|comment()" mode="system_cache__appinfo:new_object_by_prototype_schema_child"/>
-
- <xsl:template match=" text()|comment()" mode="system_cache__appinfo:new_object_by_prototype_schema_root"/>
-
- <xsl:template mode="system_cache__appinfo:new_object_by_prototype" match="*|text()|comment()"/>
-
-
-
-
-
-
- </xsl:stylesheet>
|