d2a.new_ant_project.child.task.xsl 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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:p5dkp="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd"
  5. xmlns:p5bws="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/WPS_Functions.xsd"
  6. xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
  7. xmlns:d2a="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita-to-ant/d2a.xsd"
  8. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. xmlns:p5ant="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache.public/ant/ant.xsd"
  10. xmlns:p5dg="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/documentation_generator/documentation_generator.xsd"
  11. xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
  12. exclude-result-prefixes="xs d2a"
  13. version="2.0">
  14. <xsl:include href="d2a.new_ant_project.child.task.bash.xsl"/>
  15. <xsl:output indent="yes"/>
  16. <xsl:strip-space elements="*"/>
  17. <xsl:template match="steps" mode="d2a:new_ant_project.child.task">
  18. <xsl:param name="p5dkp:ditafiles.xml" required="yes"/>
  19. <xsl:apply-templates mode="#current">
  20. <xsl:with-param name="p5dkp:ditafiles.xml" select="$p5dkp:ditafiles.xml"/>
  21. </xsl:apply-templates>
  22. </xsl:template>
  23. <xsl:function name="d2a:p5ant.executable"><!-- detect executable -->
  24. <xsl:param name="p5dkp:ditafiles.xml"/>
  25. <xsl:param name="ditaarch:apiname"/>
  26. <xsl:choose>
  27. <xsl:when test="$ditaarch:apiname/@keyref">${<xsl:value-of select="$ditaarch:apiname/@keyref"/>}</xsl:when><!-- <xsl:copy-of select="d2a:keyref($p5dkp:ditafiles.xml/ancestor-or-self::*/descendant-or-self::*,$ditaarch:apiname/@keyref)" copy-namespaces="no"/> -->
  28. <xsl:when test="$ditaarch:apiname/text()"><xsl:value-of select="$ditaarch:apiname/text()"/></xsl:when>
  29. <xsl:otherwise><xsl:message terminate="yes">#36 ditaarch:apiname not contains @keyref nor text() - we do not know what to execute </xsl:message></xsl:otherwise>
  30. </xsl:choose>
  31. </xsl:function>
  32. <xsl:function name="d2a:p5ant.executable.dir"><!-- detect dir -->
  33. <xsl:param name="p5dkp:ditafiles.xml"/>
  34. <xsl:param name="ditaarch:step"/>
  35. <xsl:message>#45-A d2a:p5ant.executable.dir name()/<xsl:value-of select="$ditaarch:step/name()"/> cmd $ditaarch:step/stepresult/filepath/text() = <xsl:value-of select="$ditaarch:step/step/stepresult/filepath/text()"/> </xsl:message>
  36. <xsl:choose>
  37. <xsl:when test="$ditaarch:step/step/cmd/apiname and $ditaarch:step/step/stepresult/filepath/text()">
  38. <xsl:message>#45 d2a:p5ant.executable.dir cmd localtext </xsl:message>
  39. <xsl:copy-of select="$ditaarch:step/step/stepresult/filepath/text()" copy-namespaces="no"/></xsl:when>
  40. <xsl:when test="$ditaarch:step/step/cmd/apiname and $ditaarch:step/step/stepresult/@keyref"><xsl:copy-of select="d2a:keyref($p5dkp:ditafiles.xml/ancestor-or-self::*/descendant-or-self::*,$ditaarch:step/step/stepresult/@keyref)" copy-namespaces="no"/></xsl:when>
  41. <xsl:otherwise><xsl:copy-of select="d2a:ditamap.INPUT.basedir.xmlatt.ref('dir')" copy-namespaces="no"/></xsl:otherwise>
  42. </xsl:choose>
  43. </xsl:function>
  44. <xsl:template match="step" mode="d2a:new_ant_project.child.task">
  45. <xsl:param name="p5dkp:ditafiles.xml" required="yes"/>
  46. <xsl:variable name="d2a:p5ant.executable.dir.priority" select="d2a:p5ant.executable.dir($p5dkp:ditafiles.xml,current())"/>
  47. <target name="default"> <!-- step_{generate-id()} -->
  48. <xsl:choose>
  49. <xsl:when test="cmd/apiname/@keyref='platform.shell.bash.platform_no'">
  50. <xsl:message>#26 todo detect method by relations analysys</xsl:message>
  51. <xsl:apply-templates mode="d2a:new_ant_project.child.task.bash">
  52. <xsl:with-param name="p5dkp:ditafiles.xml" select="$p5dkp:ditafiles.xml"/>
  53. <xsl:with-param name="d2a:p5ant.executable.dir.priority" select="$d2a:p5ant.executable.dir.priority"/>
  54. </xsl:apply-templates>
  55. </xsl:when>
  56. <xsl:when test="contains(d2a:keyref($p5dkp:ditafiles.xml/ancestor-or-self::*/descendant-or-self::*,cmd/apiname/@keyref),'shell.bash.dita')">
  57. <xsl:message>#26-A todo detect method by relations analysys</xsl:message>
  58. <xsl:apply-templates mode="d2a:new_ant_project.child.task.bash">
  59. <xsl:with-param name="p5dkp:ditafiles.xml" select="$p5dkp:ditafiles.xml"/>
  60. <xsl:with-param name="d2a:p5ant.executable.dir.priority" select="$d2a:p5ant.executable.dir.priority"/>
  61. </xsl:apply-templates>
  62. </xsl:when>
  63. <xsl:when test="cmd/apiname">
  64. <xsl:message>#26-B todo using exec associated key reference cmd/apiname = <xsl:value-of select="cmd/apiname/@keyref"/> = forcing then = <xsl:value-of select="d2a:p5ant.executable($p5dkp:ditafiles.xml,cmd/apiname)"/></xsl:message>
  65. <xsl:apply-templates mode="d2a:new_ant_project.child.task.bash">
  66. <xsl:with-param name="p5dkp:ditafiles.xml" select="$p5dkp:ditafiles.xml"/>
  67. <xsl:with-param name="d2a:p5ant.executable.priority" select="d2a:p5ant.executable($p5dkp:ditafiles.xml,cmd/apiname)"/>
  68. <xsl:with-param name="d2a:p5ant.executable.dir.priority" select="$d2a:p5ant.executable.dir.priority"/>
  69. </xsl:apply-templates>
  70. </xsl:when>
  71. <xsl:otherwise>
  72. <xsl:message terminate="yes">#38 UNSUPPORTED cmd/apiname/@keyref='<xsl:value-of select="cmd/apiname/@keyref"/>'.
  73. Now working @keyref=platform.shell.bash.platform_no
  74. </xsl:message>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. <!--<DEBUG29>
  78. <xsl:apply-templates mode="#current">
  79. <xsl:with-param name="p5dkp:ditafiles.xml" select="$p5dkp:ditafiles.xml"/>
  80. </xsl:apply-templates>
  81. </DEBUG29>-->
  82. </target>
  83. </xsl:template>
  84. <xsl:template match="cmd" mode="d2a:new_ant_project.child.task_XXXX">
  85. <xsl:param name="p5dkp:ditafiles.xml" required="yes"/>
  86. <xsl:comment>#34 cmd</xsl:comment>
  87. <xsl:apply-templates mode="#current">
  88. <xsl:with-param name="p5dkp:ditafiles.xml" select="$p5dkp:ditafiles.xml"/>
  89. </xsl:apply-templates>
  90. </xsl:template>
  91. <xsl:template match="apiname[@keyref]" mode="d2a:new_ant_project.child.task_XXXX">
  92. <xsl:param name="p5dkp:ditafiles.xml" required="yes"/>
  93. <xsl:copy copy-namespaces="no">
  94. <xsl:copy-of select="@*"/>
  95. <resolve_keyref><xsl:copy-of select="d2a:keyref($p5dkp:ditafiles.xml/ancestor-or-self::*/descendant-or-self::*,@keyref)"/>
  96. <test>
  97. <xsl:for-each select="$p5dkp:ditafiles.xml/ancestor-or-self::*">
  98. <ancestor name="{name()}">
  99. <xsl:for-each select="descendant-or-self::*">
  100. <descdend name="{name()}">
  101. <xsl:choose>
  102. <xsl:when test="map.keys.eval[keys[@map.keys.eval='platform.shell.bash.platform_no']]">
  103. <HURRA></HURRA>
  104. </xsl:when>
  105. </xsl:choose>
  106. </descdend>
  107. </xsl:for-each>
  108. </ancestor>
  109. </xsl:for-each>
  110. </test>
  111. </resolve_keyref>
  112. </xsl:copy>
  113. </xsl:template>
  114. </xsl:stylesheet>