graph.graph-to-analyze-evaluated.xsl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. exclude-result-prefixes="xs"
  5. xmlns:graph="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/graph/graph.xsd"
  6. xmlns:p5dg="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/documentation_generator/documentation_generator.xsd"
  7. version="2.0">
  8. <xsl:output indent="yes"/>
  9. <xsl:strip-space elements="*"/>
  10. <!--<xsl:include href="graph.graph-to-analyze-evaluated.func.xsl"/>-->
  11. <xsl:param name="graph.graph-to-analyze-property.xml" required="yes"/>
  12. <xsl:variable name="graph:graph.graph-to-analyze-property.xml" select="doc($graph.graph-to-analyze-property.xml)"/>
  13. <xsl:template match="graph:graph.graph-to-analyze.xml" mode="graph:graph-to-analyze-evaluated.xml">
  14. <graph:graph-to-analyze-evaluated.xml>
  15. <xsl:copy-of select="@*"/>
  16. <xsl:apply-templates mode="#current"/>
  17. </graph:graph-to-analyze-evaluated.xml>
  18. </xsl:template>
  19. <xsl:template match="*" mode="graph:graph-to-analyze-evaluated.xml">
  20. <xsl:copy copy-namespaces="no">
  21. <xsl:apply-templates mode="graph:graph-to-analyze-evaluated.xml" select="@*"/>
  22. <xsl:apply-templates mode="#current"/>
  23. </xsl:copy>
  24. </xsl:template>
  25. <xsl:template match="@*" mode="graph:graph-to-analyze-evaluated.xml">
  26. <xsl:copy-of select="."/>
  27. </xsl:template>
  28. <xsl:template match="@value[ contains(.,'${')]|@location[ contains(.,'${')]" mode="graph:graph-to-analyze-evaluated.xml">
  29. <xsl:attribute name="{name()}" select="$graph:graph.graph-to-analyze-property.xml//property[@name = current()/../@name][1]/@graph:property.evaluated"/>
  30. <xsl:attribute name="graph:value-evaluated-from" select="."/>
  31. </xsl:template>
  32. <!--
  33. <xsl:template match="@destdir[ contains(.,'${') and ancestor-or-self::target]" mode="graph:graph-to-analyze-evaluated.xml">
  34. <!-\-<xsl:attribute name="{name()}" select="$graph:graph.graph-to-analyze-property.xml//property[@name = graph:graph-to-analyze-evaluated.property(current())][1]/@graph:property.evaluated"/>-\->
  35. <xsl:attribute name="{name()}" select="graph:graph-to-analyze-evaluated.property(.)"/>
  36. <xsl:attribute name="graph:value-evaluated-from" select="."/>
  37. </xsl:template>
  38. <xsl:template match="@file[ contains(.,'${') and ancestor-or-self::target]" mode="graph:graph-to-analyze-evaluated.xml">
  39. <!-\-<xsl:attribute name="{name()}" select="$graph:graph.graph-to-analyze-property.xml//property[@name = graph:graph-to-analyze-evaluated.property(current())][1]/@graph:property.evaluated"/>-\->
  40. <xsl:attribute name="{name()}" select="graph:graph-to-analyze-evaluated.property(.)"/>
  41. <xsl:attribute name="graph:value-evaluated-from" select="."/>
  42. </xsl:template>
  43. <xsl:template match="@tofile[ contains(.,'${') and ancestor-or-self::target]" mode="graph:graph-to-analyze-evaluated.xml">
  44. <!-\-<xsl:attribute name="{name()}" select="$graph:graph.graph-to-analyze-property.xml//property[@name = graph:graph-to-analyze-evaluated.property(current())][1]/@graph:property.evaluated"/>-\->
  45. <xsl:attribute name="{name()}" select="graph:graph-to-analyze-evaluated.property(.)"/>
  46. <xsl:attribute name="graph:value-evaluated-from" select="."/>
  47. </xsl:template>-->
  48. <xsl:function name="graph:graph-to-analyze-evaluated.property">
  49. <xsl:param name="graph:property.eval"/>
  50. <!--<graph:graph-to-analyze-evaluated.property>-->
  51. <xsl:copy-of select="graph:graph-to-analyze-evaluated.property($graph:property.eval,1)"></xsl:copy-of>
  52. <!--</graph:graph-to-analyze-evaluated.property>-->
  53. </xsl:function>
  54. <xsl:function name="graph:graph-to-analyze-evaluated.property">
  55. <xsl:param name="graph:property.eval" />
  56. <xsl:param name="graph:property.evaluated.recurse_level"/>
  57. <xsl:message>
  58. #51 called for $property.eval = <xsl:value-of select="$graph:property.eval"/></xsl:message>
  59. <xsl:choose>
  60. <xsl:when test="$graph:property.evaluated.recurse_level &gt; 8">
  61. <xsl:message>#38 ERROR RECURSE $graph:property.evaluated.recurse_level=<xsl:value-of select="$graph:property.evaluated.recurse_level"/></xsl:message>
  62. <xsl:attribute name="graph:property.evaluated.recurse_level" select="$graph:property.evaluated.recurse_level"/>
  63. </xsl:when>
  64. <xsl:when test=" contains($graph:property.eval,'\$') or 1=1">
  65. <xsl:variable name="tokens">
  66. <tokens>
  67. <!--<xsl:attribute name="graph:property.eval.esc" select="$graph:property.eval.esc"/>-->
  68. <xsl:for-each select="tokenize($graph:property.eval,'\$\{')">
  69. <xsl:variable name="ifeval" select="contains(.,'}')"/>
  70. <lt>
  71. <xsl:attribute name="ifeval" select="$ifeval"/>
  72. <xsl:attribute name="pos" select="position()"/>
  73. <xsl:attribute name="val" select="."/>
  74. <xsl:for-each select="tokenize(.,'\}')">
  75. <rt>
  76. <xsl:attribute name="pos" select="position()"/>
  77. <xsl:value-of select="."/>
  78. </rt>
  79. </xsl:for-each>
  80. </lt>
  81. </xsl:for-each>
  82. </tokens>
  83. </xsl:variable>
  84. <!--<xsl:variable name="property.value" select=" replace($graph:property.eval,'\$','\\\$')"/>-->
  85. <!--<xsl:variable name="property.value.evaluated" select="$p5dg:p5ant.include.structure//property[]"/>-->
  86. <xsl:variable name="evaluating">
  87. <evaluating>
  88. <xsl:for-each select="$tokens/tokens/lt">
  89. <xsl:variable name="ifeval" select="@ifeval"/>
  90. <xsl:for-each select="rt">
  91. <xsl:choose>
  92. <xsl:when test="@pos='1'">
  93. <xsl:choose>
  94. <xsl:when test=" text()='basedir'">${p5ant:basedir.calculate}</xsl:when>
  95. <xsl:otherwise>
  96. <xsl:variable name="evaluated" select="$graph:graph.graph-to-analyze-property.xml//property[@name=current()][1]/concat(@value,@location)"/>
  97. <xsl:message>#85 looked for current()=<xsl:value-of select="current()"/>, found <xsl:value-of select="$evaluated"/> ; </xsl:message>
  98. <xsl:choose>
  99. <xsl:when test="$evaluated">
  100. <xsl:value-of select="$evaluated"/>
  101. </xsl:when>
  102. <xsl:otherwise>
  103. <xsl:text>{</xsl:text><xsl:value-of select="current()"/><xsl:text>}</xsl:text>
  104. </xsl:otherwise>
  105. </xsl:choose>
  106. </xsl:otherwise>
  107. </xsl:choose>
  108. </xsl:when>
  109. <xsl:otherwise>
  110. <!--<xsl:text>F:</xsl:text>--><xsl:value-of select="."/>
  111. </xsl:otherwise>
  112. </xsl:choose>
  113. </xsl:for-each>
  114. </xsl:for-each>
  115. </evaluating>
  116. </xsl:variable>
  117. <xsl:choose>
  118. <xsl:when test=" contains($evaluating/evaluating/text(),'${')">
  119. <xsl:message>#104-99 recurrent eval <xsl:value-of select="$evaluating//text()"/></xsl:message>
  120. <!--<recurse_evaluating>-->
  121. <!--<xsl:attribute name="evaluating" select="$evaluating/evaluating/text()"/>-->
  122. <xsl:copy-of select="graph:graph-to-analyze-evaluated.property($evaluating/evaluating/text(),$graph:property.evaluated.recurse_level + 1)"/>
  123. <!--</recurse_evaluating>-->
  124. </xsl:when>
  125. <xsl:otherwise>
  126. <!--<graph:property.evaluated>-->
  127. <xsl:value-of select="$evaluating"/>
  128. <!--</graph:property.evaluated>-->
  129. </xsl:otherwise>
  130. </xsl:choose>
  131. </xsl:when>
  132. </xsl:choose>
  133. </xsl:function>
  134. <!--
  135. <xsl:template mode="graph:graph-to-analyze-evaluated.property" match="graph:graph-to-analyze-evaluated.property">
  136. <graph:graph.graph-to-analyze-property.xml>
  137. <xsl:apply-templates mode="#current"/>
  138. </graph:graph.graph-to-analyze-property.xml>
  139. </xsl:template>
  140. <xsl:template mode="graph:graph-to-analyze-evaluated.property" match="recurse_evaluating">
  141. <xsl:value-of select="text()"/>
  142. </xsl:template>
  143. <xsl:template mode="graph:graph-to-analyze-evaluated.property" match="graph:property.evaluated">
  144. <xsl:value-of select="text()"/>
  145. </xsl:template>-->
  146. <!--<xsl:function name="graph:graph-to-analyze-evaluated.property">
  147. <xsl:param name="property_dollars"/>
  148. <xsl:value-of select="replace(replace($property_dollars,'\$\{',''),'\}','')"/>
  149. <!-\- todo multi vals ${dupa}___asd $${dupa} ? -\->
  150. </xsl:function>-->
  151. <xsl:template match="text()|comment()">
  152. <xsl:copy-of select="."/>
  153. </xsl:template>
  154. </xsl:stylesheet>