| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635 |
- <?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:exslt="http://exslt.org/common"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:system_cache__procesy5_xsd_business_objects="http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/procesy5_xsd_business_objects.xsd"
- exclude-result-prefixes="xs exslt"
- version="2.0">
-
-
- <!-- @2017 02 bindera: do weryfikacji do czego to jest potrzebne -->
- <!-- @2015-02-29 - proba testowej transormacji w celu stworzenia zapytan do tworzenia tabel,relacji,widokow na podstawie xsd -->
- <xsl:output omit-xml-declaration="no" method="xml" indent="yes" xml:space="default"/>
-
-
-
-
- <xsl:template name="get_all_xsd">
- <xsl:param name="path2collection">../public_html/</xsl:param>
- <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:for-each select="$docs">
- <xsl:message> get_all_xsd przetwarzam plik <xsl:value-of select="document-uri(/)"/></xsl:message>
- <xsl:copy-of select="/"/>
- </xsl:for-each>
- </xsl:template>
-
-
-
- <xsl:template name="main" >
- <xsl:variable name="get_all_xsd">
- <xsl:call-template name="get_all_xsd"/>
- </xsl:variable>
- <xsl:variable name="namespaces_imports">
- <xsl:for-each select="exslt:node-set($get_all_xsd)">
- <xsl:message>Uruchamiam apply templates dla calej zmiennej ze wszystkimi plikami - tam sa juz xs:schema </xsl:message>
- <xsl:apply-templates/>
- </xsl:for-each>
- </xsl:variable>
-
-
- <xsl:variable name="namespace_record_to_import">
- <xsl:for-each select="exslt:node-set($namespaces_imports/namespace_record_import)">
- <xsl:variable name="namespace_test" select="namespace"/>
- <xsl:message>W importach <xsl:value-of select="document-uri(.)"/>wystapil namespace : <xsl:value-of select="namespace"/> . Sprawdzamy czy wystepowal w TargetNameSpace</xsl:message>
- <xsl:variable name="ckk_if_import_exists" select="''"/>
- <xsl:variable name="ckk_if_import_exists">
- <xsl:comment>Szukam dla <xsl:value-of select="namespace"/></xsl:comment>
- <xsl:for-each select="exslt:node-set($namespaces_imports/namespace_record[namespace=$namespace_test])">
- <xsl:value-of select="namespace"/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$ckk_if_import_exists=''">
- <xsl:message> - nie występował - tworzę namespace_record_to_import z namespace<xsl:value-of select="$namespace_test"/> i schemaLocation <xsl:value-of select="schemaLocation"/> </xsl:message>
- <namespace_record_to_import>
- <namespace>
- <xsl:value-of select="$namespace_test"/>
- </namespace>
- <schemaLocation>
- <xsl:value-of select="schemaLocation"/>
- </schemaLocation>
- <Parent_targetNamespace>
- <xsl:value-of select="Parent_targetNamespace"/>
- </Parent_targetNamespace>
- </namespace_record_to_import>
- </xsl:when>
- <!-- <xsl:otherwise>
- <NO_IMPORT_TODO><xsl:value-of select="$ckk_if_import_exists"/></NO_IMPORT_TODO>
- </xsl:otherwise>
- -->
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:variable name="namespace_records">
- <xsl:for-each select="exslt:node-set($namespaces_imports/namespace_record)">
- <xsl:copy-of select="."/>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:call-template name="import_external">
- <xsl:with-param name="namespace_records" select="$namespace_records"/>
- <xsl:with-param name="namespace_record_to_import" select="$namespace_record_to_import"/>
- </xsl:call-template>
-
-
- <!-- wykrycie pojedynczych namespaces -->
- <xsl:variable name="uniq_namespaces">
- <xsl:for-each-group select="exslt:node-set($namespace_records)/namespace_record" group-by="namespace" xml:space="default">
- <namespace><xsl:value-of select="namespace"/></namespace>
- </xsl:for-each-group>
- </xsl:variable>
-
- <!-- teraz generujemy obiekty do php -->
-
-
-
-
- <xsl:comment>Test wyzwolenia pojedycznego resorce</xsl:comment>
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resources">
- <xsl:attribute name="xsi:schemaLocation" select="'http://biuro.biall-net.pl/xmlschema_procesy5/system_cache/procesy5_xsd_business_objects.xsd ../system_cache/procesy5_xsd_business_objects.xsd'"/>
- <!-- <xsl:for-each select="exslt:node-set($uniq_namespaces/namespace[.='http://biuro.biall-net.pl/xmlschema_procesy5/default_objects/projects.xsd' or .='http://biuro.biall-net.pl/xmlschema_procesy5/default_db/IN7_MK_BAZA_DYSTRYBUCJIxxx'])"> -->
- <xsl:for-each select="exslt:node-set($uniq_namespaces/namespace)">
- <!-- <xsl:for-each select="exslt:node-set($uniq_namespaces/namespace)"> -->
- <xsl:variable name="current_namespace" select="."/>
-
- <xsl:comment>Jedziemy root <xsl:value-of select="$current_namespace"/></xsl:comment>
- <xsl:for-each select="exslt:node-set($get_all_xsd/schema[@targetNamespace=$current_namespace[1]])" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:comment>.. jedziemy next... </xsl:comment>
-
-
- <xsl:variable name="targetNamespace">
- <xsl:for-each select="attribute::node()[name()='targetNamespace']">
- <xsl:value-of select="."/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:variable name="prefix">
- <xsl:for-each select="namespace::node()[.=$targetNamespace]">
- <xsl:value-of select="name()"/>
- </xsl:for-each>
- </xsl:variable>
-
- <!-- <targetNamespace><xsl:value-of select="$targetNamespace"/></targetNamespace>
- <prefix><xsl:value-of select="$prefix"/></prefix>
- <namespace-uri><xsl:value-of select="namespace-uri(.)"/></namespace-uri>-->
-
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="$prefix"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type><system_cache__procesy5_xsd_business_objects:prefix/></system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id>root</system_cache__procesy5_xsd_business_objects:resource_parent_id>
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="$prefix"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
-
- <xsl:apply-templates mode="php" select="." xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="$prefix"/>
- </xsl:apply-templates>
-
- <xsl:copy-of select="xxx" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
- </xsl:for-each>
-
-
- </xsl:for-each>
- </xsl:element>
- <xsl:comment>EOF Test wyzwolenia pojedycznego resorce</xsl:comment>
- <xsl:comment>testowe wyswietlenie wszystkiego</xsl:comment>
- <xsl:for-each select="exslt:node-set($get_all_xsd)/REM_ME_TODO" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:copy-of select="/"/>
- </xsl:for-each>
-
- </xsl:template>
-
- <xsl:template match="text()" mode="php">
- <!--<xsl:comment><xsl:value-of select="."/></xsl:comment>-->
- </xsl:template>
-
- <xsl:template match="attribute" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
-
-
-
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name">
- <xsl:value-of select="concat(@name,'::attribute')"/>
- </xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:attribute>
- <xsl:if test="@type">
- <system_cache__procesy5_xsd_business_objects:alias_id><xsl:value-of select="@type"/></system_cache__procesy5_xsd_business_objects:alias_id>
- </xsl:if>
-
- </system_cache__procesy5_xsd_business_objects:attribute>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/',@name,'::attribute')"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:when>
- <xsl:when test="@ref">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="concat(@ref,'::attribute')"/>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:attribute>
- <system_cache__procesy5_xsd_business_objects:alias_id><xsl:value-of select="@ref"/></system_cache__procesy5_xsd_business_objects:alias_id>
- </system_cache__procesy5_xsd_business_objects:attribute>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/',@ref,'::attribute')"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
- </xsl:when>
- <xsl:otherwise>
- <xsl:comment>ERROR - transformation needs another condition</xsl:comment>
-
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
-
-
-
-
-
-
-
- </xsl:template>
-
-
- <xsl:template match="attributeGroup" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="@name"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:attributeGroup>
-
- <xsl:if test="@ref">
- <system_cache__procesy5_xsd_business_objects:alias_id><xsl:value-of select="@ref"/></system_cache__procesy5_xsd_business_objects:alias_id>
- </xsl:if>
- </system_cache__procesy5_xsd_business_objects:attributeGroup>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
-
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/',@name,'::attributeGroup')"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
-
-
- <xsl:apply-templates mode="php" select="attribute" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="concat($prefix_path,'/',@name,'::attributeGroup')"/>
- </xsl:apply-templates>
-
-
- </xsl:template>
-
-
- <xsl:template match="complexType" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
- <xsl:variable name="ds">
- <xsl:choose>
- <xsl:when test="$prefix=$prefix_path"><xsl:value-of select="':'"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="'/'"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="name_val">
- <xsl:choose>
- <xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="'complexType'"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="$name_val"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:complexType/>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
- <xsl:if test="@type">
- <system_cache__procesy5_xsd_business_objects:alias_id><xsl:value-of select="@type"/></system_cache__procesy5_xsd_business_objects:alias_id>
- </xsl:if>
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,$ds,$name_val)"/></system_cache__procesy5_xsd_business_objects:path>
- <xsl:if test="annotation/documentation">
- <xsl:call-template name="documentation" >
- <xsl:with-param name="documentation" select="annotation/documentation"/>
- </xsl:call-template>
- </xsl:if>
-
- </xsl:element>
-
-
-
-
- <xsl:if test="@type"><type><xsl:value-of select="@type"/></type></xsl:if>
- <xsl:apply-templates mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="concat($prefix_path,$ds,$name_val)"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template name="documentation" >
-
- <xsl:param name="documentation"/>
-
-
- <system_cache__procesy5_xsd_business_objects:annotation_documentation>
-
- <xsl:for-each select="$documentation">
- <xsl:value-of select='replace(.,"'","^")'/>
- </xsl:for-each>
- </system_cache__procesy5_xsd_business_objects:annotation_documentation>
-
- </xsl:template>
-
-
- <xsl:template match="complexContent" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
-
-
-
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name">
-
- <xsl:choose>
- <xsl:when test="@name">
- <xsl:value-of select="@name"/>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:value-of select="concat($prefix_path,'/complexContent')"/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:complexContent>
- <xsl:if test="@mixed"><xsl:element name="system_cache__procesy5_xsd_business_objects:mixed"><xsl:value-of select="@mixed"/></xsl:element></xsl:if>
- </system_cache__procesy5_xsd_business_objects:complexContent>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
-
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/','complexContent')"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
-
-
-
-
- <xsl:apply-templates mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="concat($prefix_path,'/','complexContent')"/>
- </xsl:apply-templates>
-
- </xsl:template>
-
- <xsl:template match="simpleType" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="concat(@name,'::simpleType')"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:simpleType>
- <xsl:if test="@type">
- <system_cache__procesy5_xsd_business_objects:alias_id><xsl:value-of select="@type"/></system_cache__procesy5_xsd_business_objects:alias_id>
- </xsl:if>
- </system_cache__procesy5_xsd_business_objects:simpleType>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
-
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/',@name,'::simpleType')"/></system_cache__procesy5_xsd_business_objects:path>
-
- </xsl:element>
-
-
-
- <xsl:apply-templates mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="concat($prefix_path,'/','complexContent')"/>
- </xsl:apply-templates>
-
- </xsl:template>
-
-
-
-
-
-
- <xsl:template match="minInclusive|maxInclusive|enumeration|length|maxLength|minExclusive|maxExclusive|minLength|pattern|totalDigits|whiteSpace" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
-
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="local-name()"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <xsl:element name="{concat('system_cache__procesy5_xsd_business_objects:',local-name())}">
- <xsl:if test="@value">
- <system_cache__procesy5_xsd_business_objects:value><xsl:value-of select="@value"/></system_cache__procesy5_xsd_business_objects:value>
- </xsl:if>
- <xsl:if test="@fixed">
- <system_cache__procesy5_xsd_business_objects:fixed><xsl:value-of select="@fixed"/></system_cache__procesy5_xsd_business_objects:fixed>
- </xsl:if>
- </xsl:element>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
-
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/',local-name())"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
-
- </xsl:template>
-
-
-
- <xsl:template match="restriction" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
-
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="'restriction'"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:restriction>
- <xsl:if test="@base">
- <system_cache__procesy5_xsd_business_objects:alias_id><xsl:value-of select="@base"/></system_cache__procesy5_xsd_business_objects:alias_id>
- </xsl:if>
- </system_cache__procesy5_xsd_business_objects:restriction>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
-
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/','restriction')"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
- <xsl:apply-templates mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="concat($prefix_path,'/','restriction')"/>
- </xsl:apply-templates>
-
-
- </xsl:template>
-
-
-
- <xsl:template match="choice" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="'choice'"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:choice>
- <xsl:if test="@minOccurs"><xsl:element name="system_cache__procesy5_xsd_business_objects:minOccurs"><xsl:value-of select="@minOccurs"/></xsl:element> </xsl:if>
- <xsl:if test="@maxOccurs"><xsl:element name="system_cache__procesy5_xsd_business_objects:maxOccurs"><xsl:value-of select="@maxOccurs"/></xsl:element></xsl:if>
- </system_cache__procesy5_xsd_business_objects:choice>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
-
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/','choice')"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
-
-
-
- <xsl:apply-templates mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="concat($prefix_path,'/','choice')"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match="sequence" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
-
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="'sequence'"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:sequence>
- <xsl:if test="@minOccurs"><xsl:element name="system_cache__procesy5_xsd_business_objects:minOccurs"><xsl:value-of select="@minOccurs"/></xsl:element> </xsl:if>
- <xsl:if test="@maxOccurs"><xsl:element name="system_cache__procesy5_xsd_business_objects:maxOccurs"><xsl:value-of select="@maxOccurs"/></xsl:element></xsl:if>
- </system_cache__procesy5_xsd_business_objects:sequence>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
-
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/','sequence')"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
-
-
-
-
- <xsl:apply-templates mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="concat($prefix_path,'/','sequence')"/>
- </xsl:apply-templates>
-
- </xsl:template>
-
- <xsl:template match="element" mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="targetNamespace"/>
- <xsl:param name="prefix"/>
- <xsl:param name="prefix_path"/>
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource">
- <xsl:element name="system_cache__procesy5_xsd_business_objects:resource_name"><xsl:value-of select="@name"/></xsl:element>
- <system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:element>
- <xsl:if test="@type">
- <system_cache__procesy5_xsd_business_objects:alias_id><xsl:value-of select="@type"/></system_cache__procesy5_xsd_business_objects:alias_id>
- </xsl:if>
- </system_cache__procesy5_xsd_business_objects:element>
- </system_cache__procesy5_xsd_business_objects:resource_type>
- <system_cache__procesy5_xsd_business_objects:resource_parent_id><xsl:value-of select="$prefix_path"/></system_cache__procesy5_xsd_business_objects:resource_parent_id>
-
- <system_cache__procesy5_xsd_business_objects:path><xsl:value-of select="concat($prefix_path,'/',@name)"/></system_cache__procesy5_xsd_business_objects:path>
- </xsl:element>
-
- <xsl:apply-templates mode="php" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:with-param name="targetNamespace" select="$targetNamespace"/>
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="prefix_path" select="concat($prefix_path,'/','element')"/>
- </xsl:apply-templates>
-
- </xsl:template>
-
-
- <!-- funkcja do sciagania zewnetrznych schema
- musi znac liste juz includowanych targetnamespaces, aby ich nie importowac
- musi po kazdym imporcie dodawac do listy zaimportowanych schematow defaultnamespace, aby nie bylo petli
- -->
- <xsl:template name="import_external">
- <xsl:param name="namespace_records"/>
- <xsl:param name="namespace_record_to_import"/>
-
- <xsl:for-each-group select="$namespace_record_to_import/namespace_record_to_import" group-by="schemaLocation">
- <xsl:message>wyzwalam call-template retrieve_single_import parametr loc,namespace: <xsl:value-of select="concat(schemaLocation,',',namespace)"/></xsl:message>
- <xsl:call-template name="retrieve_single_import">
- <xsl:with-param name="schemaLocation" select="schemaLocation"/>
- <xsl:with-param name="namespace" select="namespace"/>
- <xsl:with-param name="Parent_targetNamespace" select="Parent_targetNamespace"/>
- <xsl:with-param name="namespace_records" select="namespace_records"/>
- </xsl:call-template>
-
- </xsl:for-each-group>
-
-
-
-
- </xsl:template>
-
- <!-- template do odczytania pojedynczego schematu na podstawie URLa -->
- <xsl:template name="retrieve_single_import">
- <xsl:param name="schemaLocation"></xsl:param>
- <xsl:param name="namespace"></xsl:param>
- <xsl:param name="Parent_targetNamespace"></xsl:param>
- <xsl:param name="namespace_records"></xsl:param>
-
- <xsl:message>Importuje schemat namespace z uri: <xsl:value-of select="$schemaLocation"/> parent was <xsl:value-of select="Parent_targetNamespace"/> </xsl:message>
- <!-- todo nalezy sprawdizc po parent_TargetNameSpace - co go importowalo i z jakiego urla - z takiego URLa trzeba dociagnac teraz plik xsd, trzeba sprawdzic czy jest tam referencja lokalna -->
- <xsl:choose>
- <xsl:when test="contains($schemaLocation,'http')">
- <xsl:message> schema locations contains http:</xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message> schema location <xsl:value-of select="$schemaLocation"/> not contains http:, but:
- <xsl:value-of select="exslt:node-set($namespace_records/schema/import/@schemaLocation[@namespace=$Parent_targetNamespace])"/>
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:for-each select="document($schemaLocation)">
- <xsl:variable name="filename" select="concat('../auto_imported_referenced_schemas/',replace(replace($schemaLocation,'http://',''),'\.\./',''))"/>
- <xsl:message terminate="no">Import pliku ze zrodla <xsl:value-of select="$schemaLocation"/> </xsl:message>
- <xsl:result-document href="{$filename}" method="xml">
- <xsl:copy-of select="/"/>
- </xsl:result-document>
-
- </xsl:for-each>
-
- </xsl:template>
-
-
- <xsl:template match="import" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
-
- <namespace_record_import>
- <namespace>
- <xsl:value-of select="attribute::node()[name()='namespace']"/>
- </namespace>
- <schemaLocation>
- <xsl:value-of select="attribute::node()[name()='schemaLocation']"/>
- </schemaLocation>
- <Parent_targetNamespace>
- <xsl:value-of select="../@targetNamespace"/>
- </Parent_targetNamespace>
- </namespace_record_import>
- </xsl:template>
-
-
- <xsl:template match="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <!--
- <document>
- <xsl:value-of select="document-uri(/)"/>
- </document> -->
- <xsl:variable name="targetNamespace">
- <xsl:for-each select="attribute::node()[name()='targetNamespace']">
- <xsl:value-of select="."/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:for-each select="namespace::node()[.=$targetNamespace]">
- <namespace_record>
- <prefix>
- <xsl:value-of select="name()"/>
- </prefix>
- <namespace>
- <xsl:value-of select="."/>
- </namespace>
- </namespace_record>
-
- </xsl:for-each>
-
- <xsl:apply-templates select="import"/>
-
- </xsl:template>
-
-
- <!--
- <xsl:template match="node()|@*">
-
- <xsl:for-each select="xs:complexType">
- <test>create table <xsl:value-of select="@name"/></test>
- </xsl:for-each>
-
- </xsl:template> -->
- </xsl:stylesheet>
|