| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <?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:vc="http://www.w3.org/2007/XMLSchema-versioning"
- exclude-result-prefixes="vc"
- version="2.0"
- xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
- xmlns:system_cache__appinfo_schema_maintain="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/system_cache__appinfo_schema_maintain.xsd"
- xmlns:system_cache__resources_tree_generate_xsl_required_occurs_raport="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/resources_tree_generate_xsl_require_occurs_raport"
-
- xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
-
- <!-- @2017-02 bindera: templaty do weryfikacji poprawnosci bazy danych ze schematami - to weryfikacji przydatnosci -->
-
-
- <xsl:import href="resources_tree_generate_xsl_require_occurs_raport.xsl"/>
- <xsl:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
-
-
- <xsl:template name="main">
- <xsl:variable name="element_to_verify_schema_base">
- <xs:sequence>
- <xs:sequence minOccurs="0">
- <xs:element minOccurs="0" name="a1"/>
- </xs:sequence>
- <xs:sequence/>
- <xs:element minOccurs="0" name="a"/>
- <xs:sequence>
- <xs:element name="aa"/>
- <xs:element name="aab"/>
- </xs:sequence>
- <xs:element minOccurs="0" name="b"/>
- </xs:sequence>
- </xsl:variable>
- <xsl:variable name="element_to_verify_schema_restr">
- <xs:sequence>
- <xs:sequence>
- <xs:element name="aa"/>
- <xs:element name="aab"/>
- </xs:sequence>
- <xs:element name="b"/>
- </xs:sequence>
- </xsl:variable>
- <xsl:variable name="analized_base">
- <xsl:apply-templates select="$element_to_verify_schema_base" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do"/>
- </xsl:variable>
- <xsl:result-document href="../default_db.instance.xml/schema_maintain_temp/element_to_verify_schema_base_1.xml">
- <system_cache__appinfo_schema_maintain:schema_restriction_validate>
- <xsl:copy-of select="$analized_base"/>
- </system_cache__appinfo_schema_maintain:schema_restriction_validate>
- </xsl:result-document>
- <xsl:variable name="analized_restr">
- <xsl:apply-templates select="$element_to_verify_schema_restr" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do"/>
- </xsl:variable>
- <xsl:result-document href="../default_db.instance.xml/schema_maintain_temp/element_to_verify_schema_restr_2.xml">
- <system_cache__appinfo_schema_maintain:schema_restriction_validate>
- <xsl:copy-of select="$analized_restr"/>
- </system_cache__appinfo_schema_maintain:schema_restriction_validate>
- </xsl:result-document>
-
- <xsl:variable name="system_cache__appinfo_schema_maintain:analyze_base_to_restr">
- <system_cache__appinfo_schema_maintain:analyze_base_to_restr>
- <xsl:call-template name="system_cache__appinfo_schema_maintain:analyze_base_to_restr">
- <xsl:with-param name="analized_base" select="$analized_base"/>
- <xsl:with-param name="analized_restr" select="$analized_restr"/>
- </xsl:call-template>
- </system_cache__appinfo_schema_maintain:analyze_base_to_restr>
- </xsl:variable>
- <xsl:result-document href="../default_db.instance.xml/schema_maintain_temp/analyze_base_to_restr_3.xml">
- <xsl:copy-of select="$system_cache__appinfo_schema_maintain:analyze_base_to_restr"/>
- </xsl:result-document>
-
-
- </xsl:template>
-
- <!-- pomysl na zbudowanie widoku wyplaszczonego widoku elementu aby moc porownac czy jest na nim prawidlowa restrykcja do innego podobnego -->
-
-
- <!--<xsl:template match="sequence" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:element name="{name()}" >
- <xsl:attribute name="minOccurs" select="system_cache__appinfo:schema_occurs_max_sequence(@minOccurs)"/>
- <xsl:attribute name="maxOccurs" select="system_cache__appinfo:schema_occurs_max_sequence(@maxOccurs)"/>
- <xsl:apply-templates select="@*" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do_attr"/>
- </xsl:element>
- <xsl:apply-templates mode="#current"/>
- </xsl:template>-->
-
- <xsl:template name="system_cache__appinfo_schema_maintain:analyze_base_to_restr">
- <xsl:param name="analized_base" required="yes"/>
- <xsl:param name="analized_restr" required="yes"/>
-
- <!-- szukamy wezla do przejechania podobnego do base oraz restr -->
- <xsl:for-each select="$analized_base">
-
-
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="*" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do">
- <xsl:param name="xpath" select="''"/>
- <xsl:variable name="xpath_name">
- <xsl:if test="name()">element:<xsl:value-of select="name()"/>;</xsl:if>
- <xsl:if test="@name">name:<xsl:value-of select="@name"/>;</xsl:if>
- <xsl:if test="@name">ref:<xsl:value-of select="@ref"/>;</xsl:if>
- </xsl:variable>
- <xsl:variable name="xpath_name" select="concat($xpath,'/',$xpath_name)"/>
- <xsl:element name="{name()}" >
- <xsl:attribute name="xpath_name" select="$xpath_name"/>
- <xsl:attribute name="minOccurs" select="system_cache__appinfo:schema_occurs_max_sequence(@minOccurs)"/>
- <xsl:attribute name="maxOccurs" select="system_cache__appinfo:schema_occurs_max_sequence(@maxOccurs)"/>
- <xsl:choose>
- <xsl:when test="@name"><xsl:attribute name="name" select="@name"/></xsl:when>
- <xsl:when test="@ref"><xsl:attribute name="ref" select="@ref"/></xsl:when>
- <xsl:otherwise>
- <xsl:if test="@type"><xsl:attribute name="type" select="@type"/></xsl:if></xsl:otherwise>
- </xsl:choose>
- <!--<xsl:apply-templates select="@*" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do_attr"/>-->
- <xsl:choose>
- <xsl:when test="name()='choice'">
- <xsl:apply-templates mode="#current" >
- <xsl:with-param name="xpath" select="$xpath_name"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates mode="#current" >
- <xsl:with-param name="xpath" select="$xpath_name"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:template>
-
-
- <xsl:template match="@*" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do_attr"/>
-
-
-
- <xsl:template match="simpleType" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
- <xsl:template match="annotation" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
- <xsl:template match="text()|comment()" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate_do"/>
- <xsl:template match="text()|comment()" mode="system_cache__appinfo_schema_maintain:schema_restriction_validate"/>
-
-
- <xsl:template name="system_cache__appinfo_schema_maintain:schema_maintain__append_schema">
- <!-- do stworzenia nowego naglowka schema -->
- <xsl:param name="targetNamespace" required="yes"/>
- <xsl:param name="prefix" required="yes"/>
- <xsl:param name="file_href" required="yes"/><!-- link z nazwa pliku do ktorego bedzie akcja-->
- <xsl:param name="schema" required="yes"/><!-- zawartosc do dodania -->
- <xsl:param name="vrtfNamespaces" required="yes"/><!-- do dolaczenia include schematow, prefixow, jakie sa uzywane-->
- <xsl:param name="procesy5_system_schema" required="yes"/>
- <xsl:param name="main_targetNamespace" required="yes"/>
-
-
-
- <xsl:variable name="schema_to_save">
- <system_cache__appinfo:get_all_xsd>
- <xsl:element name="{concat(system_cache__appinfo:prefix_from_targetNamespace($vrtfNamespaces,'http://www.w3.org/2001/XMLSchema'),':schema')}" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:namespace name="{$prefix}" select="$targetNamespace"/>
- <xsl:namespace name="vc" select="'http://www.w3.org/2007/XMLSchema-versioning'"/>
- <xsl:attribute name="targetNamespace" select="$targetNamespace"/>
- <xsl:attribute name="elementFormDefault" select="'qualified'"/>
- <xsl:if test="$vc:minVersion"><xsl:attribute name="vc:minVersion" select="$vc:minVersion"/></xsl:if>
- <xsl:if test="$vc:maxVersion"><xsl:attribute name="vc:maxVersion" select="$vc:maxVersion"/></xsl:if>
- <xsl:for-each select="$schema/namespace::node()">
- <xsl:namespace name="{name()}" select="."/>
- </xsl:for-each>
- <!-- rejestracja prefixu dla main_schematu -->
- <xsl:namespace name="{system_cache__appinfo:prefix_from_targetNamespace($vrtfNamespaces,$main_targetNamespace)}" select="$main_targetNamespace"/>
-
- <!-- namespace dla importow rejestracja -->
- <xsl:for-each select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/system_cache__appinfo:get_all_xsd/schema[@targetNamespace=$main_targetNamespace]/import" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:namespace name="{system_cache__appinfo:prefix_from_targetNamespace($vrtfNamespaces,@namespace)}" select="@namespace"/>
- </xsl:for-each>
- <!--<ns>
- <xsl:copy-of select="$vrtfNamespaces"/>
- </ns>-->
- <!--<schemata>
- <xsl:copy-of select="$procesy5_system_schema"/>
- </schemata>-->
-
-
- <!-- import main -->
-
- <xsl:element name="{concat(system_cache__appinfo:prefix_from_targetNamespace($vrtfNamespaces,'http://www.w3.org/2001/XMLSchema'),':import')}">
- <xsl:attribute name="namespace" select="$main_targetNamespace"/>
- <xsl:attribute name="schemaLocation" select="concat('../',$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/system_cache__appinfo:get_all_xsd[child::node()/@targetNamespace=$main_targetNamespace]/@system_cache__appinfo:document-uri)"/>
- </xsl:element>
-
- <!-- importy -->
- <xsl:for-each select="$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/system_cache__appinfo:get_all_xsd/schema[@targetNamespace=$main_targetNamespace]/import" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:element name="{name()}">
- <xsl:variable name="namespace" select="@namespace"/>
- <xsl:attribute name="namespace" select="@namespace"/>
- <xsl:attribute name="schemaLocation" select="concat('../',$procesy5_system_schema/system_cache__appinfo:get_all_xsd_list/system_cache__appinfo:get_all_xsd[child::node()/@targetNamespace=$namespace]/@system_cache__appinfo:document-uri)"/>
- </xsl:element>
- </xsl:for-each>
- <xsl:copy-of select="$schema" copy-namespaces="no"/>
- </xsl:element>
- </system_cache__appinfo:get_all_xsd>
- </xsl:variable>
-
-
-
- <xsl:variable name="schema_id">
- <xsl:apply-templates select="$schema_to_save" mode="system_cache__resources_tree_generate_xsl_required_occurs_raport:generate_element_id_for_schema"/>
- </xsl:variable>
-
-
- <xsl:result-document href="{$file_href}">
- <xsl:copy-of select="$schema_id" />
- </xsl:result-document>
-
- <!--<xsl:result-document href="{concat($file_href,'_noid.xsd')}">
- <xsl:copy-of select="$schema_to_save/system_cache__appinfo:get_all_xsd/*" />
- </xsl:result-document>-->
-
- </xsl:template>
-
-
-
- </xsl:stylesheet>
|