p5dkp.entities.submodel.xsl 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:p5bws="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/WPS_Functions.xsd"
  5. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  6. xmlns:p5dkp="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd"
  7. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  8. xmlns:p5suis="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/system_ui_info_speech/system_ui_info_speech.xsd"
  9. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  10. xmlns:p5xsda="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/xsd_asserts/p5xsda.xsd"
  11. xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
  12. xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
  13. xmlns:p5dkp.entities-generated="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.entities-generated.xsd"
  14. xmlns:p5dkp.entities.submodel="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.entities.submodel.xsd"
  15. xmlns:p5dkp.entities="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.entities.xsd"
  16. xmlns:p5dkp-er="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.entities-relations.xsd"
  17. xmlns:p5frc="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/flat_relation_cache/p5frc.xsd"
  18. exclude-result-prefixes="xs ditaarch"
  19. version="2.0">
  20. <!-- Do robienia modelu cechy i jego obslugiwania w systemie -->
  21. <!-- template to generate from p5dkp.entities.XXXX.xsd
  22. and controll them
  23. -->
  24. <xsl:include href="p5dkp.entities.param.xsl"/>
  25. <xsl:output indent="yes" method="xml" exclude-result-prefixes="ditaarch"/>
  26. <!--<xsl:output indent="yes" method="xml" standalone="no" doctype-public="-//OASIS//DTD DITA Glossary Group//EN" doctype-system="glossgroup.dtd"/>-->
  27. <xsl:strip-space elements="*"/>
  28. <!--<xsl:param name="p5dkp.entities:xsd" required="yes"/>-->
  29. <!--<xsl:param name="p5dkp.repository" required="yes"/>--> <!-- will output there -->
  30. <!--<xsl:param name="p5dkp.entities-generated:xsd" required="yes"/>-->
  31. <!--<xsl:param name="p5dkp.entities-generated.xsd.p5frc.build_complexType.xml" required="yes"/>-->
  32. <!--<xsl:param name="p5dkp-er:xsd" required="yes"/>-->
  33. <xsl:param name="p5dkp.entities.submodel:specialize.entity.name"/><!-- np prio -->
  34. <xsl:param name="p5dkp.entities.submodel:specialize.entity.model" select="concat('entities.',$p5dkp.entities.submodel:specialize.entity.name)"/><!-- np entities.basic domyslnie .name -->
  35. <xsl:param name="p5dkp.entities.submodel:specialize.entity.simpleType" select="'xs:string'"/> <!-- like xs:string -->
  36. <xsl:param name="p5dkp.entities.submodel:specialize.entity.derive"/> <!-- np. dla potrzeb specjalizacji -->
  37. <xsl:param name="p5dkp.entities.submodel:specialize.entity.pointer"/> <!-- TODO np. dla potrzeb do czego dane entity-->
  38. <xsl:param name="p5dkp.entities.submodel:specialize.entity.prefix" select="p5dkp.entities.submodel:specialize.entity.prefix($p5dkp.entities:prefix,$p5dkp.entities.submodel:specialize.entity.name)"/>
  39. <xsl:param name="p5dkp.entities.submodel:specialize.entity.targetNamespace" select="p5dkp.entities.submodel:specialize.entity.targetNamespace($p5dkp.entities:targetNamespace,$p5dkp.entities.submodel:specialize.entity.name)"/>
  40. <xsl:param name="p5dkp.entities.submodel:specialize.entity.name.complexType" select="p5dkp.entities.submodel:specialize.entity.name.complexType($p5dkp.entities.submodel:specialize.entity.name)"/><!-- np entities__x3A___prio -->
  41. <!--<xsl:include href="p5dkp.entities-generated.functions.xsl"/>-->
  42. <!--<xsl:include href="../flat_relation_cache/p5frc.build_complexType.xsl"/>-->
  43. <xsl:function name="p5dkp.entities.submodel:specialize.entity.name.complexType">
  44. <xsl:param name="p5dkp.entities.submodel:specialize.entity.name"/>
  45. <xsl:value-of select="concat('entities__x3A___',$p5dkp.entities.submodel:specialize.entity.name)"/>
  46. </xsl:function>
  47. <xsl:function name="p5dkp.entities.submodel:specialize.entity.prefix">
  48. <xsl:param name="p5dkp.entities:prefix"/>
  49. <xsl:param name="p5dkp.entities.submodel:specialize.entity.name"/>
  50. <xsl:value-of select="concat($p5dkp.entities:prefix,'.',$p5dkp.entities.submodel:specialize.entity.name)"/>
  51. </xsl:function>
  52. <xsl:function name="p5dkp.entities.submodel:specialize.entity.targetNamespace">
  53. <xsl:param name="p5dkp.entities:targetNamespace"/>
  54. <xsl:param name="p5dkp.entities.submodel:specialize.entity.name"/>
  55. <xsl:value-of select="concat(replace($p5dkp.entities:targetNamespace,'(.xsd$)',''),'.',$p5dkp.entities.submodel:specialize.entity.name,'.xsd')"/>
  56. </xsl:function>
  57. <!-- {http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.entities.submodel.xsd}specialize -->
  58. <xsl:template mode="p5dkp.entities.submodel:specialize p5dkp.entities.submodel:specialize.complexType p5dkp.entities.submodel:specialize.simpleType p5dkp.entities.submodel:specialize.documentation p5dkp.entities.submodel:specialize.group.model p5dkp.entities.submodel:specialize.group.entities" match="*|text()|comment()" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  59. <xsl:template mode="p5dkp.entities.submodel:specialize" match="schema" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  60. <xs:schema>
  61. <xsl:namespace name="{$p5dkp.entities.submodel:specialize.entity.prefix}" select="$p5dkp.entities.submodel:specialize.entity.targetNamespace"/>
  62. <xsl:copy-of select="namespace::*" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  63. <xsl:copy-of select="@vc:minVersion"/>
  64. <xsl:attribute name="targetNamespace" select="$p5dkp.entities.submodel:specialize.entity.targetNamespace"/>
  65. <xsl:call-template name="p5dkp.entities.submodel:specialize.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  66. <xsl:call-template name="p5dkp.entities.submodel:specialize.complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  67. <xsl:call-template name="p5dkp.entities.submodel:specialize.group.model" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  68. <xsl:call-template name="p5dkp.entities.submodel:specialize.group.entities" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  69. </xs:schema>
  70. </xsl:template>
  71. <xsl:template name="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  72. <xsl:param name="force.documentation" select="'Generated by p5dkp.entities.submodel:specialize'"/>
  73. <xsl:choose>
  74. <xsl:when test="annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  75. <xsl:apply-templates mode="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  76. <xsl:with-param name="force.documentation" select="$force.documentation"/>
  77. </xsl:apply-templates>
  78. </xsl:when>
  79. <xsl:otherwise>
  80. <xs:annotation>
  81. <xs:documentation><xsl:value-of select="$force.documentation"/></xs:documentation>
  82. </xs:annotation>
  83. </xsl:otherwise>
  84. </xsl:choose>
  85. </xsl:template>
  86. <xsl:template match="annotation" mode="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  87. <xsl:param name="force.documentation" select="'Generated by p5dkp.entities.submodel:specialize'"/>
  88. <xsl:copy>
  89. <xsl:copy-of select="@*"/>
  90. <xs:documentation><xsl:value-of select="$force.documentation"/></xs:documentation>
  91. <xsl:apply-templates mode="#current" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  92. </xsl:copy>
  93. </xsl:template>
  94. <xsl:template match="documentation" mode="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  95. <xsl:template name="p5dkp.entities.submodel:specialize.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  96. <xsl:choose>
  97. <xsl:when test="simpleType[@name=$p5dkp.entities.submodel:specialize.entity.name]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  98. <xsl:apply-templates mode="p5dkp.entities.submodel:specialize.simpleType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  99. </xsl:when>
  100. <xsl:otherwise>
  101. <xs:simpleType name="{$p5dkp.entities.submodel:specialize.entity.name}">
  102. <xsl:attribute name="id" select="concat($p5dkp.entities.submodel:specialize.entity.name,'_',generate-id())"/>
  103. <xsl:call-template name="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  104. <xs:restriction base="{$p5dkp.entities.submodel:specialize.entity.simpleType}"/>
  105. </xs:simpleType>
  106. </xsl:otherwise>
  107. </xsl:choose>
  108. </xsl:template>
  109. <xsl:template mode="p5dkp.entities.submodel:clean_id" match="@*" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  110. <xsl:copy-of select="."/>
  111. </xsl:template>
  112. <xsl:template mode="p5dkp.entities.submodel:clean_id" match="@id" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  113. <xsl:template mode="p5dkp.entities.submodel:specialize.simpleType" match="simpleType[@name=$p5dkp.entities.submodel:specialize.entity.name]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  114. <xsl:copy>
  115. <xsl:attribute name="id" select="concat(@name,'_',generate-id())"/>
  116. <xsl:apply-templates select="@*" mode="p5dkp.entities.submodel:clean_id" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  117. <xsl:call-template name="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  118. <xs:restriction base="{$p5dkp.entities.submodel:specialize.entity.simpleType}"/>
  119. </xsl:copy>
  120. </xsl:template>
  121. <xsl:template name="p5dkp.entities.submodel:specialize.complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  122. <xsl:choose>
  123. <xsl:when test="complexType[@name=$p5dkp.entities.submodel:specialize.entity.name.complexType]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  124. <xsl:apply-templates mode="p5dkp.entities.submodel:specialize.complexType" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  125. </xsl:when>
  126. <xsl:otherwise>
  127. <xs:complexType name="{$p5dkp.entities.submodel:specialize.entity.name.complexType}">
  128. <xsl:call-template name="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  129. <xs:simpleContent>
  130. <xs:extension base="{$p5dkp.entities.submodel:specialize.entity.prefix}:{$p5dkp.entities.submodel:specialize.entity.name}"/>
  131. </xs:simpleContent>
  132. </xs:complexType>
  133. </xsl:otherwise>
  134. </xsl:choose>
  135. </xsl:template>
  136. <xsl:template mode="p5dkp.entities.submodel:specialize.complexType" match="complexType[@name=$p5dkp.entities.submodel:specialize.entity.name.complexType]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  137. <xsl:copy>
  138. <xsl:attribute name="id" select="concat(@name,'_',generate-id())"/>
  139. <xsl:apply-templates select="@*" mode="p5dkp.entities.submodel:clean_id" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  140. <xs:simpleContent>
  141. <xs:extension base="{$p5dkp.entities.submodel:specialize.entity.prefix}:{$p5dkp.entities.submodel:specialize.entity.name}"/>
  142. </xs:simpleContent>
  143. </xsl:copy>
  144. </xsl:template>
  145. <xsl:template name="p5dkp.entities.submodel:specialize.group.model" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  146. <xsl:choose>
  147. <xsl:when test="group[@name=$p5dkp.entities.submodel:specialize.entity.model]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  148. <xsl:apply-templates mode="p5dkp.entities.submodel:specialize.group.model" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  149. </xsl:when>
  150. <xsl:otherwise>
  151. <xs:group name="{$p5dkp.entities.submodel:specialize.entity.name}">
  152. <xsl:attribute name="id" select="concat($p5dkp.entities.submodel:specialize.entity.prefix,'_',generate-id())"/>
  153. <xsl:call-template name="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  154. <xs:sequence>
  155. <xs:element minOccurs="0" name="{$p5dkp.entities.submodel:specialize.entity.name}" type="{$p5dkp.entities.submodel:specialize.entity.prefix}:{$p5dkp.entities.submodel:specialize.entity.name.complexType}">
  156. <xsl:attribute name="id" select="concat($p5dkp.entities.submodel:specialize.entity.prefix,'_a_',generate-id())"/>
  157. </xs:element>
  158. </xs:sequence>
  159. </xs:group>
  160. </xsl:otherwise>
  161. </xsl:choose>
  162. </xsl:template>
  163. <xsl:template mode="p5dkp.entities.submodel:specialize.group.model" match="group[@name=$p5dkp.entities.submodel:specialize.entity.model]" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  164. <xsl:copy>
  165. <xsl:attribute name="id" select="concat($p5dkp.entities.submodel:specialize.entity.prefix,'_',generate-id())"/>
  166. <xsl:apply-templates select="@*" mode="p5dkp.entities.submodel:clean_id" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  167. <xs:complexContent>
  168. <xs:extension base="{$p5dkp.entities.submodel:specialize.entity.prefix}:{$p5dkp.entities.submodel:specialize.entity.name}"/>
  169. </xs:complexContent>
  170. </xsl:copy>
  171. </xsl:template>
  172. <xsl:template name="p5dkp.entities.submodel:specialize.group.entities" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  173. <xsl:choose>
  174. <xsl:when test="group[@name='entities']" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  175. <xsl:apply-templates mode="p5dkp.entities.submodel:specialize.group.entities" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  176. </xsl:when>
  177. <xsl:otherwise>
  178. <xs:group name="entities">
  179. <xsl:attribute name="id" select="concat($p5dkp.entities.submodel:specialize.entity.prefix,'_',generate-id())"/>
  180. <xsl:call-template name="p5dkp.entities.submodel:specialize.annotation" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  181. <xs:sequence>
  182. <xsl:attribute name="id" select="concat($p5dkp.entities.submodel:specialize.entity.prefix,'_',generate-id())"/>
  183. <xs:complexContent>
  184. <xs:extension base="{$p5dkp.entities.submodel:specialize.entity.prefix}:{$p5dkp.entities.submodel:specialize.entity.name}"/>
  185. </xs:complexContent>
  186. </xs:sequence>
  187. </xs:group>
  188. </xsl:otherwise>
  189. </xsl:choose>
  190. </xsl:template>
  191. <xsl:template mode="p5dkp.entities.submodel:specialize.group.entities" match="group[@name='entities']" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
  192. <xsl:copy>
  193. <xsl:attribute name="id" select="concat($p5dkp.entities.submodel:specialize.entity.prefix,'_',generate-id())"/>
  194. <xsl:apply-templates select="@*" mode="p5dkp.entities.submodel:clean_id" xpath-default-namespace="http://www.w3.org/2001/XMLSchema"/>
  195. <xs:sequence>
  196. <xs:group ref="{$p5dkp.entities.submodel:specialize.entity.prefix}:{$p5dkp.entities.submodel:specialize.entity.name}"/>
  197. </xs:sequence>
  198. </xsl:copy>
  199. </xsl:template>
  200. </xsl:stylesheet>