| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <?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:include href="../default_db_xml_cache.public/xml-schema-primitives.xsl"/>
-
- <xsl:function name="system_cache__appinfo:clean_object_prefix">
- <xsl:param name="name" required="yes"/>
- <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" required="yes"/>
- <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" required="yes"/>
- </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" required="yes"/>
- <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" required="yes"/>
- <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),':')"/>
- <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: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" required="yes"/>
- <xsl:param name="targetNamespace" required="yes"/>
- <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" required="yes"/>
- <xsl:param name="prefix" required="yes"/>
- <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" required="yes"/>
- <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="'../default_objects/'"/>
- <xsl:param name="get_system_schemas"/>
- <xsl:param name="cache" select="'read'"/>
- <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="'../'"/>
- <xsl:with-param name="cache" select="'read'"></xsl:with-param>
- </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>
-
-
- <!-- 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>
|