| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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 xd"
- xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
- version="2.0"
- >
-
- <xsl:template match="xs:complexType">
- <xsl:if test="matches(@name,'RowType_prezes_procesy5_pl_Schema_')">
- <xsl:variable name="nazwa">
- <xsl:value-of select="replace(@name,'RowType_prezes_procesy5_pl_Schema_','')"/>
- </xsl:variable>
-
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xsl:attribute name="targetNamespace">
- <xsl:value-of select="concat('http://biuro.biall-net.pl/xmlschema_procesy5/default_db/',$nazwa)"/>
- </xsl:attribute>
- <xsl:namespace name="xp5__default_db__{$nazwa}" select="concat('http://biuro.biall-net.pl/xmlschema_procesy5/default_db/',$nazwa)"/>
-
-
-
-
- <xsl:text>
 </xsl:text>
- <xsl:for-each select="xs:sequence/xs:element">
- <xsl:text>
 </xsl:text>
-
- <xs:simpleType>
- <xsl:attribute name="name">
- <xsl:value-of select="@name"/>
- </xsl:attribute>
-
-
- <xsl:choose>
-
- <xsl:when test="matches(@type,'VARCHAR') or matches(@type,'CHAR')">
-
-
- <xsl:variable name="maxLength">
- <xsl:value-of select="replace(@type,'VARCHAR_','')"/>
- </xsl:variable>
- <xsl:variable name="maxLength">
- <xsl:value-of select="replace($maxLength,'CHAR_','')"/>
- </xsl:variable>
- <xs:restriction base="xs:string">
- <xs:maxLength>
- <xsl:attribute name="value">
- <xsl:value-of select="$maxLength"/>
- </xsl:attribute>
- </xs:maxLength>
- </xs:restriction>
-
- </xsl:when>
- <xsl:when test="matches(@type,'INT')">
-
- <xs:restriction base="xs:integer">
- <xs:maxInclusive value="2147483647"/>
- <xs:minInclusive value="-2147483648"/>
- </xs:restriction>
-
- </xsl:when>
-
- <xsl:when test="matches(@type,'DECIMAL')">
- <xsl:variable name="decimal" select="tokenize(@type,'_')"/>
-
- <xs:restriction base="xs:decimal">
- <xs:totalDigits>
- <xsl:attribute name="value">
- <xsl:value-of select="$decimal[2]"/>
- </xsl:attribute>
- </xs:totalDigits>
- <xs:fractionDigits>
- <xsl:attribute name="value" select="$decimal[3]"/>
- </xs:fractionDigits>
- </xs:restriction>
-
- </xsl:when>
- <xsl:when test="matches(@type,'TIMESTAMP')">
- <xs:restriction base="xs:dateTime">
- <xsl:text disable-output-escaping="yes">
- <xs:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}"/>
- </xsl:text>
- </xs:restriction>
- </xsl:when>
-
- <xsl:when test="matches(@type,'DATE')">
- <xs:restriction base="xs:date">
- <xsl:text disable-output-escaping="yes">
- <xs:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/>
- </xsl:text>
-
- </xs:restriction>
- </xsl:when>
-
-
- <xsl:when test="matches(@type,'DOUBLE')">
- <xs:restriction base="xs:double"/>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:attribute name="type2">
- <xsl:value-of select="@type"/>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
-
-
- </xs:simpleType>
-
- </xsl:for-each>
- <xsl:text>
 </xsl:text>
-
- <xs:complexType name="defaults">
- <xsl:text>
 </xsl:text>
- <xs:sequence>
- <xsl:for-each select="xs:sequence/xs:element">
- <xsl:if test="@default!=''">
- <xsl:text>
 </xsl:text>
- <xs:element>
-
- <xsl:attribute name="name">
- <xsl:value-of select="@name"/>
- </xsl:attribute>
- <xsl:attribute name="type">
- <xsl:value-of select="concat('xp5__default_db__',$nazwa,':',@name)"/>
- </xsl:attribute>
- <xsl:attribute name="default">
- <xsl:value-of select="@default"/>
- </xsl:attribute>
- </xs:element>
- </xsl:if>
- </xsl:for-each>
- <xsl:text>
 </xsl:text>
- </xs:sequence>
- </xs:complexType>
- </xs:schema>
- </xsl:if>
-
-
- </xsl:template>
-
- </xsl:stylesheet>
|