p5dkp.to.dtd.xsl 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:p5dkp="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd"
  6. exclude-result-prefixes="xs xsi p5dkp"
  7. version="2.0">
  8. <xsl:output indent="yes"/>
  9. <xsl:strip-space elements="*"/>
  10. <xsl:param name="basedir"/>
  11. <xsl:include href="p5dkp.ditafiles.func.isditafile.xsl"/>
  12. <xsl:template match="p5dkp:ditafiles.xml" mode="p5dkp:to.dtd.xml">
  13. <p5dkp:to.dtd.xml>
  14. <xsl:message>#15 started p5dkp:to.dtd.xml</xsl:message>
  15. <xsl:for-each-group select="//p5dkp:ditafiles.file" group-by="@p5dkp:true.path">
  16. <xsl:copy copy-namespaces="no">
  17. <xsl:copy-of select="@p5dkp:true.path"/>
  18. <xsl:copy-of select="@xsi:noNamespaceSchemaLocation"/>
  19. <xsl:choose>
  20. <xsl:when test="not(p5dkp:ditafiles.func.isditafile(@p5dkp:true.path))">
  21. <xsl:message>#22 not(p5dkp:ditafiles.func.isditafile(<xsl:value-of select="@p5dkp:true.path"/>))</xsl:message>
  22. </xsl:when>
  23. <xsl:when test="doc-available(@p5dkp:true.path)" >
  24. <xsl:message>#22 testing <xsl:value-of select="@p5dkp:true.path"/>; </xsl:message>
  25. <xsl:apply-templates mode="p5dkp:to.dtd" select="doc(@p5dkp:true.path)">
  26. <xsl:with-param name="p5dkp:true.path" select="@p5dkp:true.path"/>
  27. </xsl:apply-templates>
  28. </xsl:when>
  29. <xsl:otherwise>
  30. <doc-unaviable-available p5dkp:true.path="{@p5dkp:true.path}"/>
  31. </xsl:otherwise>
  32. </xsl:choose>
  33. </xsl:copy>
  34. </xsl:for-each-group>
  35. </p5dkp:to.dtd.xml>
  36. </xsl:template>
  37. <xsl:template mode="p5dkp:to.dtd.confirm.MacroDef.xml" match="p5dkp:to.dtd.xml">
  38. <project basedir="{$basedir}" name="p5dkp.to.dtd.confirm.MacroDef.xml" default="p5dkp.to.dtd.confirm.MacroDef.xml"> <!-- object_merge_ant_object.merge.try.build.xml -->
  39. <!--<include file="{$object_modeling_new.build.xml}" as="object_modeling_new"/>
  40. <include file="{$object_merge_ant_object.build.xml}" as="object_merge_ant_object"/>-->
  41. <macrodef name="p5dkptodtdconfirmMacroDef">
  42. <attribute name="srcfile"/>
  43. <attribute name="dstfile" />
  44. <sequential>
  45. <move verbose="yes" failonerror="false">
  46. <xsl:attribute name="file">@{srcfile}</xsl:attribute>
  47. <xsl:attribute name="tofile">@{dstfile}</xsl:attribute>
  48. </move>
  49. </sequential>
  50. </macrodef>
  51. <target name="p5dkp.to.dtd.confirm.MacroDef.xml">
  52. <!--<p5dkptodtdconfirmMacroDef>-->
  53. <xsl:for-each select="p5dkp:ditafiles.file[p5dkp:to.dtd]">
  54. <p5dkptodtdconfirmMacroDef srcfile="{p5dkp:to.dtd/@fixed_to.dtd}" dstfile="{p5dkp:to.dtd/@p5dkp:true.path}" />
  55. </xsl:for-each>
  56. <!--</p5dkptodtdconfirmMacroDef>-->
  57. </target>
  58. </project>
  59. </xsl:template>
  60. <xsl:template match="*[ not(@xsi:noNamespaceSchemaLocation)]" mode="p5dkp:to.dtd">
  61. <xsl:param name="p5dkp:true.path" required="yes"/>
  62. <xsl:message >#45 not matched name = <xsl:value-of select="name()"/></xsl:message>
  63. <p5dkp:to.dtd.not_fixed>
  64. <xsl:attribute name="p5dkp:true.path" select="$p5dkp:true.path"/>
  65. </p5dkp:to.dtd.not_fixed>
  66. </xsl:template>
  67. <xsl:template match="node()[ name() = 'map' and @xsi:noNamespaceSchemaLocation]" mode="p5dkp:to.dtd">
  68. <xsl:param name="p5dkp:true.path" required="yes"/>
  69. <xsl:message >#300 matched name = <xsl:value-of select="name()"/> and saved to <xsl:value-of select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/></xsl:message>
  70. <p5dkp:to.dtd>
  71. <xsl:attribute name="p5dkp:true.path" select="$p5dkp:true.path"/>
  72. <xsl:attribute name="fixed_to.dtd" select="concat($p5dkp:true.path,'.fixed_to.dtd')"/>
  73. </p5dkp:to.dtd>
  74. <xsl:result-document href="{$p5dkp:true.path}.fixed_to.dtd.xml" doctype-public="-//OASIS//DTD DITA Map//EN" doctype-system="map.dtd">
  75. <xsl:copy copy-namespaces="no">
  76. <xsl:apply-templates select="@*" mode="p5dkp:to.dtd.child"/>
  77. <xsl:apply-templates mode="p5dkp:to.dtd.child"/>
  78. </xsl:copy>
  79. </xsl:result-document>
  80. </xsl:template>
  81. <xsl:template mode="p5dkp:to.dtd" match="*|text()|comment()"/>
  82. <xsl:template match="@*" mode="p5dkp:to.dtd.child">
  83. <xsl:copy-of select="."/>
  84. </xsl:template>
  85. <xsl:template match="@xsi:noNamespaceSchemaLocation" mode="p5dkp:to.dtd.child"/>
  86. <xsl:template match="*|text()|comment()" mode="p5dkp:to.dtd.child">
  87. <xsl:copy-of select="." copy-namespaces="no"/>
  88. </xsl:template>
  89. <xsl:template match="node()[ name() = 'topic' and @xsi:noNamespaceSchemaLocation]" mode="p5dkp:to.dtd">
  90. <xsl:param name="p5dkp:true.path" required="yes"/>
  91. <p5dkp:to.dtd>
  92. <xsl:attribute name="p5dkp:true.path" select="$p5dkp:true.path"/>
  93. <xsl:attribute name="fixed_to.dtd" select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/>
  94. </p5dkp:to.dtd>
  95. <xsl:message >#300 matched name = <xsl:value-of select="name()"/> and saved to <xsl:value-of select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/></xsl:message>
  96. <xsl:result-document href="{$p5dkp:true.path}.fixed_to.dtd" doctype-public="-//OASIS//DTD DITA Topic//EN" doctype-system="topic.dtd">
  97. <xsl:copy copy-namespaces="no">
  98. <xsl:apply-templates select="@*" mode="p5dkp:to.dtd.child"/>
  99. <xsl:apply-templates mode="p5dkp:to.dtd.child"/>
  100. </xsl:copy>
  101. </xsl:result-document>
  102. </xsl:template>
  103. <xsl:template match="node()[ name() = 'glossgroup' and @xsi:noNamespaceSchemaLocation]" mode="p5dkp:to.dtd">
  104. <xsl:param name="p5dkp:true.path" required="yes"/>
  105. <p5dkp:to.dtd>
  106. <xsl:attribute name="p5dkp:true.path" select="$p5dkp:true.path"/>
  107. <xsl:attribute name="fixed_to.dtd" select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/>
  108. </p5dkp:to.dtd>
  109. <xsl:message >#300 matched name = <xsl:value-of select="name()"/> and saved to <xsl:value-of select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/></xsl:message>
  110. <xsl:result-document href="{$p5dkp:true.path}.fixed_to.dtd" doctype-public="-//OASIS//DTD DITA Glossary Group//EN" doctype-system="glossgroup.dtd">
  111. <xsl:copy copy-namespaces="no">
  112. <xsl:apply-templates select="@*" mode="p5dkp:to.dtd.child"/>
  113. <xsl:apply-templates mode="p5dkp:to.dtd.child"/>
  114. </xsl:copy>
  115. </xsl:result-document>
  116. </xsl:template>
  117. <xsl:template match="node()[ name() = 'glossentry' and @xsi:noNamespaceSchemaLocation]" mode="p5dkp:to.dtd">
  118. <xsl:param name="p5dkp:true.path" required="yes"/>
  119. <p5dkp:to.dtd>
  120. <xsl:attribute name="p5dkp:true.path" select="$p5dkp:true.path"/>
  121. <xsl:attribute name="fixed_to.dtd" select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/>
  122. </p5dkp:to.dtd>
  123. <xsl:message >#300 matched name = <xsl:value-of select="name()"/> and saved to <xsl:value-of select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/></xsl:message>
  124. <xsl:result-document href="{$p5dkp:true.path}.fixed_to.dtd" doctype-public="-//OASIS//DTD DITA Glossary//EN" doctype-system="glossary.dtd">
  125. <xsl:copy copy-namespaces="no">
  126. <xsl:apply-templates select="@*" mode="p5dkp:to.dtd.child"/>
  127. <xsl:apply-templates mode="p5dkp:to.dtd.child"/>
  128. </xsl:copy>
  129. </xsl:result-document>
  130. </xsl:template>
  131. <xsl:template match="node()[ name() = 'concept' and @xsi:noNamespaceSchemaLocation]" mode="p5dkp:to.dtd">
  132. <xsl:param name="p5dkp:true.path" required="yes"/>
  133. <p5dkp:to.dtd>
  134. <xsl:attribute name="p5dkp:true.path" select="$p5dkp:true.path"/>
  135. <xsl:attribute name="fixed_to.dtd" select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/>
  136. </p5dkp:to.dtd>
  137. <xsl:message >#300 matched name = <xsl:value-of select="name()"/></xsl:message>
  138. <xsl:result-document href="{$p5dkp:true.path}.fixed_to.dtd" doctype-public="-//OASIS//DTD DITA Concept//EN" doctype-system="concept.dtd">
  139. <xsl:copy copy-namespaces="no">
  140. <xsl:apply-templates select="@*" mode="p5dkp:to.dtd.child"/>
  141. <xsl:apply-templates mode="p5dkp:to.dtd.child"/>
  142. </xsl:copy>
  143. </xsl:result-document>
  144. </xsl:template>
  145. <xsl:template match="node()[ name() = 'reference' and @xsi:noNamespaceSchemaLocation]" mode="p5dkp:to.dtd">
  146. <xsl:param name="p5dkp:true.path" required="yes"/>
  147. <p5dkp:to.dtd>
  148. <xsl:attribute name="p5dkp:true.path" select="$p5dkp:true.path"/>
  149. <xsl:attribute name="fixed_to.dtd" select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/>
  150. </p5dkp:to.dtd>
  151. <xsl:message >#300 matched name = <xsl:value-of select="name()"/> and saved to <xsl:value-of select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/></xsl:message>
  152. <xsl:result-document href="{$p5dkp:true.path}.fixed_to.dtd" doctype-public="-//OASIS//DTD DITA Reference//EN" doctype-system="reference.dtd">
  153. <xsl:copy copy-namespaces="no">
  154. <xsl:apply-templates select="@*" mode="p5dkp:to.dtd.child"/>
  155. <xsl:apply-templates mode="p5dkp:to.dtd.child"/>
  156. </xsl:copy>
  157. </xsl:result-document>
  158. </xsl:template>
  159. <xsl:template match="node()[ name() = 'task' and @xsi:noNamespaceSchemaLocation]" mode="p5dkp:to.dtd">
  160. <xsl:param name="p5dkp:true.path" required="yes"/>
  161. <p5dkp:to.dtd>
  162. <xsl:attribute name="p5dkp:true.path" select="$p5dkp:true.path"/>
  163. <xsl:attribute name="fixed_to.dtd" select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/>
  164. </p5dkp:to.dtd>
  165. <xsl:message >#300 matched name = <xsl:value-of select="name()"/> and saved to <xsl:value-of select="concat($p5dkp:true.path,'.fixed_to.dtd.xml')"/></xsl:message>
  166. <xsl:result-document href="{$p5dkp:true.path}.fixed_to.dtd" doctype-public="-//OASIS//DTD DITA Task//EN" doctype-system="task.dtd">
  167. <xsl:copy copy-namespaces="no">
  168. <xsl:apply-templates select="@*" mode="p5dkp:to.dtd.child"/>
  169. <xsl:apply-templates mode="p5dkp:to.dtd.child"/>
  170. </xsl:copy>
  171. </xsl:result-document>
  172. </xsl:template>
  173. </xsl:stylesheet>