| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- <?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 hfp"
- version="2.0"
- xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
- xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
-
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
-
- <xsl:param name="procesy5_system_schema" select="'../default_db.instance.xml/transformed/procesy5_system_schema.xml'"/>
- <xsl:param name="procesy5_system_schema_collection_dir" select="'../'"/>
- <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:function name="system_cache__appinfo:clean_object_prefix">
- <xsl:param name="name" />
- <xsl:choose>
- <xsl:when test="substring-after($name,':')">
- <xsl:value-of select="substring-after($name,':')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:function>
-
- <xsl:function name="system_cache__appinfo:get_object_prefix">
- <xsl:param name="name" />
- <xsl:choose>
- <xsl:when test="substring-before($name,':')">
- <xsl:value-of select="substring-before($name,':')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message terminate="yes">system_cache__appinfo:get_object_prefix(<xsl:value-of select="$name"/>) - parameter has no exptected prefix:object format definition! Maybe not expected schema?</xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:function>
-
- <!-- funkcja do wyczyszczenia wyescapowenago prefixu z np. default_db__x3A__IN7_DZIENNIK_KORESP do IN7_DZIENNIK_KORESP -->
- <xsl:function name="system_cache__appinfo:clean_object_escaped_prefix">
- <xsl:param name="name" />
- </xsl:function>
-
- <!-- funkcja do ponownego zamienienia na sredniki itp z np. default_db__x3A__IN7_DZIENNIK_KORESP do IN7_DZIENNIK_KORESP -->
- <xsl:function name="system_cache__appinfo:translate_object_escaped_prefix_from_string">
- <xsl:param name="name" />
- <xsl:value-of select="replace(replace(replace(replace(replace(replace(replace(replace($name, '__x2F__', '/'), '__x3A__', ':'),'__x2D__','-'),'__x25__','%'),'__x28__','('),'__x29__',')'),'__x23__','#'),'__x2A__','*')"/>
- </xsl:function>
-
- <!-- funkcja do zamienienia na postac default_db__x3A__IN7_DZIENNIK_KORESP do IN7_DZIENNIK_KORESP -->
- <xsl:function name="system_cache__appinfo:escape_object_prefix_to_string">
- <xsl:param name="name" />
- <xsl:value-of select="replace(replace(replace(replace(replace(replace(replace(replace($name, '/', '__x2F__'), ':', '__x3A__'),'-','__x2D__'),'%','__x25__'), '\(', '__x28__'), '\)' ,'__x29__'),'#','__x23__'),'\*','__x2A__')"/>
- </xsl:function>
-
- <xsl:template name="system_cache__appinfo:prefixed_object_info">
- <xsl:param name="prefixed_object" required="yes"/>
- <xsl:variable name="prefix_token" select="tokenize(system_cache__appinfo:translate_object_escaped_prefix_from_string($prefixed_object),':')"/>
- <xsl:choose>
- <xsl:when test=" string-length($prefix_token[3]) > 0">
- <system_cache__appinfo:prefixed_object_info>
- <xsl:attribute name="prefix" select="$prefix_token[1]"/>
- <xsl:attribute name="name" select="$prefix_token[2]"/>
- <xsl:attribute name="element" select="$prefix_token[3]"/>
- </system_cache__appinfo:prefixed_object_info>
- </xsl:when>
- <xsl:otherwise>
- <system_cache__appinfo:prefixed_object_info>
- <xsl:attribute name="prefix" select="$prefix_token[1]"/>
- <xsl:attribute name="name" select="$prefix_token[2]"/>
- <xsl:attribute name="element" select="$prefix_token[2]"/>
- </system_cache__appinfo:prefixed_object_info>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- @2016-08 funkcje do wykrywania prefixow, namespace itp itd...
- <xsl:attribute name="prefix" select="$vrtfNamespaces/ns[@uri=$targetnamespace][1]/@prefix" xpath-default-namespace=""/>
- <xsl:attribute name="targetnamespace" select="$targetnamespace"/>
- <xsl:attribute name="type_79" select="$type_79"/>
- <xsl:attribute name="prefix_79" select="$prefix_79"/>
- <xsl:attribute name="type_79_nopref" select="$type_79_nopref"/>
-
- -->
- <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:function>
- <xsl:function name="system_cache__appinfo:targetNamespace_from_prefix">
- <xsl:param name="system_cache__appinfo:vrtfNamespaces" />
- <xsl:param name="prefix" />
- <xsl:value-of select="$system_cache__appinfo:vrtfNamespaces//ns[@prefix=$prefix][1]/@uri" xpath-default-namespace=""/>
- </xsl:function>
-
-
- <xsl:function name="system_cache__appinfo:get_default_db_obj_url_table_name"><!-- @2016-10 funkcja do wykrywania nazwy tabeli dla default db, w przypadku braku zgodnosci namespace - nic nie zwraca -->
- <xsl:param name="parent_complexTypeNamespace" />
- <xsl:variable name="uri_tokens" select="tokenize($parent_complexTypeNamespace,'/')"/>
- <xsl:variable name="uri_tokens_count" select="count($uri_tokens)"/>
- <xsl:if test="$uri_tokens[($uri_tokens_count - 1)]='table' and $uri_tokens[($uri_tokens_count - 2)]='default_db' and $uri_tokens[($uri_tokens_count - 3)]='wfs'">
- <xsl:variable name="get_default_db_obj_url_table_name" select="tokenize($uri_tokens[$uri_tokens_count],'\.')"/>
- <xsl:value-of select="$get_default_db_obj_url_table_name[1]"/>
- </xsl:if>
- </xsl:function>
-
-
- <!--<xsl:function name="system_cache__appinfo:php_function_name_from_obj_with_prefix">
- <xsl:param name="object_name" required="yes"/>
- <xsl:value-of select="replace($object_name,':','__x3A__')"/>
- </xsl:function>-->
-
- <xsl:template name="main">
- <xsl:call-template name="system_cache__appinfo:get_all_xsd">
- <xsl:with-param name="path2collection" select="'../'"/>
- <xsl:with-param name="cache" select="'read'"/>
- </xsl:call-template>
- </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"/>
- <xsl:variable name="element-filename" select="'procesy5_system_schema'"/>
- <xsl:choose>
- <xsl:when test="unparsed-text-available(concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')) and $cache='read'">
- <xsl:copy-of select="doc(concat('../default_db.instance.xml/transformed/',$element-filename,'.xml'))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="path">
- <xsl:value-of select="concat($path2collection,'?select=*.(xsd);recurse=yes;on-error=warning')"/>
- </xsl:variable>
- <xsl:variable name="docs" select="collection($path)"/>
- <xsl:variable name="procesy5_system_schema">
- <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: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">
- <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="/"/>
- </system_cache__appinfo:get_all_xsd>
- </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>
- <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
- <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
- <xsl:copy-of select="$system_cache__appinfo:primitives.xsd"/>
- </system_cache__appinfo:get_all_xsd>
- <xsl:message> schemat dla XML primitives/derived <xsl:value-of select="'http://www.w3.org/1999/XSL/Transform'"/></xsl:message>
- <system_cache__appinfo:get_all_xsd>
- <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
- <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
- <xsl:copy-of select="$system_cache__appinfo:derived.xsd"/>
- </system_cache__appinfo:get_all_xsd>
- <system_cache__appinfo:get_all_xsd>
- <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
- <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
- <xsl:copy-of select="$system_cache__appinfo:XMLSchema11.xsd"/>
- </system_cache__appinfo:get_all_xsd>
- <system_cache__appinfo:get_all_xsd>
- <xsl:attribute name="system_cache__appinfo:document-uri" select="'http://www.w3.org/1999/XSL/Transform'"/>
- <xsl:attribute name="system_cache__appinfo:document-uri-full" select="'http://www.w3.org/1999/XSL/Transform'"/>
- <xsl:copy-of select="$system_cache__appinfo:builtintypes.xsd"/>
- </system_cache__appinfo:get_all_xsd>
- </system_cache__appinfo:get_all_xsd_list>
- </xsl:variable>
- <!--<xsl:result-document href="{concat('../default_db.instance.xml/transformed/',$element-filename,'.xml')}">
- <xsl:copy-of select="$procesy5_system_schema"/>
- </xsl:result-document>-->
- <xsl:copy-of select="$procesy5_system_schema"></xsl:copy-of>
- </xsl:otherwise>
- </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()"
- xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <ns element="{name(..)}" prefix="{name()}" uri="{.}"/>
- </xsl:for-each>
- </system_cache__appinfo:vrtfNamespaces>
- </xsl:template>
-
-
- <xsl:template match="system_cache__appinfo:get_all_xsd_list" mode="system_cache__appinfo:element_complexType">
- <xsl:param name="targetNamespace" select="$targetNamespace_DEFAULTS"/>
- <system_cache__appinfo:element_complexType>
- <xsl:for-each select="get_all_xsd[ substring-before(@system_cache__appinfo:document-uri,'/')!='default_db_xml_cache' and substring-before(@system_cache__appinfo:document-uri,'/')!='default_db_xml_cache.public']" xpath-default-namespace="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd">
- <xsl:variable name="get_all_xsd_236" select="."/>
- <xsl:comment>
- 246:detect_resource_type, przetwarzam schemat:<xsl:value-of select="@system_cache__appinfo:document-uri"/>; $targetNamespace:<xsl:value-of select="$targetNamespace"/>;
- @targetNamespace:<xsl:value-of select="schema/@targetNamespace" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>;</xsl:comment>
- <xsl:variable name="schema_node_144" select="."/>
- <xsl:for-each select="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!--[ @targetNamespace != $targetNamespace ] namespace::node() = $targetNamespace and @targetNamespace='moj_ogrodek' -->
- <xsl:message>239::detect_resource_type przetwarzam schemat:@targetNamespace:<xsl:value-of select="@targetNamespace"/>;</xsl:message>
- <xsl:variable name="prefix_83" select="namespace::node()[. = $targetNamespace]/name()"/>
- <xsl:variable name="targetNamespace_134" select="@targetNamespace"/>
- <xsl:variable name="prefix_134" select="namespace::node()[. = $targetNamespace_134][1]/name()"/><!-- np. test_objects -->
- <xsl:if test="not(@targetNamespace) or not($prefix_134) ">
- <xsl:message terminate="yes">#394 ERROR - schema error - set @targetNamespace and prefix for shema file:<xsl:value-of select="../@system_cache__appinfo:document-uri-full"/> ; </xsl:message>
- </xsl:if>
- <xsl:if test="count(.//node()[(local-name()='element' or local-name()='complexType' or local-name()='sequence' or local-name()='choice' or local-name()='complexContent' or local-name()='extension' ) and not(@id)])=0">
- <xsl:for-each select="(element|complexType)" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"><!-- dla ograniczenia mozna [$prefix_134='test_objects']-->
- <xsl:variable name="complexType_or_element_name186">
- <xsl:choose>
- <xsl:when test="local-name()='element'"><xsl:value-of select="@name"/></xsl:when>
- <xsl:when test="local-name()='complexType'"><xsl:value-of select="@name"/></xsl:when>
- <xsl:otherwise><xsl:message terminate="yes">#391 it should work only for element or complexType</xsl:message></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:comment>157: buduje plaski obiekt/mape przetwarzania w celu przeszukania relacji @id:<xsl:value-of select="@id"/>; targetNamespace:<xsl:value-of select="$prefix_134"/>; $complexType_or_element_name186:<xsl:value-of select="$complexType_or_element_name186"/>; name:<xsl:value-of select="@name"/>; namespace-uri-for-prefix:<xsl:value-of select="namespace-uri-for-prefix($prefix_134,.)"/></xsl:comment>
- <xsl:message>157: buduje plaski obiekt/mape przetwarzania w celu przeszukania relacji @id:<xsl:value-of select="@id"/>; targetNamespace:<xsl:value-of select="$prefix_134"/>; $complexType_or_element_name186:<xsl:value-of select="$complexType_or_element_name186"/>; name:<xsl:value-of select="@name"/>; namespace-uri-for-prefix:<xsl:value-of select="namespace-uri-for-prefix($prefix_134,.)"/></xsl:message>
- <xsl:choose>
- <xsl:when test="local-name()='element'">
- <build_cache name="build_element">
- <with-param name="element" select="{$prefix_134}:{$complexType_or_element_name186}"/>
- </build_cache>
- </xsl:when>
- <xsl:when test="local-name()='complexType'">
- <build_cache name="build_complexType">
- <with-param name="complexType"
- select="{$prefix_134}:{$complexType_or_element_name186}"/>
- </build_cache>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:if>
- </xsl:for-each>
- </xsl:for-each>
- </system_cache__appinfo:element_complexType>
- </xsl:template>
-
-
- <!-- do aktualizowania pozycji w schemache-->
- <xsl:template name="system_cache__appinfo:position">
- <xsl:param name="xml"/>
- <xsl:for-each select="$xml/*">
- <xsl:if test="name()">
- <xsl:element name="{name()}">
- <xsl:attribute name="system_cache__appinfo:position" select="position()"/>
- <xsl:apply-templates mode="system_cache__appinfo:position" select="@*"/>
- <xsl:call-template name="system_cache__appinfo:position">
- <xsl:with-param name="xml" select="."/>
- </xsl:call-template>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="@*" mode="system_cache__appinfo:position">
- <xsl:attribute name="{name()}" select="."/>
- </xsl:template>
- <xsl:template match="text()" mode="system_cache__appinfo:position"/>
- <xsl:template match="comment()" mode="system_cache__appinfo:position"/>
-
-
-
- </xsl:stylesheet>
|